pybao-cli 1.3.97 → 1.3.99
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-35WMIAEP.js +47 -0
- package/dist/{acp-Y5GVEAK5.js → acp-XZAGDT3N.js} +30 -30
- package/dist/{agentsValidate-HVG4G32H.js → agentsValidate-ZPLW7S35.js} +7 -7
- package/dist/{ask-Q4D437ZY.js → ask-ROXENA55.js} +31 -31
- package/dist/{autoUpdater-2HZ5MXSY.js → autoUpdater-NDX26QV7.js} +3 -3
- package/dist/{chunk-DFGDXB5I.js → chunk-2ULPCMQN.js} +2 -2
- package/dist/{chunk-VCS4L3LA.js → chunk-2WVYPGFK.js} +2 -2
- package/dist/{chunk-D7EHET2A.js → chunk-3HVYGUQ7.js} +3 -3
- package/dist/{chunk-4C2BJ5TH.js → chunk-44DDEUXT.js} +488 -696
- package/dist/chunk-44DDEUXT.js.map +7 -0
- package/dist/{chunk-IGEQR5ET.js → chunk-47PFBKB5.js} +3 -3
- package/dist/{chunk-7ZK32QRX.js → chunk-4NRDC2MN.js} +2 -2
- package/dist/{chunk-DSHUCMWX.js → chunk-5ON6SGBK.js} +1 -1
- package/dist/{chunk-DSHUCMWX.js.map → chunk-5ON6SGBK.js.map} +1 -1
- package/dist/{chunk-VU4GCLM2.js → chunk-B6YMKCYD.js} +2 -2
- package/dist/{chunk-W7CPW6S2.js → chunk-BXOS6YEB.js} +3 -3
- package/dist/{chunk-LGG56SIC.js → chunk-CGHZ2VAY.js} +1 -1
- package/dist/{chunk-4UESJIJZ.js → chunk-CMQGXFRW.js} +1 -1
- package/dist/{chunk-TQAQR7CB.js → chunk-EY2TENGG.js} +1 -1
- package/dist/{chunk-FMZTGW27.js → chunk-HN63ZGCX.js} +4 -4
- package/dist/{chunk-5SWRWOXZ.js → chunk-I23P7CAV.js} +3 -3
- package/dist/{chunk-SHKXEYZX.js → chunk-JFW7GGFH.js} +162 -53
- package/dist/chunk-JFW7GGFH.js.map +7 -0
- package/dist/{chunk-JQ7U4FNJ.js → chunk-L5MUGKPW.js} +3 -3
- package/dist/{chunk-HZQ5D4KE.js → chunk-M2J4YYEX.js} +428 -500
- package/dist/chunk-M2J4YYEX.js.map +7 -0
- package/dist/{chunk-T6MZIN3Y.js → chunk-Q6XLF2PE.js} +1 -1
- package/dist/{chunk-CJ5J54UV.js → chunk-QX6FKMRR.js} +6 -3
- package/dist/chunk-QX6FKMRR.js.map +7 -0
- package/dist/{chunk-IBMWS4VP.js → chunk-T4EFAH55.js} +1 -1
- package/dist/{chunk-GVQW5V5E.js → chunk-U5J6MTAO.js} +2 -2
- package/dist/{chunk-T4CDNQDK.js → chunk-VWENSRU2.js} +4 -7
- package/dist/chunk-VWENSRU2.js.map +7 -0
- package/dist/{chunk-X7NKBF4S.js → chunk-VYINZ75I.js} +1110 -162
- package/dist/chunk-VYINZ75I.js.map +7 -0
- package/dist/{chunk-SRPG24JR.js → chunk-W3RWB5JG.js} +9 -10
- package/dist/{chunk-SRPG24JR.js.map → chunk-W3RWB5JG.js.map} +2 -2
- package/dist/{chunk-ILVR3OKO.js → chunk-WWYDMHKU.js} +1 -1
- package/dist/{chunk-BNTZKC47.js → chunk-X6KY4AMW.js} +2 -2
- package/dist/{chunk-WHWTXVZ4.js → chunk-XLOFU6ZK.js} +1 -1
- package/dist/{chunk-GW4FHFLN.js → chunk-YOK3FML7.js} +1 -1
- package/dist/{chunk-T7MGCO5Q.js → chunk-ZFDSP2ES.js} +2 -2
- package/dist/{chunk-VBDYRFAI.js → chunk-ZI6CKPRG.js} +3 -6
- package/dist/chunk-ZI6CKPRG.js.map +7 -0
- package/dist/{cli-YWSRHJXF.js → cli-W6BTK6IG.js} +88 -88
- package/dist/commands-OGUECGBR.js +51 -0
- package/dist/{config-XEZZSNSO.js → config-MJPE676F.js} +4 -4
- package/dist/{context-O7XDPBZM.js → context-XLNMR7UJ.js} +12 -9
- package/dist/{customCommands-T227ND56.js → customCommands-NJWIPIRB.js} +4 -4
- package/dist/{env-LGLECBD2.js → env-UNJ7A6Y6.js} +2 -2
- package/dist/{file-LRWOIEO2.js → file-CYIU2LVL.js} +4 -4
- package/dist/index.js +3 -3
- package/dist/{llm-KH33MHA2.js → llm-XG5AIU4E.js} +32 -32
- package/dist/{llmLazy-QDJLCLFB.js → llmLazy-7HIZGF35.js} +1 -1
- package/dist/{loader-DOLDAFSG.js → loader-3PAJ74VN.js} +4 -4
- package/dist/{lsp-F2AYEHJW.js → lsp-S2GYO6LP.js} +16 -8
- package/dist/{lspAnchor-LDTVHYPK.js → lspAnchor-VZAH2A7D.js} +6 -6
- package/dist/{mcp-3SENV5JM.js → mcp-36TM4EWY.js} +7 -7
- package/dist/{mentionProcessor-AES6QJFQ.js → mentionProcessor-YIBFG2BE.js} +5 -5
- package/dist/{messages-A77FBKUD.js → messages-GMVNWQYB.js} +1 -1
- package/dist/{model-T5FSSEGT.js → model-QA5R6ZTQ.js} +5 -5
- package/dist/{openai-4Z5HQAPJ.js → openai-AISJCDRB.js} +5 -5
- package/dist/{outputStyles-NPZ5JCX4.js → outputStyles-UNF5PJDX.js} +4 -4
- package/dist/{pluginRuntime-ESATQIVZ.js → pluginRuntime-OPB7TGEW.js} +6 -6
- package/dist/{pluginValidation-ZIDSORKU.js → pluginValidation-GNC62BIO.js} +6 -6
- package/dist/prompts-H6FALR72.js +53 -0
- package/dist/{pybAgentSessionLoad-INUFKXJY.js → pybAgentSessionLoad-FZKVG353.js} +4 -4
- package/dist/{pybAgentSessionResume-QW7NW3GM.js → pybAgentSessionResume-HHSBJMUF.js} +4 -4
- package/dist/{pybAgentStreamJsonSession-GKZPRQGC.js → pybAgentStreamJsonSession-UZOLZ2EE.js} +1 -1
- package/dist/{pybHooks-HD3YL2EO.js → pybHooks-BDHY2ZPR.js} +4 -4
- package/dist/query-XTV7VLUK.js +55 -0
- package/dist/{registry-VYHW665M.js → registry-YC7VJDV4.js} +5 -5
- package/dist/{ripgrep-RUMV7DUX.js → ripgrep-HXHIAV7L.js} +3 -3
- package/dist/{skillMarketplace-TEDBVTRN.js → skillMarketplace-4F6MUJZA.js} +3 -3
- package/dist/{state-BESFSMYW.js → state-BVQ44522.js} +2 -2
- package/dist/{theme-O5XJ5B2X.js → theme-VG4SDCTS.js} +5 -5
- package/dist/{toolPermissionSettings-N4VMBCRF.js → toolPermissionSettings-V4VXC5RQ.js} +6 -6
- package/dist/tools-WZEQJIS5.js +52 -0
- package/dist/{userInput-65GMTCNY.js → userInput-4FUGSRKW.js} +31 -31
- package/package.json +1 -1
- package/dist/REPL-4UQT2JYD.js +0 -47
- package/dist/chunk-4C2BJ5TH.js.map +0 -7
- package/dist/chunk-CJ5J54UV.js.map +0 -7
- package/dist/chunk-HZQ5D4KE.js.map +0 -7
- package/dist/chunk-SHKXEYZX.js.map +0 -7
- package/dist/chunk-T4CDNQDK.js.map +0 -7
- package/dist/chunk-VBDYRFAI.js.map +0 -7
- package/dist/chunk-X7NKBF4S.js.map +0 -7
- package/dist/commands-KRK3MO6Q.js +0 -51
- package/dist/prompts-VSJKN5BB.js +0 -53
- package/dist/query-F5YSMI7D.js +0 -61
- package/dist/tools-V5NSQILS.js +0 -52
- /package/dist/{REPL-4UQT2JYD.js.map → REPL-35WMIAEP.js.map} +0 -0
- /package/dist/{acp-Y5GVEAK5.js.map → acp-XZAGDT3N.js.map} +0 -0
- /package/dist/{agentsValidate-HVG4G32H.js.map → agentsValidate-ZPLW7S35.js.map} +0 -0
- /package/dist/{ask-Q4D437ZY.js.map → ask-ROXENA55.js.map} +0 -0
- /package/dist/{autoUpdater-2HZ5MXSY.js.map → autoUpdater-NDX26QV7.js.map} +0 -0
- /package/dist/{chunk-DFGDXB5I.js.map → chunk-2ULPCMQN.js.map} +0 -0
- /package/dist/{chunk-VCS4L3LA.js.map → chunk-2WVYPGFK.js.map} +0 -0
- /package/dist/{chunk-D7EHET2A.js.map → chunk-3HVYGUQ7.js.map} +0 -0
- /package/dist/{chunk-IGEQR5ET.js.map → chunk-47PFBKB5.js.map} +0 -0
- /package/dist/{chunk-7ZK32QRX.js.map → chunk-4NRDC2MN.js.map} +0 -0
- /package/dist/{chunk-VU4GCLM2.js.map → chunk-B6YMKCYD.js.map} +0 -0
- /package/dist/{chunk-W7CPW6S2.js.map → chunk-BXOS6YEB.js.map} +0 -0
- /package/dist/{chunk-LGG56SIC.js.map → chunk-CGHZ2VAY.js.map} +0 -0
- /package/dist/{chunk-4UESJIJZ.js.map → chunk-CMQGXFRW.js.map} +0 -0
- /package/dist/{chunk-TQAQR7CB.js.map → chunk-EY2TENGG.js.map} +0 -0
- /package/dist/{chunk-FMZTGW27.js.map → chunk-HN63ZGCX.js.map} +0 -0
- /package/dist/{chunk-5SWRWOXZ.js.map → chunk-I23P7CAV.js.map} +0 -0
- /package/dist/{chunk-JQ7U4FNJ.js.map → chunk-L5MUGKPW.js.map} +0 -0
- /package/dist/{chunk-T6MZIN3Y.js.map → chunk-Q6XLF2PE.js.map} +0 -0
- /package/dist/{chunk-IBMWS4VP.js.map → chunk-T4EFAH55.js.map} +0 -0
- /package/dist/{chunk-GVQW5V5E.js.map → chunk-U5J6MTAO.js.map} +0 -0
- /package/dist/{chunk-ILVR3OKO.js.map → chunk-WWYDMHKU.js.map} +0 -0
- /package/dist/{chunk-BNTZKC47.js.map → chunk-X6KY4AMW.js.map} +0 -0
- /package/dist/{chunk-WHWTXVZ4.js.map → chunk-XLOFU6ZK.js.map} +0 -0
- /package/dist/{chunk-GW4FHFLN.js.map → chunk-YOK3FML7.js.map} +0 -0
- /package/dist/{chunk-T7MGCO5Q.js.map → chunk-ZFDSP2ES.js.map} +0 -0
- /package/dist/{cli-YWSRHJXF.js.map → cli-W6BTK6IG.js.map} +0 -0
- /package/dist/{commands-KRK3MO6Q.js.map → commands-OGUECGBR.js.map} +0 -0
- /package/dist/{config-XEZZSNSO.js.map → config-MJPE676F.js.map} +0 -0
- /package/dist/{context-O7XDPBZM.js.map → context-XLNMR7UJ.js.map} +0 -0
- /package/dist/{customCommands-T227ND56.js.map → customCommands-NJWIPIRB.js.map} +0 -0
- /package/dist/{env-LGLECBD2.js.map → env-UNJ7A6Y6.js.map} +0 -0
- /package/dist/{file-LRWOIEO2.js.map → file-CYIU2LVL.js.map} +0 -0
- /package/dist/{llm-KH33MHA2.js.map → llm-XG5AIU4E.js.map} +0 -0
- /package/dist/{llmLazy-QDJLCLFB.js.map → llmLazy-7HIZGF35.js.map} +0 -0
- /package/dist/{loader-DOLDAFSG.js.map → loader-3PAJ74VN.js.map} +0 -0
- /package/dist/{lsp-F2AYEHJW.js.map → lsp-S2GYO6LP.js.map} +0 -0
- /package/dist/{lspAnchor-LDTVHYPK.js.map → lspAnchor-VZAH2A7D.js.map} +0 -0
- /package/dist/{mcp-3SENV5JM.js.map → mcp-36TM4EWY.js.map} +0 -0
- /package/dist/{mentionProcessor-AES6QJFQ.js.map → mentionProcessor-YIBFG2BE.js.map} +0 -0
- /package/dist/{messages-A77FBKUD.js.map → messages-GMVNWQYB.js.map} +0 -0
- /package/dist/{model-T5FSSEGT.js.map → model-QA5R6ZTQ.js.map} +0 -0
- /package/dist/{openai-4Z5HQAPJ.js.map → openai-AISJCDRB.js.map} +0 -0
- /package/dist/{outputStyles-NPZ5JCX4.js.map → outputStyles-UNF5PJDX.js.map} +0 -0
- /package/dist/{pluginRuntime-ESATQIVZ.js.map → pluginRuntime-OPB7TGEW.js.map} +0 -0
- /package/dist/{pluginValidation-ZIDSORKU.js.map → pluginValidation-GNC62BIO.js.map} +0 -0
- /package/dist/{prompts-VSJKN5BB.js.map → prompts-H6FALR72.js.map} +0 -0
- /package/dist/{pybAgentSessionLoad-INUFKXJY.js.map → pybAgentSessionLoad-FZKVG353.js.map} +0 -0
- /package/dist/{pybAgentSessionResume-QW7NW3GM.js.map → pybAgentSessionResume-HHSBJMUF.js.map} +0 -0
- /package/dist/{pybAgentStreamJsonSession-GKZPRQGC.js.map → pybAgentStreamJsonSession-UZOLZ2EE.js.map} +0 -0
- /package/dist/{pybHooks-HD3YL2EO.js.map → pybHooks-BDHY2ZPR.js.map} +0 -0
- /package/dist/{query-F5YSMI7D.js.map → query-XTV7VLUK.js.map} +0 -0
- /package/dist/{registry-VYHW665M.js.map → registry-YC7VJDV4.js.map} +0 -0
- /package/dist/{ripgrep-RUMV7DUX.js.map → ripgrep-HXHIAV7L.js.map} +0 -0
- /package/dist/{skillMarketplace-TEDBVTRN.js.map → skillMarketplace-4F6MUJZA.js.map} +0 -0
- /package/dist/{state-BESFSMYW.js.map → state-BVQ44522.js.map} +0 -0
- /package/dist/{theme-O5XJ5B2X.js.map → theme-VG4SDCTS.js.map} +0 -0
- /package/dist/{toolPermissionSettings-N4VMBCRF.js.map → toolPermissionSettings-V4VXC5RQ.js.map} +0 -0
- /package/dist/{tools-V5NSQILS.js.map → tools-WZEQJIS5.js.map} +0 -0
- /package/dist/{userInput-65GMTCNY.js.map → userInput-4FUGSRKW.js.map} +0 -0
|
@@ -3,18 +3,18 @@ const require = __pybCreateRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
formatValidationResult,
|
|
5
5
|
validatePluginOrMarketplacePath
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-BXOS6YEB.js";
|
|
7
7
|
import {
|
|
8
8
|
loadPybAgentSessionMessages
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-CGHZ2VAY.js";
|
|
10
10
|
import {
|
|
11
11
|
listPybAgentSessions
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-EY2TENGG.js";
|
|
13
13
|
import {
|
|
14
14
|
appendSessionCustomTitleRecord,
|
|
15
15
|
appendSessionJsonlFromMessage,
|
|
16
16
|
appendSessionTagRecord
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-U5J6MTAO.js";
|
|
18
18
|
import {
|
|
19
19
|
drainHookSystemPromptAdditions,
|
|
20
20
|
getHookTranscriptPath,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
runStopHooks,
|
|
27
27
|
runUserPromptSubmitHooks,
|
|
28
28
|
updateHookTranscriptForMessages
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-3HVYGUQ7.js";
|
|
30
30
|
import {
|
|
31
31
|
DEFAULT_OUTPUT_STYLE,
|
|
32
32
|
getAvailableOutputStyles,
|
|
@@ -35,16 +35,16 @@ import {
|
|
|
35
35
|
getOutputStyleSystemPromptAdditions,
|
|
36
36
|
resolveOutputStyleName,
|
|
37
37
|
setCurrentOutputStyle
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-4NRDC2MN.js";
|
|
39
39
|
import {
|
|
40
40
|
fetchCustomModels,
|
|
41
41
|
getModelFeatures
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-2WVYPGFK.js";
|
|
43
43
|
import {
|
|
44
44
|
queryLLM,
|
|
45
45
|
queryQuick,
|
|
46
46
|
verifyApiKey
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-HN63ZGCX.js";
|
|
48
48
|
import {
|
|
49
49
|
DEFAULT_TIMEOUT_MS,
|
|
50
50
|
FallbackToolUseRejectedMessage,
|
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
listMCPServers,
|
|
59
59
|
loadMergedSettings,
|
|
60
60
|
normalizeSandboxRuntimeConfigFromSettings
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-W3RWB5JG.js";
|
|
62
62
|
import {
|
|
63
63
|
addMarketplace,
|
|
64
64
|
disableSkillPlugin,
|
|
@@ -71,11 +71,11 @@ import {
|
|
|
71
71
|
refreshMarketplaceAsync,
|
|
72
72
|
removeMarketplace,
|
|
73
73
|
uninstallSkillPlugin
|
|
74
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-XLOFU6ZK.js";
|
|
75
75
|
import {
|
|
76
76
|
loadToolPermissionContextFromDisk,
|
|
77
77
|
persistToolPermissionUpdateToDisk
|
|
78
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-47PFBKB5.js";
|
|
79
79
|
import {
|
|
80
80
|
applyToolPermissionContextUpdate,
|
|
81
81
|
createDefaultToolPermissionContext
|
|
@@ -88,7 +88,7 @@ import {
|
|
|
88
88
|
resetReminderSession,
|
|
89
89
|
setTodos,
|
|
90
90
|
systemReminderService
|
|
91
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-2ULPCMQN.js";
|
|
92
92
|
import {
|
|
93
93
|
getSessionState
|
|
94
94
|
} from "./chunk-ERMQRV55.js";
|
|
@@ -97,7 +97,7 @@ import {
|
|
|
97
97
|
getActiveAgents,
|
|
98
98
|
getAgentByType,
|
|
99
99
|
getAllAgents
|
|
100
|
-
} from "./chunk-
|
|
100
|
+
} from "./chunk-X6KY4AMW.js";
|
|
101
101
|
import {
|
|
102
102
|
API_ERROR_MESSAGE_PREFIX,
|
|
103
103
|
CANCEL_MESSAGE,
|
|
@@ -127,7 +127,7 @@ import {
|
|
|
127
127
|
processUserInput,
|
|
128
128
|
reorderMessages,
|
|
129
129
|
stripSystemMessages
|
|
130
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-WWYDMHKU.js";
|
|
131
131
|
import {
|
|
132
132
|
getRequestStatus,
|
|
133
133
|
setRequestStatus,
|
|
@@ -137,6 +137,13 @@ import {
|
|
|
137
137
|
getPybAgentSessionId,
|
|
138
138
|
setPybAgentSessionId
|
|
139
139
|
} from "./chunk-B6IMQJZM.js";
|
|
140
|
+
import {
|
|
141
|
+
formatTotalCost,
|
|
142
|
+
getTotalAPIDuration,
|
|
143
|
+
getTotalCost,
|
|
144
|
+
getTotalDuration,
|
|
145
|
+
wrapText
|
|
146
|
+
} from "./chunk-OUXHGDLH.js";
|
|
140
147
|
import {
|
|
141
148
|
addLineNumbers,
|
|
142
149
|
detectFileEncoding,
|
|
@@ -150,10 +157,7 @@ import {
|
|
|
150
157
|
normalizeFilePath,
|
|
151
158
|
readTextContent,
|
|
152
159
|
writeTextContent
|
|
153
|
-
} from "./chunk-
|
|
154
|
-
import {
|
|
155
|
-
ripGrep
|
|
156
|
-
} from "./chunk-T4CDNQDK.js";
|
|
160
|
+
} from "./chunk-ZFDSP2ES.js";
|
|
157
161
|
import {
|
|
158
162
|
parseBlockEdits
|
|
159
163
|
} from "./chunk-QWIBSCDN.js";
|
|
@@ -163,17 +167,17 @@ import {
|
|
|
163
167
|
ParserRegistry,
|
|
164
168
|
initParser,
|
|
165
169
|
loadLanguage
|
|
166
|
-
} from "./chunk-
|
|
170
|
+
} from "./chunk-VYINZ75I.js";
|
|
167
171
|
import {
|
|
168
172
|
getSettingsFileCandidates,
|
|
169
173
|
loadSettingsWithLegacyFallback
|
|
170
|
-
} from "./chunk-
|
|
174
|
+
} from "./chunk-YOK3FML7.js";
|
|
171
175
|
import {
|
|
172
176
|
getCustomCommandDirectories,
|
|
173
177
|
hasCustomCommands,
|
|
174
178
|
loadCustomCommands,
|
|
175
179
|
reloadCustomCommands
|
|
176
|
-
} from "./chunk-
|
|
180
|
+
} from "./chunk-B6YMKCYD.js";
|
|
177
181
|
import {
|
|
178
182
|
getSessionPlugins
|
|
179
183
|
} from "./chunk-BJSWTHRM.js";
|
|
@@ -181,18 +185,21 @@ import {
|
|
|
181
185
|
ModelManager,
|
|
182
186
|
getModelManager,
|
|
183
187
|
isDefaultSlowAndCapableModel
|
|
184
|
-
} from "./chunk-
|
|
188
|
+
} from "./chunk-L5MUGKPW.js";
|
|
185
189
|
import {
|
|
186
|
-
clearContextCache,
|
|
187
190
|
getCodeStyle,
|
|
188
191
|
getContext,
|
|
189
192
|
getGitState,
|
|
190
193
|
getIsGit,
|
|
191
|
-
getProjectDocs
|
|
192
|
-
|
|
194
|
+
getProjectDocs,
|
|
195
|
+
getProjectStructureStatisticsBlock
|
|
196
|
+
} from "./chunk-JFW7GGFH.js";
|
|
197
|
+
import {
|
|
198
|
+
ripGrep
|
|
199
|
+
} from "./chunk-VWENSRU2.js";
|
|
193
200
|
import {
|
|
194
201
|
getTheme
|
|
195
|
-
} from "./chunk-
|
|
202
|
+
} from "./chunk-Q6XLF2PE.js";
|
|
196
203
|
import {
|
|
197
204
|
DEFAULT_GLOBAL_CONFIG,
|
|
198
205
|
enableConfigs,
|
|
@@ -205,7 +212,7 @@ import {
|
|
|
205
212
|
saveGlobalConfig,
|
|
206
213
|
setAllPointersToModel,
|
|
207
214
|
setModelPointer
|
|
208
|
-
} from "./chunk-
|
|
215
|
+
} from "./chunk-ZI6CKPRG.js";
|
|
209
216
|
import {
|
|
210
217
|
AbortError
|
|
211
218
|
} from "./chunk-RQVLBMP7.js";
|
|
@@ -214,7 +221,7 @@ import {
|
|
|
214
221
|
getCurrentRequest,
|
|
215
222
|
logUserFriendly,
|
|
216
223
|
markPhase
|
|
217
|
-
} from "./chunk-
|
|
224
|
+
} from "./chunk-T4EFAH55.js";
|
|
218
225
|
import {
|
|
219
226
|
ASCII_LOGO,
|
|
220
227
|
BunShell,
|
|
@@ -253,17 +260,10 @@ import {
|
|
|
253
260
|
setCwd,
|
|
254
261
|
shouldApplyToolOutputTruncation,
|
|
255
262
|
truncateToolOutput
|
|
256
|
-
} from "./chunk-
|
|
263
|
+
} from "./chunk-CMQGXFRW.js";
|
|
257
264
|
import {
|
|
258
265
|
MACRO
|
|
259
|
-
} from "./chunk-
|
|
260
|
-
import {
|
|
261
|
-
formatTotalCost,
|
|
262
|
-
getTotalAPIDuration,
|
|
263
|
-
getTotalCost,
|
|
264
|
-
getTotalDuration,
|
|
265
|
-
wrapText
|
|
266
|
-
} from "./chunk-OUXHGDLH.js";
|
|
266
|
+
} from "./chunk-5ON6SGBK.js";
|
|
267
267
|
import {
|
|
268
268
|
__export
|
|
269
269
|
} from "./chunk-I3J4JYES.js";
|
|
@@ -444,7 +444,7 @@ var getCommandSubcommandPrefix = memoize(
|
|
|
444
444
|
var getCommandPrefix = memoize(
|
|
445
445
|
async (command4, abortSignal) => {
|
|
446
446
|
const { systemPrompt, userPrompt } = buildBashCommandPrefixDetectionPrompt(command4);
|
|
447
|
-
const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryQuick: queryQuick2 } = await import("./llm-
|
|
447
|
+
const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryQuick: queryQuick2 } = await import("./llm-XG5AIU4E.js");
|
|
448
448
|
const response = await queryQuick2({
|
|
449
449
|
systemPrompt,
|
|
450
450
|
userPrompt,
|
|
@@ -4246,7 +4246,7 @@ function formatParseError(error) {
|
|
|
4246
4246
|
return error instanceof Error ? error.message : String(error);
|
|
4247
4247
|
}
|
|
4248
4248
|
async function defaultGateQuery(args) {
|
|
4249
|
-
const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryLLM: queryLLM2 } = await import("./llm-
|
|
4249
|
+
const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryLLM: queryLLM2 } = await import("./llm-XG5AIU4E.js");
|
|
4250
4250
|
const queryLLMFn = args.queryLLMOverride ?? queryLLM2;
|
|
4251
4251
|
const messages = [
|
|
4252
4252
|
{
|
|
@@ -4626,7 +4626,6 @@ function getCommandSource(context) {
|
|
|
4626
4626
|
import { Box as Box5, Text as Text5 } from "ink";
|
|
4627
4627
|
import React5 from "react";
|
|
4628
4628
|
import { z } from "zod";
|
|
4629
|
-
import { parse as parse4 } from "node-html-parser";
|
|
4630
4629
|
|
|
4631
4630
|
// src/ui/components/Cost.tsx
|
|
4632
4631
|
import * as React4 from "react";
|
|
@@ -4642,20 +4641,18 @@ function Cost({ costUSD, durationMs, debug: debug2 }) {
|
|
|
4642
4641
|
// src/tools/network/WebFetchTool/prompt.ts
|
|
4643
4642
|
var TOOL_NAME_FOR_PROMPT = "WebFetch";
|
|
4644
4643
|
var PROMPT = `
|
|
4645
|
-
- Fetches content from a specified URL
|
|
4646
|
-
- Takes a URL and
|
|
4647
|
-
- Fetches the URL content, converts HTML to
|
|
4648
|
-
- Processes the content with the prompt using a small, fast model
|
|
4649
|
-
- Returns
|
|
4650
|
-
- Use this tool when you need to retrieve
|
|
4644
|
+
- Fetches content from a specified URL and processes it using an AI model
|
|
4645
|
+
- Takes a URL and a prompt as input
|
|
4646
|
+
- Fetches the URL content, converts HTML to markdown
|
|
4647
|
+
- Processes the content with the prompt using a small, fast model
|
|
4648
|
+
- Returns the model's response about the content
|
|
4649
|
+
- Use this tool when you need to retrieve and analyze web content
|
|
4651
4650
|
|
|
4652
4651
|
Usage notes:
|
|
4653
4652
|
- IMPORTANT: If an MCP-provided web fetch tool is available, prefer using that tool instead of this one, as it may have fewer restrictions.
|
|
4654
4653
|
- The URL must be a fully-formed valid URL
|
|
4655
4654
|
- HTTP URLs will be automatically upgraded to HTTPS
|
|
4656
4655
|
- The prompt should describe what information you want to extract from the page
|
|
4657
|
-
- Format options: "markdown" (default), "text", or "html"
|
|
4658
|
-
- Timeout is optional and defaults to 30 seconds
|
|
4659
4656
|
- This tool is read-only and does not modify any files
|
|
4660
4657
|
- Results may be summarized if the content is very large
|
|
4661
4658
|
- Includes a self-cleaning 15-minute cache for faster responses when repeatedly accessing the same URL
|
|
@@ -4693,8 +4690,8 @@ turndownService.addRule("cleanLinks", {
|
|
|
4693
4690
|
});
|
|
4694
4691
|
function convertHtmlToMarkdown(html) {
|
|
4695
4692
|
try {
|
|
4696
|
-
const
|
|
4697
|
-
const markdown = turndownService.turndown(
|
|
4693
|
+
const cleanHtml = html.replace(/<script[^>]*>[\s\S]*?<\/script>/gi, "").replace(/<style[^>]*>[\s\S]*?<\/style>/gi, "").replace(/<!--[\s\S]*?-->/g, "").replace(/\s+/g, " ").trim();
|
|
4694
|
+
const markdown = turndownService.turndown(cleanHtml);
|
|
4698
4695
|
return markdown.replace(/\n{3,}/g, "\n\n").replace(/^\s+|\s+$/gm, "").trim();
|
|
4699
4696
|
} catch (error) {
|
|
4700
4697
|
throw new Error(
|
|
@@ -4749,9 +4746,7 @@ var urlCache = new URLCache();
|
|
|
4749
4746
|
// src/tools/network/WebFetchTool/WebFetchTool.tsx
|
|
4750
4747
|
var inputSchema = z.strictObject({
|
|
4751
4748
|
url: z.string().url().describe("The URL to fetch content from"),
|
|
4752
|
-
prompt: z.string().
|
|
4753
|
-
format: z.enum(["markdown", "html", "text"]).optional().describe("Output format (default: markdown)"),
|
|
4754
|
-
timeout: z.number().optional().describe("Timeout in seconds (default: 30)")
|
|
4749
|
+
prompt: z.string().describe("The prompt to run on the fetched content")
|
|
4755
4750
|
});
|
|
4756
4751
|
var FETCH_TIMEOUT_MS = 3e4;
|
|
4757
4752
|
var MAX_URL_LENGTH = 2e3;
|
|
@@ -4843,27 +4838,6 @@ function truncateFetchedContent(content) {
|
|
|
4843
4838
|
if (content.length <= MAX_CONTENT_CHARS) return content;
|
|
4844
4839
|
return `${content.substring(0, MAX_CONTENT_CHARS)}...[content truncated]`;
|
|
4845
4840
|
}
|
|
4846
|
-
function cleanHtml(html) {
|
|
4847
|
-
const root = parse4(html);
|
|
4848
|
-
const elementsToRemove = root.querySelectorAll(
|
|
4849
|
-
"script, style, nav, footer, iframe, noscript, object, embed"
|
|
4850
|
-
);
|
|
4851
|
-
elementsToRemove.forEach((el) => el.remove());
|
|
4852
|
-
return root.toString();
|
|
4853
|
-
}
|
|
4854
|
-
function convertHtmlToText(html) {
|
|
4855
|
-
const cleaned = cleanHtml(html);
|
|
4856
|
-
const root = parse4(cleaned);
|
|
4857
|
-
return root.textContent.trim();
|
|
4858
|
-
}
|
|
4859
|
-
function applyFormat(rawContent, contentType, format3) {
|
|
4860
|
-
if (!contentType.toLowerCase().includes("text/html")) {
|
|
4861
|
-
return rawContent;
|
|
4862
|
-
}
|
|
4863
|
-
if (format3 === "html") return cleanHtml(rawContent);
|
|
4864
|
-
if (format3 === "text") return convertHtmlToText(rawContent);
|
|
4865
|
-
return convertHtmlToMarkdown(rawContent);
|
|
4866
|
-
}
|
|
4867
4841
|
function isMarkdownHost(url2, contentType) {
|
|
4868
4842
|
const lowerContentType = contentType.toLowerCase();
|
|
4869
4843
|
if (lowerContentType.includes("text/markdown")) return true;
|
|
@@ -4974,15 +4948,9 @@ var WebFetchTool = {
|
|
|
4974
4948
|
}
|
|
4975
4949
|
return { result: true };
|
|
4976
4950
|
},
|
|
4977
|
-
renderToolUseMessage({ url: url2, prompt
|
|
4951
|
+
renderToolUseMessage({ url: url2, prompt }, { verbose }) {
|
|
4978
4952
|
if (verbose) {
|
|
4979
|
-
|
|
4980
|
-
`url: "${url2}"`,
|
|
4981
|
-
prompt ? `prompt: "${prompt}"` : null,
|
|
4982
|
-
format3 ? `format: "${format3}"` : null,
|
|
4983
|
-
timeout ? `timeout: ${timeout}s` : null
|
|
4984
|
-
].filter(Boolean);
|
|
4985
|
-
return details.join(", ");
|
|
4953
|
+
return `url: "${url2}"${prompt ? `, prompt: "${prompt}"` : ""}`;
|
|
4986
4954
|
}
|
|
4987
4955
|
return url2;
|
|
4988
4956
|
},
|
|
@@ -4993,19 +4961,14 @@ var WebFetchTool = {
|
|
|
4993
4961
|
return /* @__PURE__ */ React5.createElement(Box5, { justifyContent: "space-between", width: "100%" }, /* @__PURE__ */ React5.createElement(Box5, { flexDirection: "row" }, /* @__PURE__ */ React5.createElement(Text5, null, "\xA0\xA0\u23BF \xA0Received "), /* @__PURE__ */ React5.createElement(Text5, { bold: true }, formatBytes(output.bytes), " "), /* @__PURE__ */ React5.createElement(Text5, null, "(", output.code, " ", output.codeText, ")")), /* @__PURE__ */ React5.createElement(Cost, { costUSD: 0, durationMs: output.durationMs, debug: false }));
|
|
4994
4962
|
},
|
|
4995
4963
|
renderResultForAssistant(output) {
|
|
4996
|
-
if (output.mode === "fetch") {
|
|
4997
|
-
return `Content from ${output.url} (Format: ${output.format}):
|
|
4998
|
-
|
|
4999
|
-
${output.result}`;
|
|
5000
|
-
}
|
|
5001
4964
|
return output.result;
|
|
5002
4965
|
},
|
|
5003
|
-
async *call({ url: url2, prompt
|
|
4966
|
+
async *call({ url: url2, prompt }, context) {
|
|
5004
4967
|
const normalizedUrl = normalizeUrl(url2);
|
|
5005
4968
|
const start = Date.now();
|
|
5006
4969
|
const timeoutSignal = createTimeoutSignal(
|
|
5007
4970
|
context.abortController.signal,
|
|
5008
|
-
|
|
4971
|
+
FETCH_TIMEOUT_MS
|
|
5009
4972
|
);
|
|
5010
4973
|
try {
|
|
5011
4974
|
const cached = urlCache.get(normalizedUrl);
|
|
@@ -5027,10 +4990,7 @@ To complete your request, I need to fetch content from the redirected URL. Pleas
|
|
|
5027
4990
|
codeText: codeText2,
|
|
5028
4991
|
result: result2,
|
|
5029
4992
|
durationMs: Date.now() - start,
|
|
5030
|
-
url: normalizedUrl
|
|
5031
|
-
mode: "analysis",
|
|
5032
|
-
format: "markdown",
|
|
5033
|
-
cached: Boolean(cached)
|
|
4993
|
+
url: normalizedUrl
|
|
5034
4994
|
};
|
|
5035
4995
|
yield {
|
|
5036
4996
|
type: "result",
|
|
@@ -5042,7 +5002,7 @@ To complete your request, I need to fetch content from the redirected URL. Pleas
|
|
|
5042
5002
|
let bytes = cached ? cached.bytes : 0;
|
|
5043
5003
|
let code = cached ? cached.code : 200;
|
|
5044
5004
|
let codeText = cached ? cached.codeText : "OK";
|
|
5045
|
-
let
|
|
5005
|
+
let markdown = cached ? cached.content : "";
|
|
5046
5006
|
let contentType = cached ? cached.contentType : "";
|
|
5047
5007
|
if (fetched && fetched.type === "response") {
|
|
5048
5008
|
const response = fetched.response;
|
|
@@ -5051,47 +5011,36 @@ To complete your request, I need to fetch content from the redirected URL. Pleas
|
|
|
5051
5011
|
contentType = response.headers.get("content-type") || "";
|
|
5052
5012
|
const { text: raw, bytes: responseBytes } = await readResponseTextLimited(response, MAX_RESPONSE_BYTES);
|
|
5053
5013
|
bytes = responseBytes;
|
|
5054
|
-
|
|
5014
|
+
const converted = contentType.toLowerCase().includes("text/html") ? convertHtmlToMarkdown(raw) : raw;
|
|
5015
|
+
markdown = truncateFetchedContent(converted);
|
|
5055
5016
|
urlCache.set(normalizedUrl, {
|
|
5056
5017
|
bytes,
|
|
5057
5018
|
code,
|
|
5058
5019
|
codeText,
|
|
5059
|
-
|
|
5020
|
+
content: markdown,
|
|
5060
5021
|
contentType
|
|
5061
5022
|
});
|
|
5062
5023
|
}
|
|
5063
|
-
const
|
|
5064
|
-
const
|
|
5065
|
-
|
|
5024
|
+
const allowBroaderQuoting = isMarkdownHost(normalizedUrl, contentType);
|
|
5025
|
+
const userPrompt = buildWebFetchApplyPrompt(
|
|
5026
|
+
markdown,
|
|
5027
|
+
prompt,
|
|
5028
|
+
allowBroaderQuoting
|
|
5066
5029
|
);
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
allowBroaderQuoting
|
|
5075
|
-
);
|
|
5076
|
-
const aiResponse = await queryQuick({
|
|
5077
|
-
systemPrompt: [],
|
|
5078
|
-
userPrompt,
|
|
5079
|
-
enablePromptCaching: false,
|
|
5080
|
-
signal: timeoutSignal.signal
|
|
5081
|
-
});
|
|
5082
|
-
result = aiResponse.message.content[0]?.text || "No response from model";
|
|
5083
|
-
mode = "analysis";
|
|
5084
|
-
}
|
|
5030
|
+
const aiResponse = await queryQuick({
|
|
5031
|
+
systemPrompt: [],
|
|
5032
|
+
userPrompt,
|
|
5033
|
+
enablePromptCaching: false,
|
|
5034
|
+
signal: timeoutSignal.signal
|
|
5035
|
+
});
|
|
5036
|
+
const result = aiResponse.message.content[0]?.text || "No response from model";
|
|
5085
5037
|
const output = {
|
|
5086
5038
|
bytes,
|
|
5087
5039
|
code,
|
|
5088
5040
|
codeText,
|
|
5089
5041
|
result,
|
|
5090
5042
|
durationMs: Date.now() - start,
|
|
5091
|
-
url: normalizedUrl
|
|
5092
|
-
mode,
|
|
5093
|
-
format: outputFormat,
|
|
5094
|
-
cached: Boolean(cached)
|
|
5043
|
+
url: normalizedUrl
|
|
5095
5044
|
};
|
|
5096
5045
|
yield {
|
|
5097
5046
|
type: "result",
|
|
@@ -5106,10 +5055,7 @@ To complete your request, I need to fetch content from the redirected URL. Pleas
|
|
|
5106
5055
|
codeText: "",
|
|
5107
5056
|
result: `Error processing URL ${normalizedUrl}: ${message}`,
|
|
5108
5057
|
durationMs: Date.now() - start,
|
|
5109
|
-
url: normalizedUrl
|
|
5110
|
-
mode: "analysis",
|
|
5111
|
-
format: "markdown",
|
|
5112
|
-
cached: false
|
|
5058
|
+
url: normalizedUrl
|
|
5113
5059
|
};
|
|
5114
5060
|
yield {
|
|
5115
5061
|
type: "result",
|
|
@@ -6355,7 +6301,7 @@ Usage:
|
|
|
6355
6301
|
\`\`\`
|
|
6356
6302
|
3. **Multiple Edits**: You can provide multiple blocks in a single turn to perform batch edits.
|
|
6357
6303
|
4. **Context**: Include enough surrounding lines in the SEARCH block to ensure uniqueness.
|
|
6358
|
-
5. **Indentation**: Preserve the exact indentation (tabs/spaces) of the original file in your SEARCH block.
|
|
6304
|
+
5. **Indentation**: Preserve the exact indentation (tabs/spaces) of the original file in your SEARCH block.
|
|
6359
6305
|
6. **Smart Matching**: The tool uses a fuzzy matching engine and LSP anchoring. It can locate code even if there are minor differences in whitespace or indentation.
|
|
6360
6306
|
7. **Verification (Recommended)**: Set \`verify: true\` to enable atomic verification. The tool will check for syntax errors after editing and automatically ROLLBACK if errors are detected. Use this for complex edits or when ensuring stability.
|
|
6361
6307
|
8. **Thinking**: You can include "thinking" text between blocks; the tool will ignore it.
|
|
@@ -6560,7 +6506,7 @@ var FileEditTool = {
|
|
|
6560
6506
|
const originalFileContent = currentFileContent;
|
|
6561
6507
|
let totalPatch = [];
|
|
6562
6508
|
const { SmartEdit } = await import("./smart-edit-AWHJDSU6.js");
|
|
6563
|
-
const { findLspAnchor } = await import("./lspAnchor-
|
|
6509
|
+
const { findLspAnchor } = await import("./lspAnchor-VZAH2A7D.js");
|
|
6564
6510
|
for (const op of editOperations) {
|
|
6565
6511
|
const normalizedSearch = normalizeLineEndings(op.search);
|
|
6566
6512
|
const normalizedReplace = normalizeLineEndings(op.replace);
|
|
@@ -7820,29 +7766,25 @@ ${addLineNumbers({
|
|
|
7820
7766
|
}
|
|
7821
7767
|
};
|
|
7822
7768
|
|
|
7823
|
-
// src/tools/
|
|
7769
|
+
// src/tools/filesystem/GlobTool/GlobTool.tsx
|
|
7824
7770
|
import { Box as Box14, Text as Text15 } from "ink";
|
|
7825
7771
|
import React15 from "react";
|
|
7826
7772
|
import { z as z6 } from "zod";
|
|
7827
7773
|
|
|
7828
|
-
// src/tools/
|
|
7774
|
+
// src/tools/filesystem/GlobTool/prompt.ts
|
|
7829
7775
|
var TOOL_NAME_FOR_PROMPT2 = "Glob";
|
|
7830
7776
|
var DESCRIPTION4 = `- Fast file pattern matching tool that works with any codebase size
|
|
7831
7777
|
- Supports glob patterns like "**/*.js" or "src/**/*.ts"
|
|
7832
7778
|
- Returns matching file paths sorted by modification time
|
|
7833
|
-
- Use this tool when you need to
|
|
7834
|
-
-
|
|
7835
|
-
-
|
|
7836
|
-
- You can combine Batch to run multiple Globs in parallel for faster locating, but Glob only matches paths/filenames; use Grep or LSP for content keyword searches
|
|
7837
|
-
- Parallel examples: \`*\` + \`*/\` + \`**/package.json\` + \`**/pyproject.toml\` + \`**/README*\`
|
|
7838
|
-
- Partition scan: run \`src/*\`, \`docs/*\`, \`tests/*\` in parallel to build a first-level structure snapshot
|
|
7839
|
-
- Multi-repo filtering: run \`*/.git\` and \`*/package.json\` in parallel to locate candidate repos
|
|
7840
|
-
- Combination strategy: use LS to build the index tree, Glob to confirm existence, then Grep/LSP for content
|
|
7779
|
+
- Use this tool when you need to find files by name patterns
|
|
7780
|
+
- **Semantic Search**: Set \`semantic: true\` to search for code symbols (classes, functions, variables) instead of just file names. This is powered by LSP and can find files based on their *content* definitions even if the filename is different.
|
|
7781
|
+
- \u8BED\u4E49\u641C\u7D22\u4E3A\u663E\u5F0F\u89E6\u53D1\uFF1A\u53EA\u6709\u5728\u5E38\u89C4\u6A21\u5F0F\u65E0\u7ED3\u679C\u6216\u660E\u786E\u9700\u8981\u8BED\u4E49\u5B9A\u4F4D\u65F6\u518D\u542F\u7528
|
|
7841
7782
|
- When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Agent tool instead
|
|
7842
7783
|
- You can call multiple tools in a single response. It is always better to speculatively perform multiple searches in parallel if they are potentially useful.
|
|
7784
|
+
- This tool is for FINDING files. To SEE the directory structure tree, use the LS tool.
|
|
7843
7785
|
`;
|
|
7844
7786
|
|
|
7845
|
-
// src/tools/
|
|
7787
|
+
// src/tools/filesystem/GlobTool/GlobTool.tsx
|
|
7846
7788
|
import { existsSync as existsSync5, statSync as statSync8 } from "fs";
|
|
7847
7789
|
import { isAbsolute as isAbsolute6, join as join4, relative as relative8, resolve as resolve6 } from "path";
|
|
7848
7790
|
import { fileURLToPath } from "url";
|
|
@@ -7851,7 +7793,7 @@ var inputSchema6 = z6.strictObject({
|
|
|
7851
7793
|
path: z6.string().optional().describe(
|
|
7852
7794
|
'The directory to search in. If not specified, the current working directory will be used. IMPORTANT: Omit this field to use the default directory. DO NOT enter "undefined" or "null" - simply omit it for the default behavior. Must be a valid directory path if provided.'
|
|
7853
7795
|
),
|
|
7854
|
-
semantic: z6.boolean().
|
|
7796
|
+
semantic: z6.boolean().optional().describe(
|
|
7855
7797
|
"Enable semantic search using LSP workspace symbols to find relevant files. Useful when you know the symbol name but not the file path."
|
|
7856
7798
|
)
|
|
7857
7799
|
});
|
|
@@ -7990,33 +7932,21 @@ var TOOL_NAME_FOR_PROMPT3 = "Grep";
|
|
|
7990
7932
|
var DESCRIPTION5 = `A powerful search tool built on ripgrep
|
|
7991
7933
|
|
|
7992
7934
|
Usage:
|
|
7993
|
-
-
|
|
7935
|
+
- ALWAYS use Grep for search tasks. NEVER invoke \`grep\` or \`rg\` as a Bash command. The Grep tool has been optimized for correct permissions and access.
|
|
7994
7936
|
- Supports full regex syntax (e.g., "log.*Error", "function\\s+\\w+")
|
|
7995
7937
|
- Filter files with glob parameter (e.g., "*.js", "**/*.tsx") or type parameter (e.g., "js", "py", "rust")
|
|
7996
7938
|
- Output modes: "content" shows matching lines, "files_with_matches" shows only file paths (default), "count" shows match counts
|
|
7997
7939
|
- Use Task tool for open-ended searches requiring multiple rounds
|
|
7998
7940
|
- Pattern syntax: Uses ripgrep (not grep) - literal braces need escaping (use \`interface\\{\\}\` to find \`interface{}\` in Go code)
|
|
7999
7941
|
- Multiline matching: By default patterns match within single lines only. For cross-line patterns like \`struct \\{[\\s\\S]*?field\`, use \`multiline: true\`
|
|
8000
|
-
- Semantic search: \`semantic
|
|
8001
|
-
-
|
|
8002
|
-
- Multi-keyword single pass: for the same scope, use OR regex (e.g., \`foo|bar|baz\`) to reduce IO.
|
|
8003
|
-
- Tradeoff: parallel Grep speeds discovery but increases IO pressure on large repos.
|
|
8004
|
-
- Practical flow: map with LS, confirm with Glob, then Grep in parallel or OR regex within the scoped paths.
|
|
8005
|
-
- Common usage examples:
|
|
8006
|
-
- Keyword: \`TODO\` in TS files with context: \`pattern="TODO"\`, \`glob="**/*.ts"\`, \`output_mode="content"\`, \`-C=2\`
|
|
8007
|
-
- Regex: find function declarations: \`pattern="function\\s+\\w+"\`, \`glob="**/*.js"\`
|
|
8008
|
-
- Line numbers: errors in logs: \`pattern="error"\`, \`path="logs"\`, \`output_mode="content"\`, \`-n=true\`
|
|
8009
|
-
- Count mode: occurrences per file: \`pattern="panic"\`, \`output_mode="count"\`
|
|
8010
|
-
- Parallel examples (Batch):
|
|
8011
|
-
- \`pattern="TODO"\`, \`glob="**/*.ts"\`
|
|
8012
|
-
- \`pattern="FIXME"\`, \`glob="**/*.ts"\`
|
|
8013
|
-
- \`pattern="deprecated"\`, \`glob="**/*.ts"\`
|
|
7942
|
+
- Semantic search: Set \`semantic: true\` to use LSP workspace symbols when text search yields no results or when you explicitly need symbol-based lookup.
|
|
7943
|
+
- \u8BED\u4E49\u641C\u7D22\u4E3A\u663E\u5F0F\u89E6\u53D1\uFF1A\u53EA\u6709\u5728\u5E38\u89C4\u6A21\u5F0F\u65E0\u7ED3\u679C\u6216\u660E\u786E\u9700\u8981\u8BED\u4E49\u5B9A\u4F4D\u65F6\u518D\u542F\u7528
|
|
8014
7944
|
- STRATEGY: Use Grep as a "Scout" to *find* entry points based on text patterns.
|
|
8015
7945
|
- STEP 1: Search for a unique string (e.g., error message, URL route, specific variable name).
|
|
8016
7946
|
- STEP 2: Once you get a match (File + Line Number), STOP grepping.
|
|
8017
|
-
- STEP 3: Switch to
|
|
7947
|
+
- STEP 3: Switch to LspTool immediately. Use the line number from Grep to jump to definition or find references.
|
|
8018
7948
|
- AVOID: Do not use Grep to trace execution flow (e.g., searching for "functionName" manually). Use LSP for that.
|
|
8019
|
-
-
|
|
7949
|
+
- \u70ED\u70B9\u5B9A\u4F4D\u7B56\u7565\uFF1A\u5148\u7F29\u5C0F\u8DEF\u5F84\u8303\u56F4\uFF0C\u518D\u5206\u9875\u6216\u8FDB\u4E00\u6B65\u641C\u7D22\uFF1B\u622A\u65AD\u540E\u4F18\u5148\u805A\u7126\u70ED\u70B9\u76EE\u5F55\uFF0C\u907F\u514D\u5168\u5E93\u904D\u5386\u3002
|
|
8020
7950
|
`;
|
|
8021
7951
|
|
|
8022
7952
|
// src/tools/search/GrepTool/GrepTool.tsx
|
|
@@ -8058,7 +7988,7 @@ var inputSchema7 = z7.strictObject({
|
|
|
8058
7988
|
multiline: z7.boolean().optional().describe(
|
|
8059
7989
|
"Enable multiline mode where . matches newlines and patterns can span lines (rg -U --multiline-dotall). Default: false."
|
|
8060
7990
|
),
|
|
8061
|
-
semantic: z7.boolean().
|
|
7991
|
+
semantic: z7.boolean().optional().describe(
|
|
8062
7992
|
"Enable semantic search using LSP workspace symbols if text search fails. Useful for finding symbols even with typos."
|
|
8063
7993
|
),
|
|
8064
7994
|
symbol_type: z7.string().optional().describe(
|
|
@@ -8222,7 +8152,7 @@ ${result.filenames.join("\n")}`;
|
|
|
8222
8152
|
head_limit,
|
|
8223
8153
|
offset = 0,
|
|
8224
8154
|
multiline = false,
|
|
8225
|
-
semantic =
|
|
8155
|
+
semantic = false,
|
|
8226
8156
|
symbol_type
|
|
8227
8157
|
}, toolUseContext) {
|
|
8228
8158
|
const { abortController } = toolUseContext;
|
|
@@ -8507,7 +8437,7 @@ IMPORTANT - Use the correct year in search queries:
|
|
|
8507
8437
|
`.trim();
|
|
8508
8438
|
|
|
8509
8439
|
// src/tools/network/WebSearchTool/searchProviders.ts
|
|
8510
|
-
import { parse as
|
|
8440
|
+
import { parse as parse4 } from "node-html-parser";
|
|
8511
8441
|
var duckDuckGoSearchProvider = {
|
|
8512
8442
|
isEnabled: () => true,
|
|
8513
8443
|
search: async (query2) => {
|
|
@@ -8525,7 +8455,7 @@ var duckDuckGoSearchProvider = {
|
|
|
8525
8455
|
);
|
|
8526
8456
|
}
|
|
8527
8457
|
const html = await response.text();
|
|
8528
|
-
const root =
|
|
8458
|
+
const root = parse4(html);
|
|
8529
8459
|
const results = [];
|
|
8530
8460
|
const resultNodes = root.querySelectorAll(".result.web-result");
|
|
8531
8461
|
for (const node of resultNodes) {
|
|
@@ -9818,7 +9748,7 @@ async function clearConversation(context) {
|
|
|
9818
9748
|
await clearTerminal();
|
|
9819
9749
|
getMessagesSetter()([]);
|
|
9820
9750
|
context.setForkConvoWithMessagesOnTheNextRender([]);
|
|
9821
|
-
|
|
9751
|
+
getContext.cache.clear?.();
|
|
9822
9752
|
getCodeStyle.cache.clear?.();
|
|
9823
9753
|
await setCwd(getOriginalCwd());
|
|
9824
9754
|
resetReminderSession();
|
|
@@ -9919,7 +9849,7 @@ var compact = {
|
|
|
9919
9849
|
),
|
|
9920
9850
|
summaryResponse
|
|
9921
9851
|
]);
|
|
9922
|
-
|
|
9852
|
+
getContext.cache.clear?.();
|
|
9923
9853
|
getCodeStyle.cache.clear?.();
|
|
9924
9854
|
resetFileFreshnessSession();
|
|
9925
9855
|
resetReminderSession();
|
|
@@ -11098,7 +11028,7 @@ async function createAndStoreApiKey(accessToken) {
|
|
|
11098
11028
|
}
|
|
11099
11029
|
saveGlobalConfig(config2);
|
|
11100
11030
|
try {
|
|
11101
|
-
const { resetAnthropicClient } = await import("./llm-
|
|
11031
|
+
const { resetAnthropicClient } = await import("./llm-XG5AIU4E.js");
|
|
11102
11032
|
resetAnthropicClient();
|
|
11103
11033
|
} catch {
|
|
11104
11034
|
}
|
|
@@ -15334,10 +15264,10 @@ var mcp = {
|
|
|
15334
15264
|
var mcp_default = mcp;
|
|
15335
15265
|
|
|
15336
15266
|
// src/commands/plugin.ts
|
|
15337
|
-
import { parse as
|
|
15267
|
+
import { parse as parse6 } from "shell-quote";
|
|
15338
15268
|
var PLUGIN_SCOPES = ["user", "project", "local"];
|
|
15339
15269
|
function parseTokens(input) {
|
|
15340
|
-
const parts =
|
|
15270
|
+
const parts = parse6(input);
|
|
15341
15271
|
const out = [];
|
|
15342
15272
|
for (const part of parts) {
|
|
15343
15273
|
if (typeof part === "string") out.push(part);
|
|
@@ -15380,7 +15310,7 @@ async function refreshPluginRuntimeFromInstalls() {
|
|
|
15380
15310
|
const existingRoots = getSessionPlugins().map((p) => p.rootDir);
|
|
15381
15311
|
const dirs = Array.from(/* @__PURE__ */ new Set([...existingRoots, ...installedRoots]));
|
|
15382
15312
|
if (dirs.length === 0) return [];
|
|
15383
|
-
const { configureSessionPlugins } = await import("./pluginRuntime-
|
|
15313
|
+
const { configureSessionPlugins } = await import("./pluginRuntime-OPB7TGEW.js");
|
|
15384
15314
|
const { errors } = await configureSessionPlugins({ pluginDirs: dirs });
|
|
15385
15315
|
return errors;
|
|
15386
15316
|
}
|
|
@@ -16049,7 +15979,7 @@ async function call(onDone, context) {
|
|
|
16049
15979
|
ModelConfig,
|
|
16050
15980
|
{
|
|
16051
15981
|
onClose: () => {
|
|
16052
|
-
import("./model-
|
|
15982
|
+
import("./model-QA5R6ZTQ.js").then(({ reloadModelManager: reloadModelManager2 }) => {
|
|
16053
15983
|
reloadModelManager2();
|
|
16054
15984
|
triggerModelConfigChange();
|
|
16055
15985
|
onDone();
|
|
@@ -16177,7 +16107,16 @@ var EMPTY_STATUS = {
|
|
|
16177
16107
|
incomingCalls: [],
|
|
16178
16108
|
outgoingCalls: [],
|
|
16179
16109
|
boundary: []
|
|
16180
|
-
}
|
|
16110
|
+
},
|
|
16111
|
+
fastPath: {
|
|
16112
|
+
failuresSummary: {},
|
|
16113
|
+
lastFallback: [],
|
|
16114
|
+
healthSummary: []
|
|
16115
|
+
},
|
|
16116
|
+
metrics: [],
|
|
16117
|
+
requestMetrics: [],
|
|
16118
|
+
compareMetrics: [],
|
|
16119
|
+
tsQualityMetrics: []
|
|
16181
16120
|
};
|
|
16182
16121
|
function summarizeDiagnostics(entries) {
|
|
16183
16122
|
return entries.reduce(
|
|
@@ -16230,15 +16169,141 @@ function formatFallbackSummary(status) {
|
|
|
16230
16169
|
const countsText = activeCounts.length > 0 ? activeCounts.map(([name2, count]) => `${name2} ${count}`).join(", ") : "none";
|
|
16231
16170
|
return `Fallbacks: ${countsText}, boundary ${boundaryText}`;
|
|
16232
16171
|
}
|
|
16172
|
+
function formatFastPathFailuresSummary(status) {
|
|
16173
|
+
const summary = status.fastPath?.failuresSummary ?? {};
|
|
16174
|
+
const entries = ["exception", "empty", "timeout", "unsupported"].map((reason) => ({ reason, entry: summary[reason] })).filter((item) => item.entry && item.entry.count > 0);
|
|
16175
|
+
if (entries.length === 0) return "FastPath failures: none";
|
|
16176
|
+
const text = entries.map(({ reason, entry }) => {
|
|
16177
|
+
const lastAt = entry?.lastAt ?? null;
|
|
16178
|
+
const lastText = lastAt === null ? "last n/a" : `last ${lastAt}`;
|
|
16179
|
+
return `${reason} ${entry?.count ?? 0} (${lastText})`;
|
|
16180
|
+
}).join(", ");
|
|
16181
|
+
return `FastPath failures: ${text}`;
|
|
16182
|
+
}
|
|
16183
|
+
function formatFastPathLastFallbackEntries(status) {
|
|
16184
|
+
const entries = status.fastPath?.lastFallback ?? [];
|
|
16185
|
+
const sorted = [...entries].sort((a, b) => b.at - a.at).slice(0, 10);
|
|
16186
|
+
return sorted.map((entry) => ({
|
|
16187
|
+
key: `${entry.filePath}:${entry.reason}:${entry.at}`,
|
|
16188
|
+
line: `${entry.filePath} ${entry.reason} ${entry.at}`
|
|
16189
|
+
}));
|
|
16190
|
+
}
|
|
16191
|
+
function formatFastPathHealthEntries(status) {
|
|
16192
|
+
const entries = status.fastPath?.healthSummary ?? [];
|
|
16193
|
+
const sorted = [...entries].sort((a, b) => {
|
|
16194
|
+
const aLast = Math.max(a.lastSuccessAt ?? 0, a.lastFailureAt ?? 0);
|
|
16195
|
+
const bLast = Math.max(b.lastSuccessAt ?? 0, b.lastFailureAt ?? 0);
|
|
16196
|
+
return bLast - aLast;
|
|
16197
|
+
}).slice(0, 10);
|
|
16198
|
+
return sorted.map((entry) => {
|
|
16199
|
+
const lastSuccess = entry.lastSuccessAt ?? "n/a";
|
|
16200
|
+
const lastFailure = entry.lastFailureAt ?? "n/a";
|
|
16201
|
+
const avgDuration = entry.avgDurationMs === null ? "n/a" : `${Math.round(entry.avgDurationMs)}ms`;
|
|
16202
|
+
const downgrade = entry.downgradeUntil === null ? "n/a" : entry.downgradeUntil;
|
|
16203
|
+
return {
|
|
16204
|
+
key: `${entry.filePath}:${lastSuccess}:${lastFailure}:${downgrade}`,
|
|
16205
|
+
line: `${entry.filePath} success ${entry.successCount} failure ${entry.failureCount} timeout ${entry.timeoutCount} lastSuccess ${lastSuccess} lastFailure ${lastFailure} avg ${avgDuration} downgradeUntil ${downgrade}`
|
|
16206
|
+
};
|
|
16207
|
+
});
|
|
16208
|
+
}
|
|
16209
|
+
function formatMetricsSummary(status) {
|
|
16210
|
+
const spawnCount = status.metrics?.length ?? 0;
|
|
16211
|
+
const requestCount = status.requestMetrics?.length ?? 0;
|
|
16212
|
+
if (spawnCount === 0 && requestCount === 0) return "Metrics: none";
|
|
16213
|
+
const window = status.sampleWindow;
|
|
16214
|
+
const windowText = window && Number.isFinite(window.latencySamples) && Number.isFinite(window.baselineSamples) ? ` window latency ${window.latencySamples} baseline ${window.baselineSamples}` : "";
|
|
16215
|
+
return `Metrics: spawn ${spawnCount}, request ${requestCount}${windowText}`;
|
|
16216
|
+
}
|
|
16217
|
+
function formatCompareMetricsSummary(status) {
|
|
16218
|
+
const entries = status.compareMetrics ?? [];
|
|
16219
|
+
if (entries.length === 0) return "AST/LSP consistency: none";
|
|
16220
|
+
const totalSamples = entries.reduce((acc, entry) => acc + (entry.samples ?? 0), 0);
|
|
16221
|
+
return `AST/LSP consistency: ${entries.length} languages, ${totalSamples} samples`;
|
|
16222
|
+
}
|
|
16223
|
+
function formatCompareMetricEntries(status) {
|
|
16224
|
+
const entries = status.compareMetrics ?? [];
|
|
16225
|
+
const sorted = [...entries].sort((a, b) => (b.samples ?? 0) - (a.samples ?? 0));
|
|
16226
|
+
return sorted.slice(0, 10).map((entry) => {
|
|
16227
|
+
const missingRate = Math.round((entry.missingRateAvg ?? 0) * 1e3) / 10;
|
|
16228
|
+
const extraRate = Math.round((entry.extraRateAvg ?? 0) * 1e3) / 10;
|
|
16229
|
+
return {
|
|
16230
|
+
key: `${entry.language}:${entry.samples}:${entry.lastSampleAt ?? "n/a"}`,
|
|
16231
|
+
line: `${entry.language} samples ${entry.samples} missing ${missingRate}% extra ${extraRate}% avgTraversal ${Math.round(entry.traversalAvg ?? 0)} avgQuery ${Math.round(entry.queryAvg ?? 0)}`
|
|
16232
|
+
};
|
|
16233
|
+
});
|
|
16234
|
+
}
|
|
16235
|
+
function formatQualityMetricsSummary(status) {
|
|
16236
|
+
const entries = status.tsQualityMetrics ?? [];
|
|
16237
|
+
if (entries.length === 0) return "Tree-Sitter quality: none";
|
|
16238
|
+
const totalSamples = entries.reduce((acc, entry) => acc + (entry.samples ?? 0), 0);
|
|
16239
|
+
return `Tree-Sitter quality: ${entries.length} languages, ${totalSamples} samples`;
|
|
16240
|
+
}
|
|
16241
|
+
function formatQualityMetricEntries(status) {
|
|
16242
|
+
const entries = status.tsQualityMetrics ?? [];
|
|
16243
|
+
const sorted = [...entries].sort((a, b) => (b.samples ?? 0) - (a.samples ?? 0));
|
|
16244
|
+
return sorted.slice(0, 10).map((entry) => {
|
|
16245
|
+
const successRate = Math.round((entry.successRate ?? 0) * 1e3) / 10;
|
|
16246
|
+
const emptyRate = Math.round((entry.emptyRate ?? 0) * 1e3) / 10;
|
|
16247
|
+
const coverage = Math.round((entry.coverageAvg ?? 0) * 1e3) / 10;
|
|
16248
|
+
return {
|
|
16249
|
+
key: `${entry.language}:${entry.samples}:${entry.lastSampleAt ?? "n/a"}`,
|
|
16250
|
+
line: `${entry.language} samples ${entry.samples} success ${successRate}% empty ${emptyRate}% coverage ${coverage}% avgTraversal ${Math.round(entry.traversalAvg ?? 0)} avgQuery ${Math.round(entry.queryAvg ?? 0)}`
|
|
16251
|
+
};
|
|
16252
|
+
});
|
|
16253
|
+
}
|
|
16254
|
+
function formatParseCacheSummary(status) {
|
|
16255
|
+
const cache = status.parseCache;
|
|
16256
|
+
if (!cache) return "Parse cache: none";
|
|
16257
|
+
return `Parse cache: incremental h${cache.incremental.hits}/m${cache.incremental.misses} size ${cache.incremental.size}, full h${cache.full.hits}/m${cache.full.misses} size ${cache.full.size}, fallback ${cache.fallbackCount}`;
|
|
16258
|
+
}
|
|
16259
|
+
function formatSpawnMetricEntries(status) {
|
|
16260
|
+
const entries = status.metrics ?? [];
|
|
16261
|
+
return entries.slice(0, 10).map((entry) => {
|
|
16262
|
+
const successRate = Math.round((entry.successRate ?? 0) * 100);
|
|
16263
|
+
const p95 = Math.round(entry.latencyP95Ms ?? 0);
|
|
16264
|
+
return {
|
|
16265
|
+
key: `${entry.server}:${entry.attempts}:${entry.successes}:${p95}`,
|
|
16266
|
+
line: `${entry.server} success ${successRate}% p95 ${p95}ms`
|
|
16267
|
+
};
|
|
16268
|
+
});
|
|
16269
|
+
}
|
|
16270
|
+
function formatRequestMetricEntries(status) {
|
|
16271
|
+
const entries = status.requestMetrics ?? [];
|
|
16272
|
+
const sorted = [...entries].sort((a, b) => {
|
|
16273
|
+
if (a.regression === b.regression) {
|
|
16274
|
+
return (b.latencyP95Ms ?? 0) - (a.latencyP95Ms ?? 0);
|
|
16275
|
+
}
|
|
16276
|
+
return a.regression ? -1 : 1;
|
|
16277
|
+
});
|
|
16278
|
+
return sorted.slice(0, 10).map((entry) => {
|
|
16279
|
+
const successRate = Math.round((entry.successRate ?? 0) * 100);
|
|
16280
|
+
const p95 = Math.round(entry.latencyP95Ms ?? 0);
|
|
16281
|
+
const regression = entry.regression ? "regression" : "ok";
|
|
16282
|
+
const baseline = entry.baselineSamples > 0 ? ` baseline ${entry.baselineSamples}` : "";
|
|
16283
|
+
return {
|
|
16284
|
+
key: `${entry.server}:${entry.operation}:${p95}:${entry.baselineSamples}`,
|
|
16285
|
+
line: `${entry.operation} ${entry.server} success ${successRate}% p95 ${p95}ms ${regression}${baseline}`
|
|
16286
|
+
};
|
|
16287
|
+
});
|
|
16288
|
+
}
|
|
16233
16289
|
function normalizeStatus(status) {
|
|
16234
16290
|
if (!status) return EMPTY_STATUS;
|
|
16235
16291
|
const raw = status;
|
|
16236
16292
|
const fallbacks = typeof raw.fallbacks === "object" && raw.fallbacks ? raw.fallbacks : void 0;
|
|
16293
|
+
const fastPath = typeof raw.fastPath === "object" && raw.fastPath ? raw.fastPath : void 0;
|
|
16294
|
+
const sampleWindow = typeof raw.sampleWindow === "object" && raw.sampleWindow ? raw.sampleWindow : void 0;
|
|
16237
16295
|
return {
|
|
16238
16296
|
clients: Array.isArray(raw.clients) ? raw.clients : [],
|
|
16239
16297
|
spawning: Array.isArray(raw.spawning) ? raw.spawning : [],
|
|
16240
16298
|
broken: Array.isArray(raw.broken) ? raw.broken : [],
|
|
16241
16299
|
diagnostics: Array.isArray(raw.diagnostics) ? raw.diagnostics : [],
|
|
16300
|
+
schemaVersion: typeof raw.schemaVersion === "number" ? raw.schemaVersion : void 0,
|
|
16301
|
+
sampleWindow,
|
|
16302
|
+
metrics: Array.isArray(raw.metrics) ? raw.metrics : [],
|
|
16303
|
+
requestMetrics: Array.isArray(raw.requestMetrics) ? raw.requestMetrics : [],
|
|
16304
|
+
compareMetrics: Array.isArray(raw.compareMetrics) ? raw.compareMetrics : [],
|
|
16305
|
+
tsQualityMetrics: Array.isArray(raw.tsQualityMetrics) ? raw.tsQualityMetrics : [],
|
|
16306
|
+
parseCache: typeof raw.parseCache === "object" && raw.parseCache ? raw.parseCache : void 0,
|
|
16242
16307
|
fallbacks: {
|
|
16243
16308
|
documentSymbol: Array.isArray(fallbacks?.documentSymbol) ? fallbacks.documentSymbol : [],
|
|
16244
16309
|
getScope: Array.isArray(fallbacks?.getScope) ? fallbacks.getScope : [],
|
|
@@ -16248,6 +16313,11 @@ function normalizeStatus(status) {
|
|
|
16248
16313
|
incomingCalls: Array.isArray(fallbacks?.incomingCalls) ? fallbacks.incomingCalls : [],
|
|
16249
16314
|
outgoingCalls: Array.isArray(fallbacks?.outgoingCalls) ? fallbacks.outgoingCalls : [],
|
|
16250
16315
|
boundary: Array.isArray(fallbacks?.boundary) ? fallbacks.boundary : []
|
|
16316
|
+
},
|
|
16317
|
+
fastPath: {
|
|
16318
|
+
failuresSummary: fastPath && typeof fastPath.failuresSummary === "object" && fastPath.failuresSummary ? fastPath.failuresSummary : {},
|
|
16319
|
+
lastFallback: Array.isArray(fastPath?.lastFallback) ? fastPath.lastFallback : [],
|
|
16320
|
+
healthSummary: Array.isArray(fastPath?.healthSummary) ? fastPath.healthSummary : []
|
|
16251
16321
|
}
|
|
16252
16322
|
};
|
|
16253
16323
|
}
|
|
@@ -16288,6 +16358,16 @@ function LspStatusDisplay({
|
|
|
16288
16358
|
).sort();
|
|
16289
16359
|
const allDiagnostics = Array.from(diagnosticsByClient.values()).flat();
|
|
16290
16360
|
const globalTotals = summarizeDiagnostics(allDiagnostics);
|
|
16361
|
+
const fastPathEntries = formatFastPathLastFallbackEntries(normalized);
|
|
16362
|
+
const fastPathHealthEntries = formatFastPathHealthEntries(normalized);
|
|
16363
|
+
const metricsSummary = formatMetricsSummary(normalized);
|
|
16364
|
+
const compareSummary = formatCompareMetricsSummary(normalized);
|
|
16365
|
+
const qualitySummary = formatQualityMetricsSummary(normalized);
|
|
16366
|
+
const parseCacheSummary = formatParseCacheSummary(normalized);
|
|
16367
|
+
const spawnMetricEntries = formatSpawnMetricEntries(normalized);
|
|
16368
|
+
const requestMetricEntries = formatRequestMetricEntries(normalized);
|
|
16369
|
+
const compareMetricEntries = formatCompareMetricEntries(normalized);
|
|
16370
|
+
const qualityMetricEntries = formatQualityMetricEntries(normalized);
|
|
16291
16371
|
return /* @__PURE__ */ React45.createElement(
|
|
16292
16372
|
Box35,
|
|
16293
16373
|
{
|
|
@@ -16302,6 +16382,17 @@ function LspStatusDisplay({
|
|
|
16302
16382
|
/* @__PURE__ */ React45.createElement(Text39, null, "Clients: ", normalized.clients.length, " connected,", " ", normalized.spawning.length, " spawning, ", normalized.broken.length, " broken"),
|
|
16303
16383
|
/* @__PURE__ */ React45.createElement(Text39, { color: theme.secondaryText }, formatDiagnosticsSummary(globalTotals)),
|
|
16304
16384
|
/* @__PURE__ */ React45.createElement(Text39, { color: theme.secondaryText }, formatFallbackSummary(normalized)),
|
|
16385
|
+
/* @__PURE__ */ React45.createElement(Text39, { color: theme.secondaryText }, formatFastPathFailuresSummary(normalized)),
|
|
16386
|
+
/* @__PURE__ */ React45.createElement(Text39, { color: theme.secondaryText }, metricsSummary),
|
|
16387
|
+
/* @__PURE__ */ React45.createElement(Text39, { color: theme.secondaryText }, compareSummary),
|
|
16388
|
+
/* @__PURE__ */ React45.createElement(Text39, { color: theme.secondaryText }, qualitySummary),
|
|
16389
|
+
/* @__PURE__ */ React45.createElement(Text39, { color: theme.secondaryText }, parseCacheSummary),
|
|
16390
|
+
fastPathEntries.length > 0 ? /* @__PURE__ */ React45.createElement(Box35, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React45.createElement(Text39, { color: theme.secondaryText }, "FastPath last fallback:"), fastPathEntries.map((entry) => /* @__PURE__ */ React45.createElement(Box35, { key: entry.key }, /* @__PURE__ */ React45.createElement(Text39, { color: theme.secondaryText }, entry.line)))) : null,
|
|
16391
|
+
spawnMetricEntries.length > 0 ? /* @__PURE__ */ React45.createElement(Box35, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React45.createElement(Text39, { color: theme.secondaryText }, "Spawn metrics:"), spawnMetricEntries.map((entry) => /* @__PURE__ */ React45.createElement(Box35, { key: entry.key }, /* @__PURE__ */ React45.createElement(Text39, { color: theme.secondaryText }, entry.line)))) : null,
|
|
16392
|
+
requestMetricEntries.length > 0 ? /* @__PURE__ */ React45.createElement(Box35, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React45.createElement(Text39, { color: theme.secondaryText }, "Request metrics:"), requestMetricEntries.map((entry) => /* @__PURE__ */ React45.createElement(Box35, { key: entry.key }, /* @__PURE__ */ React45.createElement(Text39, { color: theme.secondaryText }, entry.line)))) : null,
|
|
16393
|
+
compareMetricEntries.length > 0 ? /* @__PURE__ */ React45.createElement(Box35, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React45.createElement(Text39, { color: theme.secondaryText }, "AST/LSP consistency:"), compareMetricEntries.map((entry) => /* @__PURE__ */ React45.createElement(Box35, { key: entry.key }, /* @__PURE__ */ React45.createElement(Text39, { color: theme.secondaryText }, entry.line)))) : null,
|
|
16394
|
+
qualityMetricEntries.length > 0 ? /* @__PURE__ */ React45.createElement(Box35, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React45.createElement(Text39, { color: theme.secondaryText }, "Tree-Sitter quality:"), qualityMetricEntries.map((entry) => /* @__PURE__ */ React45.createElement(Box35, { key: entry.key }, /* @__PURE__ */ React45.createElement(Text39, { color: theme.secondaryText }, entry.line)))) : null,
|
|
16395
|
+
fastPathHealthEntries.length > 0 ? /* @__PURE__ */ React45.createElement(Box35, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React45.createElement(Text39, { color: theme.secondaryText }, "FastPath health summary:"), fastPathHealthEntries.map((entry) => /* @__PURE__ */ React45.createElement(Box35, { key: entry.key }, /* @__PURE__ */ React45.createElement(Text39, { color: theme.secondaryText }, entry.line)))) : null,
|
|
16305
16396
|
/* @__PURE__ */ React45.createElement(Text39, null, " "),
|
|
16306
16397
|
clientNames.length === 0 ? /* @__PURE__ */ React45.createElement(Text39, { color: theme.secondaryText }, "No LSP clients initialized") : /* @__PURE__ */ React45.createElement(Box35, { flexDirection: "column" }, clientNames.map((clientName) => {
|
|
16307
16398
|
const state = getClientState(clientName, normalized);
|
|
@@ -23493,7 +23584,7 @@ function useStatusLine() {
|
|
|
23493
23584
|
// src/ui/components/PromptInput.tsx
|
|
23494
23585
|
async function interpretHashCommand(input) {
|
|
23495
23586
|
try {
|
|
23496
|
-
const { queryQuick: queryQuick2 } = await import("./llm-
|
|
23587
|
+
const { queryQuick: queryQuick2 } = await import("./llm-XG5AIU4E.js");
|
|
23497
23588
|
const systemPrompt = [
|
|
23498
23589
|
"You're helping the user structure notes that will be added to their PYB.md file.",
|
|
23499
23590
|
"Format the user's input into a well-structured note that will be useful for later reference.",
|
|
@@ -23806,7 +23897,7 @@ function PromptInput({
|
|
|
23806
23897
|
if (messages2.length) {
|
|
23807
23898
|
if (mode === "bash") {
|
|
23808
23899
|
onQuery(messages2, newAbortController).then(async () => {
|
|
23809
|
-
const { getCwd: getCwd2 } = await import("./state-
|
|
23900
|
+
const { getCwd: getCwd2 } = await import("./state-BVQ44522.js");
|
|
23810
23901
|
setCurrentPwd(getCwd2());
|
|
23811
23902
|
});
|
|
23812
23903
|
} else {
|
|
@@ -24358,6 +24449,7 @@ async function logBinaryFeedbackEvent(_m1, _m2, _choice) {
|
|
|
24358
24449
|
var PybContextManager = class _PybContextManager {
|
|
24359
24450
|
static instance;
|
|
24360
24451
|
projectDocsCache = "";
|
|
24452
|
+
projectStructureStatsCache = "";
|
|
24361
24453
|
cacheInitialized = false;
|
|
24362
24454
|
initPromise = null;
|
|
24363
24455
|
static getInstance() {
|
|
@@ -24370,8 +24462,12 @@ var PybContextManager = class _PybContextManager {
|
|
|
24370
24462
|
if (this.initPromise) return this.initPromise;
|
|
24371
24463
|
this.initPromise = (async () => {
|
|
24372
24464
|
try {
|
|
24373
|
-
const [projectDocs] = await Promise.all([
|
|
24465
|
+
const [projectDocs, statsBlock] = await Promise.all([
|
|
24466
|
+
getProjectDocs(),
|
|
24467
|
+
getProjectStructureStatisticsBlock()
|
|
24468
|
+
]);
|
|
24374
24469
|
this.projectDocsCache = projectDocs || "";
|
|
24470
|
+
this.projectStructureStatsCache = statsBlock;
|
|
24375
24471
|
this.cacheInitialized = true;
|
|
24376
24472
|
} catch (error) {
|
|
24377
24473
|
logError(error);
|
|
@@ -24379,6 +24475,7 @@ var PybContextManager = class _PybContextManager {
|
|
|
24379
24475
|
error: error instanceof Error ? error.message : String(error)
|
|
24380
24476
|
});
|
|
24381
24477
|
this.projectDocsCache = "";
|
|
24478
|
+
this.projectStructureStatsCache = "";
|
|
24382
24479
|
this.cacheInitialized = true;
|
|
24383
24480
|
}
|
|
24384
24481
|
})();
|
|
@@ -24395,7 +24492,8 @@ var PybContextManager = class _PybContextManager {
|
|
|
24395
24492
|
return "";
|
|
24396
24493
|
}
|
|
24397
24494
|
const context = [
|
|
24398
|
-
this.projectDocsCache
|
|
24495
|
+
this.projectDocsCache,
|
|
24496
|
+
this.projectStructureStatsCache
|
|
24399
24497
|
].filter(Boolean).join("\n\n");
|
|
24400
24498
|
return context;
|
|
24401
24499
|
}
|
|
@@ -24662,7 +24760,7 @@ ${contentWithLines}
|
|
|
24662
24760
|
}
|
|
24663
24761
|
}
|
|
24664
24762
|
getMessagesSetter()([]);
|
|
24665
|
-
|
|
24763
|
+
getContext.cache.clear?.();
|
|
24666
24764
|
getCodeStyle.cache.clear?.();
|
|
24667
24765
|
resetFileFreshnessSession();
|
|
24668
24766
|
return compactedMessages;
|
|
@@ -24673,218 +24771,26 @@ function isToolUseLikeBlock(block) {
|
|
|
24673
24771
|
return block && typeof block === "object" && (block.type === "tool_use" || block.type === "server_tool_use" || block.type === "mcp_tool_use");
|
|
24674
24772
|
}
|
|
24675
24773
|
var __isToolUseLikeBlockForTests = isToolUseLikeBlock;
|
|
24676
|
-
function
|
|
24677
|
-
|
|
24678
|
-
}
|
|
24679
|
-
function isMcpToolName(name2) {
|
|
24680
|
-
const trimmed = name2.trim();
|
|
24681
|
-
return trimmed === "mcp" || trimmed.startsWith("mcp__");
|
|
24682
|
-
}
|
|
24683
|
-
function isMarketplaceToolName(name2) {
|
|
24684
|
-
return name2.trim().startsWith("marketplace__");
|
|
24685
|
-
}
|
|
24686
|
-
function isSkillToolName(name2) {
|
|
24687
|
-
return name2.trim() === "Skill";
|
|
24688
|
-
}
|
|
24689
|
-
function normalizeToolCallParameters(input) {
|
|
24690
|
-
if (input && typeof input === "object" && !Array.isArray(input)) {
|
|
24691
|
-
return input;
|
|
24692
|
-
}
|
|
24693
|
-
return {};
|
|
24694
|
-
}
|
|
24695
|
-
function createAutoBatchToolUse(toolUses, batchIndex) {
|
|
24696
|
-
const seed = toolUses[0]?.id || "auto";
|
|
24697
|
-
return {
|
|
24698
|
-
type: "tool_use",
|
|
24699
|
-
id: `batch_auto_${seed}_${batchIndex + 1}`,
|
|
24700
|
-
name: "Batch",
|
|
24701
|
-
input: {
|
|
24702
|
-
tool_calls: toolUses.map((toolUse) => ({
|
|
24703
|
-
tool: resolveToolNameAlias(toolUse.name).resolvedName,
|
|
24704
|
-
parameters: normalizeToolCallParameters(toolUse.input)
|
|
24705
|
-
}))
|
|
24706
|
-
}
|
|
24707
|
-
};
|
|
24708
|
-
}
|
|
24709
|
-
function isAutoBatchToolUse(toolUse) {
|
|
24710
|
-
const resolvedName = resolveToolNameAlias(toolUse.name).resolvedName;
|
|
24711
|
-
return isBatchToolName(resolvedName) && typeof toolUse.id === "string" && toolUse.id.startsWith("batch_auto_");
|
|
24712
|
-
}
|
|
24713
|
-
function getAutoBatchAggregationSummary(toolUseMessages, tools, output, enabled) {
|
|
24714
|
-
const inputCount = toolUseMessages.length;
|
|
24715
|
-
const eligibleCount = toolUseMessages.reduce(
|
|
24716
|
-
(count, toolUse) => count + (canAutoBatchToolUse(toolUse, tools) ? 1 : 0),
|
|
24717
|
-
0
|
|
24718
|
-
);
|
|
24719
|
-
const ineligibleCount = inputCount - eligibleCount;
|
|
24720
|
-
const autoBatchToolUses = output.filter(isAutoBatchToolUse);
|
|
24721
|
-
const autoBatchedToolCount = autoBatchToolUses.reduce((sum, toolUse) => {
|
|
24722
|
-
const input = toolUse.input;
|
|
24723
|
-
const toolCalls = Array.isArray(input?.tool_calls) ? input.tool_calls : [];
|
|
24724
|
-
return sum + toolCalls.length;
|
|
24725
|
-
}, 0);
|
|
24726
|
-
return {
|
|
24727
|
-
enabled,
|
|
24728
|
-
inputCount,
|
|
24729
|
-
eligibleCount,
|
|
24730
|
-
ineligibleCount,
|
|
24731
|
-
outputCount: output.length,
|
|
24732
|
-
autoBatchCount: autoBatchToolUses.length,
|
|
24733
|
-
autoBatchedToolCount
|
|
24734
|
-
};
|
|
24735
|
-
}
|
|
24736
|
-
function canAutoBatchToolUse(toolUse, tools) {
|
|
24737
|
-
const resolvedName = resolveToolNameAlias(toolUse.name).resolvedName;
|
|
24738
|
-
if (isBatchToolName(resolvedName) || isMcpToolName(resolvedName) || isMarketplaceToolName(resolvedName) || isSkillToolName(resolvedName)) {
|
|
24739
|
-
return false;
|
|
24740
|
-
}
|
|
24741
|
-
const tool = tools.find((t) => t.name === resolvedName);
|
|
24742
|
-
if (!tool) return false;
|
|
24743
|
-
const parsed = tool.inputSchema.safeParse(
|
|
24744
|
-
normalizeToolCallParameters(toolUse.input)
|
|
24745
|
-
);
|
|
24746
|
-
if (!parsed.success) return false;
|
|
24747
|
-
return tool.isReadOnly(parsed.data) && tool.isConcurrencySafe(parsed.data);
|
|
24748
|
-
}
|
|
24749
|
-
function autoBatchToolUseBlocks(toolUseMessages, tools) {
|
|
24750
|
-
if (toolUseMessages.length < 2) return toolUseMessages;
|
|
24751
|
-
const resolvedNames = toolUseMessages.map(
|
|
24752
|
-
(toolUse) => resolveToolNameAlias(toolUse.name).resolvedName
|
|
24753
|
-
);
|
|
24754
|
-
if (resolvedNames.some(isBatchToolName)) return toolUseMessages;
|
|
24755
|
-
const normalizedToolUses = toolUseMessages.map((toolUse, index) => ({
|
|
24756
|
-
...toolUse,
|
|
24757
|
-
name: resolvedNames[index]
|
|
24758
|
-
}));
|
|
24759
|
-
const output = [];
|
|
24760
|
-
let batchIndex = 0;
|
|
24761
|
-
let buffer = [];
|
|
24762
|
-
const flushBuffer = () => {
|
|
24763
|
-
if (buffer.length === 0) return;
|
|
24764
|
-
if (buffer.length === 1) {
|
|
24765
|
-
output.push(buffer[0]);
|
|
24766
|
-
buffer = [];
|
|
24767
|
-
return;
|
|
24768
|
-
}
|
|
24769
|
-
for (let i = 0; i < buffer.length; i += 10) {
|
|
24770
|
-
const chunk = buffer.slice(i, i + 10);
|
|
24771
|
-
output.push(createAutoBatchToolUse(chunk, batchIndex));
|
|
24772
|
-
batchIndex += 1;
|
|
24773
|
-
}
|
|
24774
|
-
buffer = [];
|
|
24775
|
-
};
|
|
24776
|
-
for (const toolUse of normalizedToolUses) {
|
|
24777
|
-
if (canAutoBatchToolUse(toolUse, tools)) {
|
|
24778
|
-
buffer.push(toolUse);
|
|
24779
|
-
continue;
|
|
24780
|
-
}
|
|
24781
|
-
flushBuffer();
|
|
24782
|
-
output.push(toolUse);
|
|
24783
|
-
}
|
|
24784
|
-
flushBuffer();
|
|
24785
|
-
return output;
|
|
24786
|
-
}
|
|
24787
|
-
var __autoBatchToolUseBlocksForTests = autoBatchToolUseBlocks;
|
|
24788
|
-
function shouldAutoBatchAggregation() {
|
|
24789
|
-
const config2 = getCurrentProjectConfig();
|
|
24790
|
-
const enabled = config2.experimental?.auto_batch_aggregation;
|
|
24791
|
-
return enabled !== false;
|
|
24792
|
-
}
|
|
24793
|
-
function applyAutoBatchAggregation(toolUseMessages, tools, options) {
|
|
24794
|
-
const enabled = shouldAutoBatchAggregation();
|
|
24795
|
-
const requestId = getCurrentRequest()?.id;
|
|
24796
|
-
if (!enabled) {
|
|
24797
|
-
const summary = getAutoBatchAggregationSummary(
|
|
24798
|
-
toolUseMessages,
|
|
24799
|
-
tools,
|
|
24800
|
-
toolUseMessages,
|
|
24801
|
-
false
|
|
24802
|
-
);
|
|
24803
|
-
debug.flow(
|
|
24804
|
-
"AUTO_BATCH_AGGREGATION",
|
|
24805
|
-
{
|
|
24806
|
-
...summary,
|
|
24807
|
-
reason: "disabled"
|
|
24808
|
-
},
|
|
24809
|
-
requestId
|
|
24810
|
-
);
|
|
24811
|
-
return toolUseMessages;
|
|
24812
|
-
}
|
|
24813
|
-
try {
|
|
24814
|
-
if (options?.forceThrow) {
|
|
24815
|
-
throw new Error("forced auto batch failure");
|
|
24816
|
-
}
|
|
24817
|
-
const aggregated = autoBatchToolUseBlocks(toolUseMessages, tools);
|
|
24818
|
-
const summary = getAutoBatchAggregationSummary(
|
|
24819
|
-
toolUseMessages,
|
|
24820
|
-
tools,
|
|
24821
|
-
aggregated,
|
|
24822
|
-
true
|
|
24823
|
-
);
|
|
24824
|
-
debug.flow("AUTO_BATCH_AGGREGATION", summary, requestId);
|
|
24825
|
-
return aggregated;
|
|
24826
|
-
} catch (error) {
|
|
24827
|
-
const summary = getAutoBatchAggregationSummary(
|
|
24828
|
-
toolUseMessages,
|
|
24829
|
-
tools,
|
|
24830
|
-
toolUseMessages,
|
|
24831
|
-
true
|
|
24832
|
-
);
|
|
24833
|
-
debug.flow(
|
|
24834
|
-
"AUTO_BATCH_AGGREGATION_FALLBACK",
|
|
24835
|
-
{
|
|
24836
|
-
...summary,
|
|
24837
|
-
error: error instanceof Error ? error.message : String(error)
|
|
24838
|
-
},
|
|
24839
|
-
requestId
|
|
24840
|
-
);
|
|
24841
|
-
if (!options?.forceThrow) {
|
|
24842
|
-
logError(error);
|
|
24843
|
-
}
|
|
24844
|
-
return toolUseMessages;
|
|
24845
|
-
}
|
|
24846
|
-
}
|
|
24847
|
-
var __applyAutoBatchAggregationForTests = applyAutoBatchAggregation;
|
|
24848
|
-
function rewriteToolUseBlocksInAssistantMessage(assistantMessage, toolUseMessages) {
|
|
24849
|
-
if (!Array.isArray(assistantMessage.message.content)) return assistantMessage;
|
|
24850
|
-
let nextToolUseIndex = 0;
|
|
24851
|
-
const rewritten = assistantMessage.message.content.flatMap((block) => {
|
|
24852
|
-
if (!isToolUseLikeBlock(block)) return [block];
|
|
24853
|
-
const next = toolUseMessages[nextToolUseIndex];
|
|
24854
|
-
if (!next) return [];
|
|
24855
|
-
nextToolUseIndex += 1;
|
|
24856
|
-
return [next];
|
|
24857
|
-
});
|
|
24858
|
-
for (let i = nextToolUseIndex; i < toolUseMessages.length; i += 1) {
|
|
24859
|
-
rewritten.push(toolUseMessages[i]);
|
|
24860
|
-
}
|
|
24861
|
-
return {
|
|
24862
|
-
...assistantMessage,
|
|
24863
|
-
message: {
|
|
24864
|
-
...assistantMessage.message,
|
|
24865
|
-
content: rewritten
|
|
24866
|
-
}
|
|
24867
|
-
};
|
|
24868
|
-
}
|
|
24869
|
-
var __rewriteToolUseBlocksForTests = rewriteToolUseBlocksInAssistantMessage;
|
|
24870
|
-
function createSyntheticToolUseErrorMessage(toolUseId, reason) {
|
|
24774
|
+
function createSyntheticToolUseErrorMessage(args) {
|
|
24775
|
+
const { toolUseId, reason, rootToolUseId } = args;
|
|
24871
24776
|
if (reason === "user_interrupted") {
|
|
24872
24777
|
return createUserMessage([
|
|
24873
|
-
{
|
|
24874
|
-
|
|
24778
|
+
createErrorToolResultBlock({
|
|
24779
|
+
toolUseId,
|
|
24875
24780
|
content: REJECT_MESSAGE,
|
|
24876
|
-
|
|
24877
|
-
|
|
24878
|
-
}
|
|
24781
|
+
errorCode: "USER_INTERRUPTED",
|
|
24782
|
+
errorClass: "fatal"
|
|
24783
|
+
})
|
|
24879
24784
|
]);
|
|
24880
24785
|
}
|
|
24881
24786
|
return createUserMessage([
|
|
24882
|
-
{
|
|
24883
|
-
|
|
24787
|
+
createErrorToolResultBlock({
|
|
24788
|
+
toolUseId,
|
|
24884
24789
|
content: "<tool_use_error>Sibling tool call errored</tool_use_error>",
|
|
24885
|
-
|
|
24886
|
-
|
|
24887
|
-
|
|
24790
|
+
errorCode: "SIBLING_ERROR",
|
|
24791
|
+
errorClass: "fatal",
|
|
24792
|
+
rootToolUseId
|
|
24793
|
+
})
|
|
24888
24794
|
]);
|
|
24889
24795
|
}
|
|
24890
24796
|
var ToolUseQueue = class {
|
|
@@ -24892,7 +24798,8 @@ var ToolUseQueue = class {
|
|
|
24892
24798
|
canUseTool;
|
|
24893
24799
|
tools = [];
|
|
24894
24800
|
toolUseContext;
|
|
24895
|
-
|
|
24801
|
+
hasFatalErrored = false;
|
|
24802
|
+
fatalToolUseId;
|
|
24896
24803
|
progressAvailableResolve;
|
|
24897
24804
|
siblingToolUseIDs;
|
|
24898
24805
|
shouldSkipPermissionCheck;
|
|
@@ -24954,7 +24861,7 @@ var ToolUseQueue = class {
|
|
|
24954
24861
|
}
|
|
24955
24862
|
}
|
|
24956
24863
|
getAbortReason() {
|
|
24957
|
-
if (this.
|
|
24864
|
+
if (this.hasFatalErrored) return "sibling_error";
|
|
24958
24865
|
if (this.toolUseContext.abortController.signal.aborted)
|
|
24959
24866
|
return "user_interrupted";
|
|
24960
24867
|
return null;
|
|
@@ -24966,7 +24873,13 @@ var ToolUseQueue = class {
|
|
|
24966
24873
|
const promise = (async () => {
|
|
24967
24874
|
const abortReason = this.getAbortReason();
|
|
24968
24875
|
if (abortReason) {
|
|
24969
|
-
results.push(
|
|
24876
|
+
results.push(
|
|
24877
|
+
createSyntheticToolUseErrorMessage({
|
|
24878
|
+
toolUseId: entry.id,
|
|
24879
|
+
reason: abortReason,
|
|
24880
|
+
rootToolUseId: this.fatalToolUseId
|
|
24881
|
+
})
|
|
24882
|
+
);
|
|
24970
24883
|
entry.results = results;
|
|
24971
24884
|
entry.contextModifiers = contextModifiers;
|
|
24972
24885
|
entry.status = "completed";
|
|
@@ -24984,13 +24897,32 @@ var ToolUseQueue = class {
|
|
|
24984
24897
|
for await (const message of generator) {
|
|
24985
24898
|
const reason = this.getAbortReason();
|
|
24986
24899
|
if (reason && !toolErrored) {
|
|
24987
|
-
results.push(
|
|
24900
|
+
results.push(
|
|
24901
|
+
createSyntheticToolUseErrorMessage({
|
|
24902
|
+
toolUseId: entry.id,
|
|
24903
|
+
reason,
|
|
24904
|
+
rootToolUseId: this.fatalToolUseId
|
|
24905
|
+
})
|
|
24906
|
+
);
|
|
24988
24907
|
break;
|
|
24989
24908
|
}
|
|
24990
24909
|
if (message.type === "user" && Array.isArray(message.message.content) && message.message.content.some(
|
|
24991
24910
|
(block) => block.type === "tool_result" && block.is_error === true
|
|
24992
24911
|
)) {
|
|
24993
|
-
|
|
24912
|
+
const fatal = message.message.content.some(
|
|
24913
|
+
(block) => block.type === "tool_result" && block.is_error === true && block.error_class === "fatal"
|
|
24914
|
+
);
|
|
24915
|
+
if (fatal) {
|
|
24916
|
+
this.hasFatalErrored = true;
|
|
24917
|
+
if (!this.fatalToolUseId) {
|
|
24918
|
+
const fatalBlock = message.message.content.find(
|
|
24919
|
+
(block) => block.type === "tool_result" && block.is_error === true && block.error_class === "fatal" && typeof block.tool_use_id === "string"
|
|
24920
|
+
);
|
|
24921
|
+
if (fatalBlock) {
|
|
24922
|
+
this.fatalToolUseId = fatalBlock.tool_use_id;
|
|
24923
|
+
}
|
|
24924
|
+
}
|
|
24925
|
+
}
|
|
24994
24926
|
toolErrored = true;
|
|
24995
24927
|
}
|
|
24996
24928
|
if (message.type === "progress") {
|
|
@@ -25270,15 +25202,7 @@ async function* queryCore(messages, systemPrompt, context, canUseTool, toolUseCo
|
|
|
25270
25202
|
}
|
|
25271
25203
|
const assistantMessage = result.message;
|
|
25272
25204
|
const shouldSkipPermissionCheck = result.shouldSkipPermissionCheck;
|
|
25273
|
-
const
|
|
25274
|
-
const toolUseMessages = applyAutoBatchAggregation(
|
|
25275
|
-
rawToolUseMessages,
|
|
25276
|
-
toolUseContext.options?.tools ?? []
|
|
25277
|
-
);
|
|
25278
|
-
const assistantMessageForTools = rewriteToolUseBlocksInAssistantMessage(
|
|
25279
|
-
assistantMessage,
|
|
25280
|
-
toolUseMessages
|
|
25281
|
-
);
|
|
25205
|
+
const toolUseMessages = assistantMessage.message.content.filter(isToolUseLikeBlock);
|
|
25282
25206
|
if (!toolUseMessages.length) {
|
|
25283
25207
|
const stopHookEvent = toolUseContext.agentId && toolUseContext.agentId !== "main" ? "SubagentStop" : "Stop";
|
|
25284
25208
|
const stopReason = assistantMessage.message?.stop_reason || assistantMessage.message?.stopReason || "end_turn";
|
|
@@ -25324,7 +25248,7 @@ async function* queryCore(messages, systemPrompt, context, canUseTool, toolUseCo
|
|
|
25324
25248
|
yield assistantMessage;
|
|
25325
25249
|
return;
|
|
25326
25250
|
}
|
|
25327
|
-
yield
|
|
25251
|
+
yield assistantMessage;
|
|
25328
25252
|
const siblingToolUseIDs = new Set(toolUseMessages.map((_) => _.id));
|
|
25329
25253
|
const toolQueue = new ToolUseQueue({
|
|
25330
25254
|
toolDefinitions: toolUseContext.options.tools,
|
|
@@ -25334,7 +25258,7 @@ async function* queryCore(messages, systemPrompt, context, canUseTool, toolUseCo
|
|
|
25334
25258
|
shouldSkipPermissionCheck
|
|
25335
25259
|
});
|
|
25336
25260
|
for (const toolUse of toolUseMessages) {
|
|
25337
|
-
toolQueue.addTool(toolUse,
|
|
25261
|
+
toolQueue.addTool(toolUse, assistantMessage);
|
|
25338
25262
|
}
|
|
25339
25263
|
const toolMessagesForNextTurn = [];
|
|
25340
25264
|
for await (const message of toolQueue.getRemainingResults()) {
|
|
@@ -25396,12 +25320,12 @@ async function* runToolUse(toolUse, siblingToolUseIDs, assistantMessage, canUseT
|
|
|
25396
25320
|
requestId: currentRequest?.id
|
|
25397
25321
|
});
|
|
25398
25322
|
yield createUserMessage([
|
|
25399
|
-
{
|
|
25400
|
-
|
|
25323
|
+
createErrorToolResultBlock({
|
|
25324
|
+
toolUseId: toolUse.id,
|
|
25401
25325
|
content: `Error: No such tool available: ${toolName}`,
|
|
25402
|
-
|
|
25403
|
-
|
|
25404
|
-
}
|
|
25326
|
+
errorCode: "TOOL_NOT_FOUND",
|
|
25327
|
+
errorClass: "soft"
|
|
25328
|
+
})
|
|
25405
25329
|
]);
|
|
25406
25330
|
return;
|
|
25407
25331
|
}
|
|
@@ -25428,12 +25352,11 @@ async function* runToolUse(toolUse, siblingToolUseIDs, assistantMessage, canUseT
|
|
|
25428
25352
|
} catch (e) {
|
|
25429
25353
|
logError(e);
|
|
25430
25354
|
const errorMessage = createUserMessage([
|
|
25431
|
-
{
|
|
25432
|
-
|
|
25355
|
+
createErrorToolResultBlock({
|
|
25356
|
+
toolUseId: toolUse.id,
|
|
25433
25357
|
content: `Tool execution failed: ${e instanceof Error ? e.message : String(e)}`,
|
|
25434
|
-
|
|
25435
|
-
|
|
25436
|
-
}
|
|
25358
|
+
errorCode: extractErrorCode(e)
|
|
25359
|
+
})
|
|
25437
25360
|
]);
|
|
25438
25361
|
yield errorMessage;
|
|
25439
25362
|
}
|
|
@@ -25483,12 +25406,12 @@ async function* checkPermissionsAndCallTool(tool, toolUseID, siblingToolUseIDs,
|
|
|
25483
25406
|
errorMessage = `Error: The Read tool requires a 'file_path' parameter to specify which file to read. Please provide the absolute path to the file you want to read. For example: {"file_path": "/path/to/file.txt"}`;
|
|
25484
25407
|
}
|
|
25485
25408
|
yield createUserMessage([
|
|
25486
|
-
{
|
|
25487
|
-
|
|
25409
|
+
createErrorToolResultBlock({
|
|
25410
|
+
toolUseId: toolUseID,
|
|
25488
25411
|
content: errorMessage,
|
|
25489
|
-
|
|
25490
|
-
|
|
25491
|
-
}
|
|
25412
|
+
errorCode: "INPUT_VALIDATION",
|
|
25413
|
+
errorClass: "soft"
|
|
25414
|
+
})
|
|
25492
25415
|
]);
|
|
25493
25416
|
return;
|
|
25494
25417
|
}
|
|
@@ -25499,12 +25422,12 @@ async function* checkPermissionsAndCallTool(tool, toolUseID, siblingToolUseIDs,
|
|
|
25499
25422
|
);
|
|
25500
25423
|
if (isValidCall?.result === false) {
|
|
25501
25424
|
yield createUserMessage([
|
|
25502
|
-
{
|
|
25503
|
-
|
|
25425
|
+
createErrorToolResultBlock({
|
|
25426
|
+
toolUseId: toolUseID,
|
|
25504
25427
|
content: isValidCall.message,
|
|
25505
|
-
|
|
25506
|
-
|
|
25507
|
-
}
|
|
25428
|
+
errorCode: "INPUT_VALIDATION",
|
|
25429
|
+
errorClass: "soft"
|
|
25430
|
+
})
|
|
25508
25431
|
]);
|
|
25509
25432
|
return;
|
|
25510
25433
|
}
|
|
@@ -25520,12 +25443,12 @@ async function* checkPermissionsAndCallTool(tool, toolUseID, siblingToolUseIDs,
|
|
|
25520
25443
|
});
|
|
25521
25444
|
if (hookOutcome.kind === "block") {
|
|
25522
25445
|
yield createUserMessage([
|
|
25523
|
-
{
|
|
25524
|
-
|
|
25446
|
+
createErrorToolResultBlock({
|
|
25447
|
+
toolUseId: toolUseID,
|
|
25525
25448
|
content: hookOutcome.message,
|
|
25526
|
-
|
|
25527
|
-
|
|
25528
|
-
}
|
|
25449
|
+
errorCode: "HOOK_BLOCKED",
|
|
25450
|
+
errorClass: "soft"
|
|
25451
|
+
})
|
|
25529
25452
|
]);
|
|
25530
25453
|
return;
|
|
25531
25454
|
}
|
|
@@ -25550,12 +25473,12 @@ async function* checkPermissionsAndCallTool(tool, toolUseID, siblingToolUseIDs,
|
|
|
25550
25473
|
const parsed = tool.inputSchema.safeParse(merged);
|
|
25551
25474
|
if (!parsed.success) {
|
|
25552
25475
|
yield createUserMessage([
|
|
25553
|
-
{
|
|
25554
|
-
|
|
25476
|
+
createErrorToolResultBlock({
|
|
25477
|
+
toolUseId: toolUseID,
|
|
25555
25478
|
content: `Hook updatedInput failed validation: ${parsed.error.message}`,
|
|
25556
|
-
|
|
25557
|
-
|
|
25558
|
-
}
|
|
25479
|
+
errorCode: "INPUT_VALIDATION",
|
|
25480
|
+
errorClass: "soft"
|
|
25481
|
+
})
|
|
25559
25482
|
]);
|
|
25560
25483
|
return;
|
|
25561
25484
|
}
|
|
@@ -25566,12 +25489,12 @@ async function* checkPermissionsAndCallTool(tool, toolUseID, siblingToolUseIDs,
|
|
|
25566
25489
|
);
|
|
25567
25490
|
if (isValidUpdate?.result === false) {
|
|
25568
25491
|
yield createUserMessage([
|
|
25569
|
-
{
|
|
25570
|
-
|
|
25492
|
+
createErrorToolResultBlock({
|
|
25493
|
+
toolUseId: toolUseID,
|
|
25571
25494
|
content: isValidUpdate.message,
|
|
25572
|
-
|
|
25573
|
-
|
|
25574
|
-
}
|
|
25495
|
+
errorCode: "INPUT_VALIDATION",
|
|
25496
|
+
errorClass: "soft"
|
|
25497
|
+
})
|
|
25575
25498
|
]);
|
|
25576
25499
|
return;
|
|
25577
25500
|
}
|
|
@@ -25596,12 +25519,12 @@ async function* checkPermissionsAndCallTool(tool, toolUseID, siblingToolUseIDs,
|
|
|
25596
25519
|
);
|
|
25597
25520
|
if (permissionResult.result === false) {
|
|
25598
25521
|
yield createUserMessage([
|
|
25599
|
-
{
|
|
25600
|
-
|
|
25522
|
+
createErrorToolResultBlock({
|
|
25523
|
+
toolUseId: toolUseID,
|
|
25601
25524
|
content: permissionResult.message,
|
|
25602
|
-
|
|
25603
|
-
|
|
25604
|
-
}
|
|
25525
|
+
errorCode: "PERMISSION_DENIED",
|
|
25526
|
+
errorClass: "soft"
|
|
25527
|
+
})
|
|
25605
25528
|
]);
|
|
25606
25529
|
return;
|
|
25607
25530
|
}
|
|
@@ -25688,12 +25611,11 @@ async function* checkPermissionsAndCallTool(tool, toolUseID, siblingToolUseIDs,
|
|
|
25688
25611
|
const content = formatError(error);
|
|
25689
25612
|
logError(error);
|
|
25690
25613
|
yield createUserMessage([
|
|
25691
|
-
{
|
|
25692
|
-
|
|
25614
|
+
createErrorToolResultBlock({
|
|
25615
|
+
toolUseId: toolUseID,
|
|
25693
25616
|
content,
|
|
25694
|
-
|
|
25695
|
-
|
|
25696
|
-
}
|
|
25617
|
+
errorCode: extractErrorCode(error)
|
|
25618
|
+
})
|
|
25697
25619
|
]);
|
|
25698
25620
|
}
|
|
25699
25621
|
}
|
|
@@ -25721,6 +25643,52 @@ function formatError(error) {
|
|
|
25721
25643
|
|
|
25722
25644
|
${end}`;
|
|
25723
25645
|
}
|
|
25646
|
+
var ERROR_CLASS_BY_CODE = {
|
|
25647
|
+
ENOENT: "soft",
|
|
25648
|
+
EISDIR: "soft",
|
|
25649
|
+
EACCES: "retryable",
|
|
25650
|
+
EPERM: "retryable",
|
|
25651
|
+
EMFILE: "retryable",
|
|
25652
|
+
ENFILE: "retryable",
|
|
25653
|
+
EIO: "fatal",
|
|
25654
|
+
ENODEV: "fatal",
|
|
25655
|
+
EBUSY: "fatal"
|
|
25656
|
+
};
|
|
25657
|
+
function extractErrorCode(error) {
|
|
25658
|
+
if (!error || typeof error !== "object") {
|
|
25659
|
+
return void 0;
|
|
25660
|
+
}
|
|
25661
|
+
if ("code" in error && typeof error.code === "string") {
|
|
25662
|
+
return error.code;
|
|
25663
|
+
}
|
|
25664
|
+
return void 0;
|
|
25665
|
+
}
|
|
25666
|
+
function summarizeError(detail) {
|
|
25667
|
+
const line = detail.split("\n").map((part) => part.trim()).find((part) => part.length > 0);
|
|
25668
|
+
const summary = line ?? detail.trim();
|
|
25669
|
+
return summary.length > 200 ? summary.slice(0, 200) : summary;
|
|
25670
|
+
}
|
|
25671
|
+
function getErrorClassFromCode(errorCode) {
|
|
25672
|
+
if (!errorCode) return "soft";
|
|
25673
|
+
return ERROR_CLASS_BY_CODE[errorCode] ?? "soft";
|
|
25674
|
+
}
|
|
25675
|
+
function createErrorToolResultBlock(args) {
|
|
25676
|
+
const detail = typeof args.errorDetail === "string" ? args.errorDetail : typeof args.content === "string" ? args.content : JSON.stringify(args.content);
|
|
25677
|
+
const errorCode = args.errorCode;
|
|
25678
|
+
const errorClass = args.errorClass ?? getErrorClassFromCode(errorCode);
|
|
25679
|
+
const summary = detail ? summarizeError(detail) : "";
|
|
25680
|
+
return {
|
|
25681
|
+
type: "tool_result",
|
|
25682
|
+
content: args.content,
|
|
25683
|
+
is_error: true,
|
|
25684
|
+
tool_use_id: args.toolUseId,
|
|
25685
|
+
error_class: errorClass,
|
|
25686
|
+
...errorCode ? { error_code: errorCode } : {},
|
|
25687
|
+
...summary ? { error_summary: summary } : {},
|
|
25688
|
+
...detail ? { error_detail: detail } : {},
|
|
25689
|
+
...args.rootToolUseId ? { root_tool_use_id: args.rootToolUseId } : {}
|
|
25690
|
+
};
|
|
25691
|
+
}
|
|
25724
25692
|
|
|
25725
25693
|
// src/ui/components/binary-feedback/BinaryFeedback.tsx
|
|
25726
25694
|
import { default as React99, useCallback as useCallback15 } from "react";
|
|
@@ -26764,7 +26732,6 @@ function getCoreTools() {
|
|
|
26764
26732
|
{ name: "LS", description: "List directory contents" },
|
|
26765
26733
|
{ name: "WebFetch", description: "Fetch web content" },
|
|
26766
26734
|
{ name: "WebSearch", description: "Search the web" },
|
|
26767
|
-
{ name: "Batch", description: "Execute multiple tool calls in parallel" },
|
|
26768
26735
|
{ name: "TodoWrite", description: "Manage task lists" }
|
|
26769
26736
|
];
|
|
26770
26737
|
return tools.filter((t) => t.name !== "Task" && t.name !== "ExitPlanMode");
|
|
@@ -26800,7 +26767,7 @@ import { homedir as homedir7 } from "os";
|
|
|
26800
26767
|
// src/commands/agents/generation.ts
|
|
26801
26768
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
26802
26769
|
async function generateAgentWithClaude(prompt) {
|
|
26803
|
-
const { queryModel } = await import("./llm-
|
|
26770
|
+
const { queryModel } = await import("./llm-XG5AIU4E.js");
|
|
26804
26771
|
const systemPrompt = `You are an expert at creating AI agent configurations. Based on the user's description, generate a specialized agent configuration.
|
|
26805
26772
|
|
|
26806
26773
|
Return your response as a JSON object with exactly these fields:
|
|
@@ -27096,12 +27063,6 @@ var COLOR_OPTIONS = [
|
|
|
27096
27063
|
"pink",
|
|
27097
27064
|
"cyan"
|
|
27098
27065
|
];
|
|
27099
|
-
function resolveToolSelection(selected, allToolNames) {
|
|
27100
|
-
if (selected.length === allToolNames.length && allToolNames.every((name2) => selected.includes(name2))) {
|
|
27101
|
-
return void 0;
|
|
27102
|
-
}
|
|
27103
|
-
return selected;
|
|
27104
|
-
}
|
|
27105
27066
|
function openInEditor(filePath) {
|
|
27106
27067
|
return new Promise((resolve11, reject) => {
|
|
27107
27068
|
const platform = process.platform;
|
|
@@ -27712,7 +27673,8 @@ function ToolPicker(props) {
|
|
|
27712
27673
|
});
|
|
27713
27674
|
};
|
|
27714
27675
|
const complete = () => {
|
|
27715
|
-
|
|
27676
|
+
const next = selected.length === allToolNames.length && allToolNames.every((n) => selected.includes(n)) ? void 0 : selected;
|
|
27677
|
+
props.onComplete(next);
|
|
27716
27678
|
};
|
|
27717
27679
|
const categorized = useMemo25(() => {
|
|
27718
27680
|
const readOnly = /* @__PURE__ */ new Set(["Read", "Glob", "Grep", "LS"]);
|
|
@@ -30145,23 +30107,6 @@ Output: Create directory 'foo'`
|
|
|
30145
30107
|
"Set this to true to dangerously override sandbox mode and run commands without sandboxing."
|
|
30146
30108
|
)
|
|
30147
30109
|
});
|
|
30148
|
-
var FILE_COMMAND_GUIDANCE = {
|
|
30149
|
-
ls: "\u4F7F\u7528 LS \u67E5\u770B\u76EE\u5F55\u7ED3\u6784\uFF0C\u4F7F\u7528 Glob \u641C\u7D22\u6587\u4EF6\u3002",
|
|
30150
|
-
find: "\u4F7F\u7528 Glob \u641C\u7D22\u6587\u4EF6\u3002",
|
|
30151
|
-
grep: "\u4F7F\u7528 Grep \u641C\u7D22\u5185\u5BB9\u3002",
|
|
30152
|
-
rg: "\u4F7F\u7528 Grep \u641C\u7D22\u5185\u5BB9\u3002",
|
|
30153
|
-
cat: "\u4F7F\u7528 Read \u67E5\u770B\u6587\u4EF6\u5185\u5BB9\u3002",
|
|
30154
|
-
head: "\u4F7F\u7528 Read \u67E5\u770B\u6587\u4EF6\u5185\u5BB9\u3002",
|
|
30155
|
-
tail: "\u4F7F\u7528 Read \u67E5\u770B\u6587\u4EF6\u5185\u5BB9\u3002",
|
|
30156
|
-
sed: "\u4F7F\u7528 Edit \u8FDB\u884C\u4FEE\u6539\u3002",
|
|
30157
|
-
awk: "\u4F7F\u7528 Edit \u8FDB\u884C\u4FEE\u6539\u3002",
|
|
30158
|
-
rm: "\u4F7F\u7528 Delete \u5220\u9664\u6587\u4EF6\u6216\u76EE\u5F55\u3002",
|
|
30159
|
-
rmdir: "\u4F7F\u7528 Delete \u5220\u9664\u76EE\u5F55\u3002",
|
|
30160
|
-
del: "\u4F7F\u7528 Delete \u5220\u9664\u6587\u4EF6\u3002",
|
|
30161
|
-
erase: "\u4F7F\u7528 Delete \u5220\u9664\u6587\u4EF6\u3002",
|
|
30162
|
-
mv: "\u4F7F\u7528 Read + Write + Delete \u5B8C\u6210\u79FB\u52A8\u6216\u91CD\u547D\u540D\u3002",
|
|
30163
|
-
cp: "\u4F7F\u7528 Read + Write \u5B8C\u6210\u590D\u5236\u3002"
|
|
30164
|
-
};
|
|
30165
30110
|
var BashTool = {
|
|
30166
30111
|
name: "Bash",
|
|
30167
30112
|
cachedDescription: "Run shell command",
|
|
@@ -30206,20 +30151,14 @@ var BashTool = {
|
|
|
30206
30151
|
message: e.message
|
|
30207
30152
|
};
|
|
30208
30153
|
}
|
|
30209
|
-
|
|
30210
|
-
|
|
30211
|
-
|
|
30212
|
-
|
|
30213
|
-
|
|
30214
|
-
|
|
30215
|
-
|
|
30216
|
-
|
|
30217
|
-
result: false,
|
|
30218
|
-
message: `BashTool \u89C4\u5219\uFF1A\u4E0D\u8981\u7528 BashTool \u8FDB\u884C\u6587\u4EF6\u8BFB\u5199/\u7F16\u8F91/\u641C\u7D22/\u5220\u9664/\u91CD\u547D\u540D/\u590D\u5236\u3002
|
|
30219
|
-
\u68C0\u6D4B\u5230\u547D\u4EE4: ${baseCmd}
|
|
30220
|
-
${guidance}`
|
|
30221
|
-
};
|
|
30222
|
-
}
|
|
30154
|
+
if (/^ls(\s+|$)/.test(trimmed) && !trimmed.includes("-")) {
|
|
30155
|
+
return {
|
|
30156
|
+
result: false,
|
|
30157
|
+
message: `Security Policy: Do not use 'ls' for simple file listing.
|
|
30158
|
+
- To find files: Use the 'Glob' tool.
|
|
30159
|
+
- To view directory structure: Use the 'LS' tool.
|
|
30160
|
+
- To check permissions/metadata: Use 'ls -l' (allowed).`
|
|
30161
|
+
};
|
|
30223
30162
|
}
|
|
30224
30163
|
if (timeout !== void 0) {
|
|
30225
30164
|
if (!Number.isFinite(timeout) || timeout < 0) {
|
|
@@ -30256,6 +30195,7 @@ ${guidance}`
|
|
|
30256
30195
|
};
|
|
30257
30196
|
}
|
|
30258
30197
|
}
|
|
30198
|
+
const commands = splitCommand(command4);
|
|
30259
30199
|
for (const cmd of commands) {
|
|
30260
30200
|
const parts = cmd.split(" ");
|
|
30261
30201
|
const baseCmd = parts[0];
|
|
@@ -30822,17 +30762,10 @@ It is critical that you mark todos as completed as soon as you are done with a t
|
|
|
30822
30762
|
1. **Modification Check**: Before editing, you MUST verify if the change is already present (e.g. use \`grep\` or \`read\`).
|
|
30823
30763
|
2. **Precise Targeting**: For code injection, prefer using LSP to find exact function boundaries, or Read the file to get unique context.
|
|
30824
30764
|
3. **Artifact Verification**: After completing a complex task, verify the artifacts (e.g. check if files exist using \`ls\`).
|
|
30825
|
-
4. **LSP Instinct**: Before modifying any code, you MUST use \`
|
|
30826
|
-
5. **Atomic Verification**: When editing code, especially in critical or complex files, you should strongly consider setting \`verify: true\` in the \`
|
|
30827
|
-
6. **Semantic Search**: When searching for code concepts (e.g. "AuthLogic", "UserHandler") rather than exact filenames, prefer using \`
|
|
30828
|
-
7. **Reference Guard**: Be aware that deleting files might be blocked if they are referenced elsewhere. If the \`
|
|
30829
|
-
|
|
30830
|
-
# Index Tree First Strategy
|
|
30831
|
-
- Every analysis must be grounded in a verifiable index tree; avoid blind matching
|
|
30832
|
-
- Build the tree in layers: Root \u2192 Core Directories \u2192 Secondary Modules
|
|
30833
|
-
- Use LS to map layers, then confirm with Glob before Grep/Read
|
|
30834
|
-
- Treat truncated trees as hints only, not for precise paths
|
|
30835
|
-
- Use the tree to narrow scope, then locate exact files and symbols
|
|
30765
|
+
4. **LSP Instinct**: Before modifying any code, you MUST use \`LSPTool.documentSymbol\` or \`LSPTool.definition\` to confirm the exact location and range of the target symbol. Do NOT rely on line numbers from \`read_file\` alone as they may be outdated.
|
|
30766
|
+
5. **Atomic Verification**: When editing code, especially in critical or complex files, you should strongly consider setting \`verify: true\` in the \`FileEditTool\`. This enables the tool to automatically detect syntax errors and ROLLBACK changes if they are invalid, preventing you from breaking the build.
|
|
30767
|
+
6. **Semantic Search**: When searching for code concepts (e.g. "AuthLogic", "UserHandler") rather than exact filenames, prefer using \`GlobTool\` with \`semantic: true\`. This leverages LSP to find files by their content definitions.
|
|
30768
|
+
7. **Reference Guard**: Be aware that deleting files might be blocked if they are referenced elsewhere. If the \`DeleteTool\` blocks you, check the references it reports. Only use \`force: true\` if you are refactoring and intentionally removing those references.
|
|
30836
30769
|
|
|
30837
30770
|
# LSP \u540E\u7F6E\u4E0E\u8303\u56F4\u9650\u5236
|
|
30838
30771
|
- \u4F18\u5148\u987A\u5E8F\uFF1A\u7ED3\u6784\u6811 -> \u70ED\u70B9\u5B9A\u4F4D -> Read -> LSP
|
|
@@ -30952,11 +30885,10 @@ NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTAN
|
|
|
30952
30885
|
|
|
30953
30886
|
# Cognitive Search Strategy
|
|
30954
30887
|
1. **Concept Search**: WHEN searching for high-level concepts (e.g., "Auth Logic", "Payment Flow") OR when you are uncertain about exact naming, you MUST use \`semantic: true\` in Grep/Glob tools. This activates the LSP Workspace Symbol search which is resilient to typos and fuzzy matches.
|
|
30955
|
-
- Example: \`
|
|
30956
|
-
- Example: \`
|
|
30888
|
+
- Example: \`GrepTool(pattern: "AuthFeatr", semantic: true)\` will find "AuthFeature".
|
|
30889
|
+
- Example: \`GlobTool(pattern: "tests", semantic: true)\` will find test files based on project structure.
|
|
30957
30890
|
2. **Exact Identifier**: WHEN you know the precise class/function name (e.g., "UserProfile", "initDatabase"), use standard Grep/Glob without \`semantic\` flag.
|
|
30958
30891
|
3. **Exploration**: If standard search returns 0 results, AUTOMATICALLY retry with \`semantic: true\`.
|
|
30959
|
-
4. **Path Discovery**: If the path is unclear, start from top-level tree, then \`Glob */\`, then \`Glob dir/*\` and \`Glob dir/*/\` to confirm paths before Grep/Read.
|
|
30960
30892
|
|
|
30961
30893
|
# File Modification Strategy (The Universal Edit Tool)
|
|
30962
30894
|
When you need to modify files, rely on the **Edit Tool** for almost all tasks.
|
|
@@ -30973,7 +30905,7 @@ When you need to modify files, rely on the **Edit Tool** for almost all tasks.
|
|
|
30973
30905
|
|
|
30974
30906
|
# Cognitive Safety & Verification
|
|
30975
30907
|
1. **Modification Check**: Before editing, you MUST verify if the change is already present (e.g. use \`grep\` or \`read\`). Do not rely on your memory or previous turns.
|
|
30976
|
-
2. **Precise Targeting**: For code injection, prefer using LSP (\`
|
|
30908
|
+
2. **Precise Targeting**: For code injection, prefer using LSP (\`LSPTool.documentSymbol\` or \`LSPTool.definition\`) to find exact function boundaries or symbol ranges. Do NOT rely on line numbers from \`read_file\` alone as they may be outdated.
|
|
30977
30909
|
3. **Artifact Verification**: After completing a complex task, verify the artifacts (e.g. check if files exist using \`ls\`, or content matches using \`grep\`).
|
|
30978
30910
|
|
|
30979
30911
|
${isOutputStyleActive ? "" : "\nYou MUST answer concisely with fewer than 4 lines of text (not including tool use or code generation), unless user asks for detail.\n"}
|
|
@@ -30987,12 +30919,11 @@ IMPORTANT: Before you begin work, think about what the code you're editing is su
|
|
|
30987
30919
|
async function getEnvInfo() {
|
|
30988
30920
|
const isGit = await getIsGit();
|
|
30989
30921
|
return `Here is useful information about the environment you are running in:
|
|
30990
|
-
|
|
30991
30922
|
<env>
|
|
30992
|
-
Today's date: ${(/* @__PURE__ */ new Date()).toLocaleDateString()}
|
|
30993
|
-
Platform: ${env.platform}
|
|
30994
30923
|
Working directory: ${getCwd()}
|
|
30995
30924
|
Is directory a git repo: ${isGit ? "Yes" : "No"}
|
|
30925
|
+
Platform: ${env.platform}
|
|
30926
|
+
Today's date: ${(/* @__PURE__ */ new Date()).toLocaleDateString()}
|
|
30996
30927
|
</env>`;
|
|
30997
30928
|
}
|
|
30998
30929
|
async function getAgentPrompt() {
|
|
@@ -31052,9 +30983,6 @@ export {
|
|
|
31052
30983
|
addToHistory,
|
|
31053
30984
|
countTokens,
|
|
31054
30985
|
__isToolUseLikeBlockForTests,
|
|
31055
|
-
__autoBatchToolUseBlocksForTests,
|
|
31056
|
-
__applyAutoBatchAggregationForTests,
|
|
31057
|
-
__rewriteToolUseBlocksForTests,
|
|
31058
30986
|
__ToolUseQueueForTests,
|
|
31059
30987
|
query,
|
|
31060
30988
|
runToolUse,
|