pybao-cli 1.3.96 → 1.3.98
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-X3SUAQOK.js +47 -0
- package/dist/{acp-CDGDKTAR.js → acp-KGDBJEZM.js} +30 -30
- package/dist/{agentsValidate-IYMRE5LG.js → agentsValidate-44ZL6CU7.js} +7 -7
- package/dist/{ask-4LHNV4R4.js → ask-UQQJRBXC.js} +31 -31
- package/dist/{autoUpdater-TPKC6D65.js → autoUpdater-VLX3NCAD.js} +3 -3
- package/dist/{chunk-XPNWP37X.js → chunk-2QRVX2CJ.js} +4 -4
- package/dist/{chunk-JU34VG53.js → chunk-3CM4GHNR.js} +2 -2
- package/dist/{chunk-Y4BCCRR6.js → chunk-3EP5IIWI.js} +2 -2
- package/dist/{chunk-DJUDMCQ5.js → chunk-4DMLFQ6M.js} +2 -2
- package/dist/{chunk-KBN7GGZA.js → chunk-4HNMLCPZ.js} +3 -3
- package/dist/{chunk-FGXBREV4.js → chunk-54D3G6Q6.js} +162 -53
- package/dist/chunk-54D3G6Q6.js.map +7 -0
- package/dist/{chunk-UIPGBESH.js → chunk-55V32BQI.js} +488 -696
- package/dist/chunk-55V32BQI.js.map +7 -0
- package/dist/{chunk-3PVEP4U4.js → chunk-66T64NT6.js} +1 -1
- package/dist/{chunk-727F2HY3.js → chunk-B5Q3NPPE.js} +1 -1
- package/dist/{chunk-MEUJXZX4.js → chunk-BNRAPYWK.js} +1 -1
- package/dist/{chunk-3JFULFWL.js → chunk-EC7O274M.js} +2 -2
- package/dist/{chunk-GYGLYCJZ.js → chunk-EL3VSBLN.js} +362 -469
- package/dist/chunk-EL3VSBLN.js.map +7 -0
- package/dist/{chunk-QMVIGC7T.js → chunk-FKCPEPP7.js} +2 -2
- package/dist/{chunk-Y3F72GS2.js → chunk-FYYSOZC7.js} +3 -3
- package/dist/{chunk-YI4BSGKF.js → chunk-GGO6HMMS.js} +2 -2
- package/dist/{chunk-YY4TWLH3.js → chunk-K3BD4OVM.js} +1 -1
- package/dist/{chunk-73GONZCQ.js → chunk-KD4UN4E7.js} +3 -3
- package/dist/{chunk-M6BDZ2J7.js → chunk-LY56HBFK.js} +3 -3
- package/dist/{chunk-ITZQDGXM.js → chunk-M2D5CMNE.js} +1 -1
- package/dist/{chunk-V5FXLNJM.js → chunk-MNKXUCNA.js} +3 -6
- package/dist/chunk-MNKXUCNA.js.map +7 -0
- package/dist/{chunk-M5W2AQCV.js → chunk-QYHEP5T2.js} +1 -1
- package/dist/{chunk-YNTDPWTX.js → chunk-R7GBUD66.js} +1 -1
- package/dist/{chunk-YJ7ZJ55K.js → chunk-RGOG2FCR.js} +3 -3
- package/dist/{chunk-WRJW7UMS.js → chunk-S5FTUHPH.js} +4 -7
- package/dist/chunk-S5FTUHPH.js.map +7 -0
- package/dist/{chunk-LPJBM43C.js → chunk-SPX4Q5Z5.js} +788 -158
- package/dist/chunk-SPX4Q5Z5.js.map +7 -0
- package/dist/{chunk-7Y77AFB2.js → chunk-TXBPCCRE.js} +1 -1
- package/dist/{chunk-7Y77AFB2.js.map → chunk-TXBPCCRE.js.map} +1 -1
- package/dist/{chunk-5VTWQLNR.js → chunk-WHJRTHTN.js} +1 -1
- package/dist/{chunk-5L2EETQJ.js → chunk-XTA2HSUL.js} +7 -6
- package/dist/{chunk-5L2EETQJ.js.map → chunk-XTA2HSUL.js.map} +2 -2
- package/dist/{chunk-Z6RFZ5P3.js → chunk-ZG5IWBYT.js} +3 -3
- package/dist/{chunk-WPZNGB7K.js → chunk-ZPVUGGYA.js} +2 -2
- package/dist/{cli-YXT6AQIO.js → cli-FIJNCN67.js} +88 -88
- package/dist/commands-ZNF6VSDT.js +51 -0
- package/dist/{config-JUTFAFW2.js → config-3I5YMAFL.js} +4 -4
- package/dist/{context-FGLASM6E.js → context-5X2SORJY.js} +12 -9
- package/dist/{customCommands-5UNMAYKR.js → customCommands-5SPC62ZC.js} +4 -4
- package/dist/{env-6NBXIUFS.js → env-57IO6RNL.js} +2 -2
- package/dist/{file-B5UIRTC4.js → file-NKD5PPBY.js} +4 -4
- package/dist/index.js +3 -3
- package/dist/{llm-WGWBAB2B.js → llm-LYDFVXMB.js} +32 -32
- package/dist/{llmLazy-FAEHDJOL.js → llmLazy-DFEN7PAI.js} +1 -1
- package/dist/{loader-MNXIOWAZ.js → loader-2GIAZ3HL.js} +4 -4
- package/dist/{lsp-G54BCJBO.js → lsp-W3AXFJZC.js} +10 -6
- package/dist/{lspAnchor-35G5F6VM.js → lspAnchor-3XTM2QPQ.js} +6 -6
- package/dist/{mcp-SXZ3YXGF.js → mcp-JQIJRSYG.js} +7 -7
- package/dist/{mentionProcessor-XW3BLBNG.js → mentionProcessor-NZHHCLSE.js} +5 -5
- package/dist/{messages-4OYH6E76.js → messages-KF3S4HA4.js} +1 -1
- package/dist/{model-DDQAVNG6.js → model-W2UGEFKK.js} +5 -5
- package/dist/{openai-3MLL3JND.js → openai-PH32RG3H.js} +5 -5
- package/dist/{outputStyles-6TLKSL5P.js → outputStyles-CHW6K32O.js} +4 -4
- package/dist/{pluginRuntime-VYK7YZQ3.js → pluginRuntime-S4DHYH3R.js} +6 -6
- package/dist/{pluginValidation-GSRDUKT5.js → pluginValidation-Z5BRZ656.js} +6 -6
- package/dist/prompts-EYJMD23J.js +53 -0
- package/dist/{pybAgentSessionLoad-XE5RJJ4D.js → pybAgentSessionLoad-PRWBEGFD.js} +4 -4
- package/dist/{pybAgentSessionResume-H6OJG3GA.js → pybAgentSessionResume-B5TXVDBS.js} +4 -4
- package/dist/{pybAgentStreamJsonSession-RAPI3ENP.js → pybAgentStreamJsonSession-WABCNXJI.js} +1 -1
- package/dist/{pybHooks-TJRBAWZV.js → pybHooks-LBVVFRME.js} +4 -4
- package/dist/query-ENVGHGXY.js +55 -0
- package/dist/{registry-TG3MLYCX.js → registry-DUUU5OUB.js} +5 -5
- package/dist/{ripgrep-4V44T5UJ.js → ripgrep-I3NSKTZL.js} +3 -3
- package/dist/{skillMarketplace-OQSNBIUX.js → skillMarketplace-TDHDU5LH.js} +3 -3
- package/dist/{state-W7NQEACP.js → state-D2YJSF7H.js} +2 -2
- package/dist/{theme-KCKVNWFY.js → theme-CDRFD75G.js} +5 -5
- package/dist/{toolPermissionSettings-VM363KSR.js → toolPermissionSettings-OLOBSKXT.js} +6 -6
- package/dist/tools-RCVS7632.js +52 -0
- package/dist/{userInput-MK7IEHYE.js → userInput-4S25MAFS.js} +31 -31
- package/package.json +1 -1
- package/dist/REPL-3MDUSJEZ.js +0 -47
- package/dist/chunk-FGXBREV4.js.map +0 -7
- package/dist/chunk-GYGLYCJZ.js.map +0 -7
- package/dist/chunk-LPJBM43C.js.map +0 -7
- package/dist/chunk-UIPGBESH.js.map +0 -7
- package/dist/chunk-V5FXLNJM.js.map +0 -7
- package/dist/chunk-WRJW7UMS.js.map +0 -7
- package/dist/commands-LF72PS63.js +0 -51
- package/dist/prompts-FR2SWLFP.js +0 -53
- package/dist/query-LNETXB2C.js +0 -61
- package/dist/tools-S2C7L5QZ.js +0 -52
- /package/dist/{REPL-3MDUSJEZ.js.map → REPL-X3SUAQOK.js.map} +0 -0
- /package/dist/{acp-CDGDKTAR.js.map → acp-KGDBJEZM.js.map} +0 -0
- /package/dist/{agentsValidate-IYMRE5LG.js.map → agentsValidate-44ZL6CU7.js.map} +0 -0
- /package/dist/{ask-4LHNV4R4.js.map → ask-UQQJRBXC.js.map} +0 -0
- /package/dist/{autoUpdater-TPKC6D65.js.map → autoUpdater-VLX3NCAD.js.map} +0 -0
- /package/dist/{chunk-XPNWP37X.js.map → chunk-2QRVX2CJ.js.map} +0 -0
- /package/dist/{chunk-JU34VG53.js.map → chunk-3CM4GHNR.js.map} +0 -0
- /package/dist/{chunk-Y4BCCRR6.js.map → chunk-3EP5IIWI.js.map} +0 -0
- /package/dist/{chunk-DJUDMCQ5.js.map → chunk-4DMLFQ6M.js.map} +0 -0
- /package/dist/{chunk-KBN7GGZA.js.map → chunk-4HNMLCPZ.js.map} +0 -0
- /package/dist/{chunk-3PVEP4U4.js.map → chunk-66T64NT6.js.map} +0 -0
- /package/dist/{chunk-727F2HY3.js.map → chunk-B5Q3NPPE.js.map} +0 -0
- /package/dist/{chunk-MEUJXZX4.js.map → chunk-BNRAPYWK.js.map} +0 -0
- /package/dist/{chunk-3JFULFWL.js.map → chunk-EC7O274M.js.map} +0 -0
- /package/dist/{chunk-QMVIGC7T.js.map → chunk-FKCPEPP7.js.map} +0 -0
- /package/dist/{chunk-Y3F72GS2.js.map → chunk-FYYSOZC7.js.map} +0 -0
- /package/dist/{chunk-YI4BSGKF.js.map → chunk-GGO6HMMS.js.map} +0 -0
- /package/dist/{chunk-YY4TWLH3.js.map → chunk-K3BD4OVM.js.map} +0 -0
- /package/dist/{chunk-73GONZCQ.js.map → chunk-KD4UN4E7.js.map} +0 -0
- /package/dist/{chunk-M6BDZ2J7.js.map → chunk-LY56HBFK.js.map} +0 -0
- /package/dist/{chunk-ITZQDGXM.js.map → chunk-M2D5CMNE.js.map} +0 -0
- /package/dist/{chunk-M5W2AQCV.js.map → chunk-QYHEP5T2.js.map} +0 -0
- /package/dist/{chunk-YNTDPWTX.js.map → chunk-R7GBUD66.js.map} +0 -0
- /package/dist/{chunk-YJ7ZJ55K.js.map → chunk-RGOG2FCR.js.map} +0 -0
- /package/dist/{chunk-5VTWQLNR.js.map → chunk-WHJRTHTN.js.map} +0 -0
- /package/dist/{chunk-Z6RFZ5P3.js.map → chunk-ZG5IWBYT.js.map} +0 -0
- /package/dist/{chunk-WPZNGB7K.js.map → chunk-ZPVUGGYA.js.map} +0 -0
- /package/dist/{cli-YXT6AQIO.js.map → cli-FIJNCN67.js.map} +0 -0
- /package/dist/{commands-LF72PS63.js.map → commands-ZNF6VSDT.js.map} +0 -0
- /package/dist/{config-JUTFAFW2.js.map → config-3I5YMAFL.js.map} +0 -0
- /package/dist/{context-FGLASM6E.js.map → context-5X2SORJY.js.map} +0 -0
- /package/dist/{customCommands-5UNMAYKR.js.map → customCommands-5SPC62ZC.js.map} +0 -0
- /package/dist/{env-6NBXIUFS.js.map → env-57IO6RNL.js.map} +0 -0
- /package/dist/{file-B5UIRTC4.js.map → file-NKD5PPBY.js.map} +0 -0
- /package/dist/{llm-WGWBAB2B.js.map → llm-LYDFVXMB.js.map} +0 -0
- /package/dist/{llmLazy-FAEHDJOL.js.map → llmLazy-DFEN7PAI.js.map} +0 -0
- /package/dist/{loader-MNXIOWAZ.js.map → loader-2GIAZ3HL.js.map} +0 -0
- /package/dist/{lsp-G54BCJBO.js.map → lsp-W3AXFJZC.js.map} +0 -0
- /package/dist/{lspAnchor-35G5F6VM.js.map → lspAnchor-3XTM2QPQ.js.map} +0 -0
- /package/dist/{mcp-SXZ3YXGF.js.map → mcp-JQIJRSYG.js.map} +0 -0
- /package/dist/{mentionProcessor-XW3BLBNG.js.map → mentionProcessor-NZHHCLSE.js.map} +0 -0
- /package/dist/{messages-4OYH6E76.js.map → messages-KF3S4HA4.js.map} +0 -0
- /package/dist/{model-DDQAVNG6.js.map → model-W2UGEFKK.js.map} +0 -0
- /package/dist/{openai-3MLL3JND.js.map → openai-PH32RG3H.js.map} +0 -0
- /package/dist/{outputStyles-6TLKSL5P.js.map → outputStyles-CHW6K32O.js.map} +0 -0
- /package/dist/{pluginRuntime-VYK7YZQ3.js.map → pluginRuntime-S4DHYH3R.js.map} +0 -0
- /package/dist/{pluginValidation-GSRDUKT5.js.map → pluginValidation-Z5BRZ656.js.map} +0 -0
- /package/dist/{prompts-FR2SWLFP.js.map → prompts-EYJMD23J.js.map} +0 -0
- /package/dist/{pybAgentSessionLoad-XE5RJJ4D.js.map → pybAgentSessionLoad-PRWBEGFD.js.map} +0 -0
- /package/dist/{pybAgentSessionResume-H6OJG3GA.js.map → pybAgentSessionResume-B5TXVDBS.js.map} +0 -0
- /package/dist/{pybAgentStreamJsonSession-RAPI3ENP.js.map → pybAgentStreamJsonSession-WABCNXJI.js.map} +0 -0
- /package/dist/{pybHooks-TJRBAWZV.js.map → pybHooks-LBVVFRME.js.map} +0 -0
- /package/dist/{query-LNETXB2C.js.map → query-ENVGHGXY.js.map} +0 -0
- /package/dist/{registry-TG3MLYCX.js.map → registry-DUUU5OUB.js.map} +0 -0
- /package/dist/{ripgrep-4V44T5UJ.js.map → ripgrep-I3NSKTZL.js.map} +0 -0
- /package/dist/{skillMarketplace-OQSNBIUX.js.map → skillMarketplace-TDHDU5LH.js.map} +0 -0
- /package/dist/{state-W7NQEACP.js.map → state-D2YJSF7H.js.map} +0 -0
- /package/dist/{theme-KCKVNWFY.js.map → theme-CDRFD75G.js.map} +0 -0
- /package/dist/{toolPermissionSettings-VM363KSR.js.map → toolPermissionSettings-OLOBSKXT.js.map} +0 -0
- /package/dist/{tools-S2C7L5QZ.js.map → tools-RCVS7632.js.map} +0 -0
- /package/dist/{userInput-MK7IEHYE.js.map → userInput-4S25MAFS.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-4HNMLCPZ.js";
|
|
7
7
|
import {
|
|
8
8
|
loadPybAgentSessionMessages
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-B5Q3NPPE.js";
|
|
10
10
|
import {
|
|
11
11
|
listPybAgentSessions
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-R7GBUD66.js";
|
|
13
13
|
import {
|
|
14
14
|
appendSessionCustomTitleRecord,
|
|
15
15
|
appendSessionJsonlFromMessage,
|
|
16
16
|
appendSessionTagRecord
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-EC7O274M.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-FYYSOZC7.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-3CM4GHNR.js";
|
|
39
39
|
import {
|
|
40
40
|
fetchCustomModels,
|
|
41
41
|
getModelFeatures
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-4DMLFQ6M.js";
|
|
43
43
|
import {
|
|
44
44
|
queryLLM,
|
|
45
45
|
queryQuick,
|
|
46
46
|
verifyApiKey
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-2QRVX2CJ.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-XTA2HSUL.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-M2D5CMNE.js";
|
|
75
75
|
import {
|
|
76
76
|
loadToolPermissionContextFromDisk,
|
|
77
77
|
persistToolPermissionUpdateToDisk
|
|
78
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-LY56HBFK.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-GGO6HMMS.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-FKCPEPP7.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-WHJRTHTN.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-WRJW7UMS.js";
|
|
160
|
+
} from "./chunk-3EP5IIWI.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-SPX4Q5Z5.js";
|
|
167
171
|
import {
|
|
168
172
|
getSettingsFileCandidates,
|
|
169
173
|
loadSettingsWithLegacyFallback
|
|
170
|
-
} from "./chunk-
|
|
174
|
+
} from "./chunk-66T64NT6.js";
|
|
171
175
|
import {
|
|
172
176
|
getCustomCommandDirectories,
|
|
173
177
|
hasCustomCommands,
|
|
174
178
|
loadCustomCommands,
|
|
175
179
|
reloadCustomCommands
|
|
176
|
-
} from "./chunk-
|
|
180
|
+
} from "./chunk-ZPVUGGYA.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-KD4UN4E7.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-54D3G6Q6.js";
|
|
197
|
+
import {
|
|
198
|
+
ripGrep
|
|
199
|
+
} from "./chunk-S5FTUHPH.js";
|
|
193
200
|
import {
|
|
194
201
|
getTheme
|
|
195
|
-
} from "./chunk-
|
|
202
|
+
} from "./chunk-BNRAPYWK.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-MNKXUCNA.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-QYHEP5T2.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-K3BD4OVM.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-TXBPCCRE.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-LYDFVXMB.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-LYDFVXMB.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-3XTM2QPQ.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-LYDFVXMB.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-S4DHYH3R.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-W2UGEFKK.js").then(({ reloadModelManager: reloadModelManager2 }) => {
|
|
16053
15983
|
reloadModelManager2();
|
|
16054
15984
|
triggerModelConfigChange();
|
|
16055
15985
|
onDone();
|
|
@@ -16177,7 +16107,14 @@ 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: []
|
|
16181
16118
|
};
|
|
16182
16119
|
function summarizeDiagnostics(entries) {
|
|
16183
16120
|
return entries.reduce(
|
|
@@ -16230,15 +16167,96 @@ function formatFallbackSummary(status) {
|
|
|
16230
16167
|
const countsText = activeCounts.length > 0 ? activeCounts.map(([name2, count]) => `${name2} ${count}`).join(", ") : "none";
|
|
16231
16168
|
return `Fallbacks: ${countsText}, boundary ${boundaryText}`;
|
|
16232
16169
|
}
|
|
16170
|
+
function formatFastPathFailuresSummary(status) {
|
|
16171
|
+
const summary = status.fastPath?.failuresSummary ?? {};
|
|
16172
|
+
const entries = ["exception", "empty", "timeout", "unsupported"].map((reason) => ({ reason, entry: summary[reason] })).filter((item) => item.entry && item.entry.count > 0);
|
|
16173
|
+
if (entries.length === 0) return "FastPath failures: none";
|
|
16174
|
+
const text = entries.map(({ reason, entry }) => {
|
|
16175
|
+
const lastAt = entry?.lastAt ?? null;
|
|
16176
|
+
const lastText = lastAt === null ? "last n/a" : `last ${lastAt}`;
|
|
16177
|
+
return `${reason} ${entry?.count ?? 0} (${lastText})`;
|
|
16178
|
+
}).join(", ");
|
|
16179
|
+
return `FastPath failures: ${text}`;
|
|
16180
|
+
}
|
|
16181
|
+
function formatFastPathLastFallbackEntries(status) {
|
|
16182
|
+
const entries = status.fastPath?.lastFallback ?? [];
|
|
16183
|
+
const sorted = [...entries].sort((a, b) => b.at - a.at).slice(0, 10);
|
|
16184
|
+
return sorted.map((entry) => ({
|
|
16185
|
+
key: `${entry.filePath}:${entry.reason}:${entry.at}`,
|
|
16186
|
+
line: `${entry.filePath} ${entry.reason} ${entry.at}`
|
|
16187
|
+
}));
|
|
16188
|
+
}
|
|
16189
|
+
function formatFastPathHealthEntries(status) {
|
|
16190
|
+
const entries = status.fastPath?.healthSummary ?? [];
|
|
16191
|
+
const sorted = [...entries].sort((a, b) => {
|
|
16192
|
+
const aLast = Math.max(a.lastSuccessAt ?? 0, a.lastFailureAt ?? 0);
|
|
16193
|
+
const bLast = Math.max(b.lastSuccessAt ?? 0, b.lastFailureAt ?? 0);
|
|
16194
|
+
return bLast - aLast;
|
|
16195
|
+
}).slice(0, 10);
|
|
16196
|
+
return sorted.map((entry) => {
|
|
16197
|
+
const lastSuccess = entry.lastSuccessAt ?? "n/a";
|
|
16198
|
+
const lastFailure = entry.lastFailureAt ?? "n/a";
|
|
16199
|
+
const avgDuration = entry.avgDurationMs === null ? "n/a" : `${Math.round(entry.avgDurationMs)}ms`;
|
|
16200
|
+
const downgrade = entry.downgradeUntil === null ? "n/a" : entry.downgradeUntil;
|
|
16201
|
+
return {
|
|
16202
|
+
key: `${entry.filePath}:${lastSuccess}:${lastFailure}:${downgrade}`,
|
|
16203
|
+
line: `${entry.filePath} success ${entry.successCount} failure ${entry.failureCount} timeout ${entry.timeoutCount} lastSuccess ${lastSuccess} lastFailure ${lastFailure} avg ${avgDuration} downgradeUntil ${downgrade}`
|
|
16204
|
+
};
|
|
16205
|
+
});
|
|
16206
|
+
}
|
|
16207
|
+
function formatMetricsSummary(status) {
|
|
16208
|
+
const spawnCount = status.metrics?.length ?? 0;
|
|
16209
|
+
const requestCount = status.requestMetrics?.length ?? 0;
|
|
16210
|
+
if (spawnCount === 0 && requestCount === 0) return "Metrics: none";
|
|
16211
|
+
const window = status.sampleWindow;
|
|
16212
|
+
const windowText = window && Number.isFinite(window.latencySamples) && Number.isFinite(window.baselineSamples) ? ` window latency ${window.latencySamples} baseline ${window.baselineSamples}` : "";
|
|
16213
|
+
return `Metrics: spawn ${spawnCount}, request ${requestCount}${windowText}`;
|
|
16214
|
+
}
|
|
16215
|
+
function formatSpawnMetricEntries(status) {
|
|
16216
|
+
const entries = status.metrics ?? [];
|
|
16217
|
+
return entries.slice(0, 10).map((entry) => {
|
|
16218
|
+
const successRate = Math.round((entry.successRate ?? 0) * 100);
|
|
16219
|
+
const p95 = Math.round(entry.latencyP95Ms ?? 0);
|
|
16220
|
+
return {
|
|
16221
|
+
key: `${entry.server}:${entry.attempts}:${entry.successes}:${p95}`,
|
|
16222
|
+
line: `${entry.server} success ${successRate}% p95 ${p95}ms`
|
|
16223
|
+
};
|
|
16224
|
+
});
|
|
16225
|
+
}
|
|
16226
|
+
function formatRequestMetricEntries(status) {
|
|
16227
|
+
const entries = status.requestMetrics ?? [];
|
|
16228
|
+
const sorted = [...entries].sort((a, b) => {
|
|
16229
|
+
if (a.regression === b.regression) {
|
|
16230
|
+
return (b.latencyP95Ms ?? 0) - (a.latencyP95Ms ?? 0);
|
|
16231
|
+
}
|
|
16232
|
+
return a.regression ? -1 : 1;
|
|
16233
|
+
});
|
|
16234
|
+
return sorted.slice(0, 10).map((entry) => {
|
|
16235
|
+
const successRate = Math.round((entry.successRate ?? 0) * 100);
|
|
16236
|
+
const p95 = Math.round(entry.latencyP95Ms ?? 0);
|
|
16237
|
+
const regression = entry.regression ? "regression" : "ok";
|
|
16238
|
+
const baseline = entry.baselineSamples > 0 ? ` baseline ${entry.baselineSamples}` : "";
|
|
16239
|
+
return {
|
|
16240
|
+
key: `${entry.server}:${entry.operation}:${p95}:${entry.baselineSamples}`,
|
|
16241
|
+
line: `${entry.operation} ${entry.server} success ${successRate}% p95 ${p95}ms ${regression}${baseline}`
|
|
16242
|
+
};
|
|
16243
|
+
});
|
|
16244
|
+
}
|
|
16233
16245
|
function normalizeStatus(status) {
|
|
16234
16246
|
if (!status) return EMPTY_STATUS;
|
|
16235
16247
|
const raw = status;
|
|
16236
16248
|
const fallbacks = typeof raw.fallbacks === "object" && raw.fallbacks ? raw.fallbacks : void 0;
|
|
16249
|
+
const fastPath = typeof raw.fastPath === "object" && raw.fastPath ? raw.fastPath : void 0;
|
|
16250
|
+
const sampleWindow = typeof raw.sampleWindow === "object" && raw.sampleWindow ? raw.sampleWindow : void 0;
|
|
16237
16251
|
return {
|
|
16238
16252
|
clients: Array.isArray(raw.clients) ? raw.clients : [],
|
|
16239
16253
|
spawning: Array.isArray(raw.spawning) ? raw.spawning : [],
|
|
16240
16254
|
broken: Array.isArray(raw.broken) ? raw.broken : [],
|
|
16241
16255
|
diagnostics: Array.isArray(raw.diagnostics) ? raw.diagnostics : [],
|
|
16256
|
+
schemaVersion: typeof raw.schemaVersion === "number" ? raw.schemaVersion : void 0,
|
|
16257
|
+
sampleWindow,
|
|
16258
|
+
metrics: Array.isArray(raw.metrics) ? raw.metrics : [],
|
|
16259
|
+
requestMetrics: Array.isArray(raw.requestMetrics) ? raw.requestMetrics : [],
|
|
16242
16260
|
fallbacks: {
|
|
16243
16261
|
documentSymbol: Array.isArray(fallbacks?.documentSymbol) ? fallbacks.documentSymbol : [],
|
|
16244
16262
|
getScope: Array.isArray(fallbacks?.getScope) ? fallbacks.getScope : [],
|
|
@@ -16248,6 +16266,11 @@ function normalizeStatus(status) {
|
|
|
16248
16266
|
incomingCalls: Array.isArray(fallbacks?.incomingCalls) ? fallbacks.incomingCalls : [],
|
|
16249
16267
|
outgoingCalls: Array.isArray(fallbacks?.outgoingCalls) ? fallbacks.outgoingCalls : [],
|
|
16250
16268
|
boundary: Array.isArray(fallbacks?.boundary) ? fallbacks.boundary : []
|
|
16269
|
+
},
|
|
16270
|
+
fastPath: {
|
|
16271
|
+
failuresSummary: fastPath && typeof fastPath.failuresSummary === "object" && fastPath.failuresSummary ? fastPath.failuresSummary : {},
|
|
16272
|
+
lastFallback: Array.isArray(fastPath?.lastFallback) ? fastPath.lastFallback : [],
|
|
16273
|
+
healthSummary: Array.isArray(fastPath?.healthSummary) ? fastPath.healthSummary : []
|
|
16251
16274
|
}
|
|
16252
16275
|
};
|
|
16253
16276
|
}
|
|
@@ -16288,6 +16311,11 @@ function LspStatusDisplay({
|
|
|
16288
16311
|
).sort();
|
|
16289
16312
|
const allDiagnostics = Array.from(diagnosticsByClient.values()).flat();
|
|
16290
16313
|
const globalTotals = summarizeDiagnostics(allDiagnostics);
|
|
16314
|
+
const fastPathEntries = formatFastPathLastFallbackEntries(normalized);
|
|
16315
|
+
const fastPathHealthEntries = formatFastPathHealthEntries(normalized);
|
|
16316
|
+
const metricsSummary = formatMetricsSummary(normalized);
|
|
16317
|
+
const spawnMetricEntries = formatSpawnMetricEntries(normalized);
|
|
16318
|
+
const requestMetricEntries = formatRequestMetricEntries(normalized);
|
|
16291
16319
|
return /* @__PURE__ */ React45.createElement(
|
|
16292
16320
|
Box35,
|
|
16293
16321
|
{
|
|
@@ -16302,6 +16330,12 @@ function LspStatusDisplay({
|
|
|
16302
16330
|
/* @__PURE__ */ React45.createElement(Text39, null, "Clients: ", normalized.clients.length, " connected,", " ", normalized.spawning.length, " spawning, ", normalized.broken.length, " broken"),
|
|
16303
16331
|
/* @__PURE__ */ React45.createElement(Text39, { color: theme.secondaryText }, formatDiagnosticsSummary(globalTotals)),
|
|
16304
16332
|
/* @__PURE__ */ React45.createElement(Text39, { color: theme.secondaryText }, formatFallbackSummary(normalized)),
|
|
16333
|
+
/* @__PURE__ */ React45.createElement(Text39, { color: theme.secondaryText }, formatFastPathFailuresSummary(normalized)),
|
|
16334
|
+
/* @__PURE__ */ React45.createElement(Text39, { color: theme.secondaryText }, metricsSummary),
|
|
16335
|
+
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,
|
|
16336
|
+
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,
|
|
16337
|
+
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,
|
|
16338
|
+
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
16339
|
/* @__PURE__ */ React45.createElement(Text39, null, " "),
|
|
16306
16340
|
clientNames.length === 0 ? /* @__PURE__ */ React45.createElement(Text39, { color: theme.secondaryText }, "No LSP clients initialized") : /* @__PURE__ */ React45.createElement(Box35, { flexDirection: "column" }, clientNames.map((clientName) => {
|
|
16307
16341
|
const state = getClientState(clientName, normalized);
|
|
@@ -23493,7 +23527,7 @@ function useStatusLine() {
|
|
|
23493
23527
|
// src/ui/components/PromptInput.tsx
|
|
23494
23528
|
async function interpretHashCommand(input) {
|
|
23495
23529
|
try {
|
|
23496
|
-
const { queryQuick: queryQuick2 } = await import("./llm-
|
|
23530
|
+
const { queryQuick: queryQuick2 } = await import("./llm-LYDFVXMB.js");
|
|
23497
23531
|
const systemPrompt = [
|
|
23498
23532
|
"You're helping the user structure notes that will be added to their PYB.md file.",
|
|
23499
23533
|
"Format the user's input into a well-structured note that will be useful for later reference.",
|
|
@@ -23806,7 +23840,7 @@ function PromptInput({
|
|
|
23806
23840
|
if (messages2.length) {
|
|
23807
23841
|
if (mode === "bash") {
|
|
23808
23842
|
onQuery(messages2, newAbortController).then(async () => {
|
|
23809
|
-
const { getCwd: getCwd2 } = await import("./state-
|
|
23843
|
+
const { getCwd: getCwd2 } = await import("./state-D2YJSF7H.js");
|
|
23810
23844
|
setCurrentPwd(getCwd2());
|
|
23811
23845
|
});
|
|
23812
23846
|
} else {
|
|
@@ -24358,6 +24392,7 @@ async function logBinaryFeedbackEvent(_m1, _m2, _choice) {
|
|
|
24358
24392
|
var PybContextManager = class _PybContextManager {
|
|
24359
24393
|
static instance;
|
|
24360
24394
|
projectDocsCache = "";
|
|
24395
|
+
projectStructureStatsCache = "";
|
|
24361
24396
|
cacheInitialized = false;
|
|
24362
24397
|
initPromise = null;
|
|
24363
24398
|
static getInstance() {
|
|
@@ -24370,8 +24405,12 @@ var PybContextManager = class _PybContextManager {
|
|
|
24370
24405
|
if (this.initPromise) return this.initPromise;
|
|
24371
24406
|
this.initPromise = (async () => {
|
|
24372
24407
|
try {
|
|
24373
|
-
const [projectDocs] = await Promise.all([
|
|
24408
|
+
const [projectDocs, statsBlock] = await Promise.all([
|
|
24409
|
+
getProjectDocs(),
|
|
24410
|
+
getProjectStructureStatisticsBlock()
|
|
24411
|
+
]);
|
|
24374
24412
|
this.projectDocsCache = projectDocs || "";
|
|
24413
|
+
this.projectStructureStatsCache = statsBlock;
|
|
24375
24414
|
this.cacheInitialized = true;
|
|
24376
24415
|
} catch (error) {
|
|
24377
24416
|
logError(error);
|
|
@@ -24379,6 +24418,7 @@ var PybContextManager = class _PybContextManager {
|
|
|
24379
24418
|
error: error instanceof Error ? error.message : String(error)
|
|
24380
24419
|
});
|
|
24381
24420
|
this.projectDocsCache = "";
|
|
24421
|
+
this.projectStructureStatsCache = "";
|
|
24382
24422
|
this.cacheInitialized = true;
|
|
24383
24423
|
}
|
|
24384
24424
|
})();
|
|
@@ -24395,7 +24435,8 @@ var PybContextManager = class _PybContextManager {
|
|
|
24395
24435
|
return "";
|
|
24396
24436
|
}
|
|
24397
24437
|
const context = [
|
|
24398
|
-
this.projectDocsCache
|
|
24438
|
+
this.projectDocsCache,
|
|
24439
|
+
this.projectStructureStatsCache
|
|
24399
24440
|
].filter(Boolean).join("\n\n");
|
|
24400
24441
|
return context;
|
|
24401
24442
|
}
|
|
@@ -24662,7 +24703,7 @@ ${contentWithLines}
|
|
|
24662
24703
|
}
|
|
24663
24704
|
}
|
|
24664
24705
|
getMessagesSetter()([]);
|
|
24665
|
-
|
|
24706
|
+
getContext.cache.clear?.();
|
|
24666
24707
|
getCodeStyle.cache.clear?.();
|
|
24667
24708
|
resetFileFreshnessSession();
|
|
24668
24709
|
return compactedMessages;
|
|
@@ -24673,218 +24714,26 @@ function isToolUseLikeBlock(block) {
|
|
|
24673
24714
|
return block && typeof block === "object" && (block.type === "tool_use" || block.type === "server_tool_use" || block.type === "mcp_tool_use");
|
|
24674
24715
|
}
|
|
24675
24716
|
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) {
|
|
24717
|
+
function createSyntheticToolUseErrorMessage(args) {
|
|
24718
|
+
const { toolUseId, reason, rootToolUseId } = args;
|
|
24871
24719
|
if (reason === "user_interrupted") {
|
|
24872
24720
|
return createUserMessage([
|
|
24873
|
-
{
|
|
24874
|
-
|
|
24721
|
+
createErrorToolResultBlock({
|
|
24722
|
+
toolUseId,
|
|
24875
24723
|
content: REJECT_MESSAGE,
|
|
24876
|
-
|
|
24877
|
-
|
|
24878
|
-
}
|
|
24724
|
+
errorCode: "USER_INTERRUPTED",
|
|
24725
|
+
errorClass: "fatal"
|
|
24726
|
+
})
|
|
24879
24727
|
]);
|
|
24880
24728
|
}
|
|
24881
24729
|
return createUserMessage([
|
|
24882
|
-
{
|
|
24883
|
-
|
|
24730
|
+
createErrorToolResultBlock({
|
|
24731
|
+
toolUseId,
|
|
24884
24732
|
content: "<tool_use_error>Sibling tool call errored</tool_use_error>",
|
|
24885
|
-
|
|
24886
|
-
|
|
24887
|
-
|
|
24733
|
+
errorCode: "SIBLING_ERROR",
|
|
24734
|
+
errorClass: "fatal",
|
|
24735
|
+
rootToolUseId
|
|
24736
|
+
})
|
|
24888
24737
|
]);
|
|
24889
24738
|
}
|
|
24890
24739
|
var ToolUseQueue = class {
|
|
@@ -24892,7 +24741,8 @@ var ToolUseQueue = class {
|
|
|
24892
24741
|
canUseTool;
|
|
24893
24742
|
tools = [];
|
|
24894
24743
|
toolUseContext;
|
|
24895
|
-
|
|
24744
|
+
hasFatalErrored = false;
|
|
24745
|
+
fatalToolUseId;
|
|
24896
24746
|
progressAvailableResolve;
|
|
24897
24747
|
siblingToolUseIDs;
|
|
24898
24748
|
shouldSkipPermissionCheck;
|
|
@@ -24954,7 +24804,7 @@ var ToolUseQueue = class {
|
|
|
24954
24804
|
}
|
|
24955
24805
|
}
|
|
24956
24806
|
getAbortReason() {
|
|
24957
|
-
if (this.
|
|
24807
|
+
if (this.hasFatalErrored) return "sibling_error";
|
|
24958
24808
|
if (this.toolUseContext.abortController.signal.aborted)
|
|
24959
24809
|
return "user_interrupted";
|
|
24960
24810
|
return null;
|
|
@@ -24966,7 +24816,13 @@ var ToolUseQueue = class {
|
|
|
24966
24816
|
const promise = (async () => {
|
|
24967
24817
|
const abortReason = this.getAbortReason();
|
|
24968
24818
|
if (abortReason) {
|
|
24969
|
-
results.push(
|
|
24819
|
+
results.push(
|
|
24820
|
+
createSyntheticToolUseErrorMessage({
|
|
24821
|
+
toolUseId: entry.id,
|
|
24822
|
+
reason: abortReason,
|
|
24823
|
+
rootToolUseId: this.fatalToolUseId
|
|
24824
|
+
})
|
|
24825
|
+
);
|
|
24970
24826
|
entry.results = results;
|
|
24971
24827
|
entry.contextModifiers = contextModifiers;
|
|
24972
24828
|
entry.status = "completed";
|
|
@@ -24984,13 +24840,32 @@ var ToolUseQueue = class {
|
|
|
24984
24840
|
for await (const message of generator) {
|
|
24985
24841
|
const reason = this.getAbortReason();
|
|
24986
24842
|
if (reason && !toolErrored) {
|
|
24987
|
-
results.push(
|
|
24843
|
+
results.push(
|
|
24844
|
+
createSyntheticToolUseErrorMessage({
|
|
24845
|
+
toolUseId: entry.id,
|
|
24846
|
+
reason,
|
|
24847
|
+
rootToolUseId: this.fatalToolUseId
|
|
24848
|
+
})
|
|
24849
|
+
);
|
|
24988
24850
|
break;
|
|
24989
24851
|
}
|
|
24990
24852
|
if (message.type === "user" && Array.isArray(message.message.content) && message.message.content.some(
|
|
24991
24853
|
(block) => block.type === "tool_result" && block.is_error === true
|
|
24992
24854
|
)) {
|
|
24993
|
-
|
|
24855
|
+
const fatal = message.message.content.some(
|
|
24856
|
+
(block) => block.type === "tool_result" && block.is_error === true && block.error_class === "fatal"
|
|
24857
|
+
);
|
|
24858
|
+
if (fatal) {
|
|
24859
|
+
this.hasFatalErrored = true;
|
|
24860
|
+
if (!this.fatalToolUseId) {
|
|
24861
|
+
const fatalBlock = message.message.content.find(
|
|
24862
|
+
(block) => block.type === "tool_result" && block.is_error === true && block.error_class === "fatal" && typeof block.tool_use_id === "string"
|
|
24863
|
+
);
|
|
24864
|
+
if (fatalBlock) {
|
|
24865
|
+
this.fatalToolUseId = fatalBlock.tool_use_id;
|
|
24866
|
+
}
|
|
24867
|
+
}
|
|
24868
|
+
}
|
|
24994
24869
|
toolErrored = true;
|
|
24995
24870
|
}
|
|
24996
24871
|
if (message.type === "progress") {
|
|
@@ -25270,15 +25145,7 @@ async function* queryCore(messages, systemPrompt, context, canUseTool, toolUseCo
|
|
|
25270
25145
|
}
|
|
25271
25146
|
const assistantMessage = result.message;
|
|
25272
25147
|
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
|
-
);
|
|
25148
|
+
const toolUseMessages = assistantMessage.message.content.filter(isToolUseLikeBlock);
|
|
25282
25149
|
if (!toolUseMessages.length) {
|
|
25283
25150
|
const stopHookEvent = toolUseContext.agentId && toolUseContext.agentId !== "main" ? "SubagentStop" : "Stop";
|
|
25284
25151
|
const stopReason = assistantMessage.message?.stop_reason || assistantMessage.message?.stopReason || "end_turn";
|
|
@@ -25324,7 +25191,7 @@ async function* queryCore(messages, systemPrompt, context, canUseTool, toolUseCo
|
|
|
25324
25191
|
yield assistantMessage;
|
|
25325
25192
|
return;
|
|
25326
25193
|
}
|
|
25327
|
-
yield
|
|
25194
|
+
yield assistantMessage;
|
|
25328
25195
|
const siblingToolUseIDs = new Set(toolUseMessages.map((_) => _.id));
|
|
25329
25196
|
const toolQueue = new ToolUseQueue({
|
|
25330
25197
|
toolDefinitions: toolUseContext.options.tools,
|
|
@@ -25334,7 +25201,7 @@ async function* queryCore(messages, systemPrompt, context, canUseTool, toolUseCo
|
|
|
25334
25201
|
shouldSkipPermissionCheck
|
|
25335
25202
|
});
|
|
25336
25203
|
for (const toolUse of toolUseMessages) {
|
|
25337
|
-
toolQueue.addTool(toolUse,
|
|
25204
|
+
toolQueue.addTool(toolUse, assistantMessage);
|
|
25338
25205
|
}
|
|
25339
25206
|
const toolMessagesForNextTurn = [];
|
|
25340
25207
|
for await (const message of toolQueue.getRemainingResults()) {
|
|
@@ -25396,12 +25263,12 @@ async function* runToolUse(toolUse, siblingToolUseIDs, assistantMessage, canUseT
|
|
|
25396
25263
|
requestId: currentRequest?.id
|
|
25397
25264
|
});
|
|
25398
25265
|
yield createUserMessage([
|
|
25399
|
-
{
|
|
25400
|
-
|
|
25266
|
+
createErrorToolResultBlock({
|
|
25267
|
+
toolUseId: toolUse.id,
|
|
25401
25268
|
content: `Error: No such tool available: ${toolName}`,
|
|
25402
|
-
|
|
25403
|
-
|
|
25404
|
-
}
|
|
25269
|
+
errorCode: "TOOL_NOT_FOUND",
|
|
25270
|
+
errorClass: "soft"
|
|
25271
|
+
})
|
|
25405
25272
|
]);
|
|
25406
25273
|
return;
|
|
25407
25274
|
}
|
|
@@ -25428,12 +25295,11 @@ async function* runToolUse(toolUse, siblingToolUseIDs, assistantMessage, canUseT
|
|
|
25428
25295
|
} catch (e) {
|
|
25429
25296
|
logError(e);
|
|
25430
25297
|
const errorMessage = createUserMessage([
|
|
25431
|
-
{
|
|
25432
|
-
|
|
25298
|
+
createErrorToolResultBlock({
|
|
25299
|
+
toolUseId: toolUse.id,
|
|
25433
25300
|
content: `Tool execution failed: ${e instanceof Error ? e.message : String(e)}`,
|
|
25434
|
-
|
|
25435
|
-
|
|
25436
|
-
}
|
|
25301
|
+
errorCode: extractErrorCode(e)
|
|
25302
|
+
})
|
|
25437
25303
|
]);
|
|
25438
25304
|
yield errorMessage;
|
|
25439
25305
|
}
|
|
@@ -25483,12 +25349,12 @@ async function* checkPermissionsAndCallTool(tool, toolUseID, siblingToolUseIDs,
|
|
|
25483
25349
|
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
25350
|
}
|
|
25485
25351
|
yield createUserMessage([
|
|
25486
|
-
{
|
|
25487
|
-
|
|
25352
|
+
createErrorToolResultBlock({
|
|
25353
|
+
toolUseId: toolUseID,
|
|
25488
25354
|
content: errorMessage,
|
|
25489
|
-
|
|
25490
|
-
|
|
25491
|
-
}
|
|
25355
|
+
errorCode: "INPUT_VALIDATION",
|
|
25356
|
+
errorClass: "soft"
|
|
25357
|
+
})
|
|
25492
25358
|
]);
|
|
25493
25359
|
return;
|
|
25494
25360
|
}
|
|
@@ -25499,12 +25365,12 @@ async function* checkPermissionsAndCallTool(tool, toolUseID, siblingToolUseIDs,
|
|
|
25499
25365
|
);
|
|
25500
25366
|
if (isValidCall?.result === false) {
|
|
25501
25367
|
yield createUserMessage([
|
|
25502
|
-
{
|
|
25503
|
-
|
|
25368
|
+
createErrorToolResultBlock({
|
|
25369
|
+
toolUseId: toolUseID,
|
|
25504
25370
|
content: isValidCall.message,
|
|
25505
|
-
|
|
25506
|
-
|
|
25507
|
-
}
|
|
25371
|
+
errorCode: "INPUT_VALIDATION",
|
|
25372
|
+
errorClass: "soft"
|
|
25373
|
+
})
|
|
25508
25374
|
]);
|
|
25509
25375
|
return;
|
|
25510
25376
|
}
|
|
@@ -25520,12 +25386,12 @@ async function* checkPermissionsAndCallTool(tool, toolUseID, siblingToolUseIDs,
|
|
|
25520
25386
|
});
|
|
25521
25387
|
if (hookOutcome.kind === "block") {
|
|
25522
25388
|
yield createUserMessage([
|
|
25523
|
-
{
|
|
25524
|
-
|
|
25389
|
+
createErrorToolResultBlock({
|
|
25390
|
+
toolUseId: toolUseID,
|
|
25525
25391
|
content: hookOutcome.message,
|
|
25526
|
-
|
|
25527
|
-
|
|
25528
|
-
}
|
|
25392
|
+
errorCode: "HOOK_BLOCKED",
|
|
25393
|
+
errorClass: "soft"
|
|
25394
|
+
})
|
|
25529
25395
|
]);
|
|
25530
25396
|
return;
|
|
25531
25397
|
}
|
|
@@ -25550,12 +25416,12 @@ async function* checkPermissionsAndCallTool(tool, toolUseID, siblingToolUseIDs,
|
|
|
25550
25416
|
const parsed = tool.inputSchema.safeParse(merged);
|
|
25551
25417
|
if (!parsed.success) {
|
|
25552
25418
|
yield createUserMessage([
|
|
25553
|
-
{
|
|
25554
|
-
|
|
25419
|
+
createErrorToolResultBlock({
|
|
25420
|
+
toolUseId: toolUseID,
|
|
25555
25421
|
content: `Hook updatedInput failed validation: ${parsed.error.message}`,
|
|
25556
|
-
|
|
25557
|
-
|
|
25558
|
-
}
|
|
25422
|
+
errorCode: "INPUT_VALIDATION",
|
|
25423
|
+
errorClass: "soft"
|
|
25424
|
+
})
|
|
25559
25425
|
]);
|
|
25560
25426
|
return;
|
|
25561
25427
|
}
|
|
@@ -25566,12 +25432,12 @@ async function* checkPermissionsAndCallTool(tool, toolUseID, siblingToolUseIDs,
|
|
|
25566
25432
|
);
|
|
25567
25433
|
if (isValidUpdate?.result === false) {
|
|
25568
25434
|
yield createUserMessage([
|
|
25569
|
-
{
|
|
25570
|
-
|
|
25435
|
+
createErrorToolResultBlock({
|
|
25436
|
+
toolUseId: toolUseID,
|
|
25571
25437
|
content: isValidUpdate.message,
|
|
25572
|
-
|
|
25573
|
-
|
|
25574
|
-
}
|
|
25438
|
+
errorCode: "INPUT_VALIDATION",
|
|
25439
|
+
errorClass: "soft"
|
|
25440
|
+
})
|
|
25575
25441
|
]);
|
|
25576
25442
|
return;
|
|
25577
25443
|
}
|
|
@@ -25596,12 +25462,12 @@ async function* checkPermissionsAndCallTool(tool, toolUseID, siblingToolUseIDs,
|
|
|
25596
25462
|
);
|
|
25597
25463
|
if (permissionResult.result === false) {
|
|
25598
25464
|
yield createUserMessage([
|
|
25599
|
-
{
|
|
25600
|
-
|
|
25465
|
+
createErrorToolResultBlock({
|
|
25466
|
+
toolUseId: toolUseID,
|
|
25601
25467
|
content: permissionResult.message,
|
|
25602
|
-
|
|
25603
|
-
|
|
25604
|
-
}
|
|
25468
|
+
errorCode: "PERMISSION_DENIED",
|
|
25469
|
+
errorClass: "soft"
|
|
25470
|
+
})
|
|
25605
25471
|
]);
|
|
25606
25472
|
return;
|
|
25607
25473
|
}
|
|
@@ -25688,12 +25554,11 @@ async function* checkPermissionsAndCallTool(tool, toolUseID, siblingToolUseIDs,
|
|
|
25688
25554
|
const content = formatError(error);
|
|
25689
25555
|
logError(error);
|
|
25690
25556
|
yield createUserMessage([
|
|
25691
|
-
{
|
|
25692
|
-
|
|
25557
|
+
createErrorToolResultBlock({
|
|
25558
|
+
toolUseId: toolUseID,
|
|
25693
25559
|
content,
|
|
25694
|
-
|
|
25695
|
-
|
|
25696
|
-
}
|
|
25560
|
+
errorCode: extractErrorCode(error)
|
|
25561
|
+
})
|
|
25697
25562
|
]);
|
|
25698
25563
|
}
|
|
25699
25564
|
}
|
|
@@ -25721,6 +25586,52 @@ function formatError(error) {
|
|
|
25721
25586
|
|
|
25722
25587
|
${end}`;
|
|
25723
25588
|
}
|
|
25589
|
+
var ERROR_CLASS_BY_CODE = {
|
|
25590
|
+
ENOENT: "soft",
|
|
25591
|
+
EISDIR: "soft",
|
|
25592
|
+
EACCES: "retryable",
|
|
25593
|
+
EPERM: "retryable",
|
|
25594
|
+
EMFILE: "retryable",
|
|
25595
|
+
ENFILE: "retryable",
|
|
25596
|
+
EIO: "fatal",
|
|
25597
|
+
ENODEV: "fatal",
|
|
25598
|
+
EBUSY: "fatal"
|
|
25599
|
+
};
|
|
25600
|
+
function extractErrorCode(error) {
|
|
25601
|
+
if (!error || typeof error !== "object") {
|
|
25602
|
+
return void 0;
|
|
25603
|
+
}
|
|
25604
|
+
if ("code" in error && typeof error.code === "string") {
|
|
25605
|
+
return error.code;
|
|
25606
|
+
}
|
|
25607
|
+
return void 0;
|
|
25608
|
+
}
|
|
25609
|
+
function summarizeError(detail) {
|
|
25610
|
+
const line = detail.split("\n").map((part) => part.trim()).find((part) => part.length > 0);
|
|
25611
|
+
const summary = line ?? detail.trim();
|
|
25612
|
+
return summary.length > 200 ? summary.slice(0, 200) : summary;
|
|
25613
|
+
}
|
|
25614
|
+
function getErrorClassFromCode(errorCode) {
|
|
25615
|
+
if (!errorCode) return "soft";
|
|
25616
|
+
return ERROR_CLASS_BY_CODE[errorCode] ?? "soft";
|
|
25617
|
+
}
|
|
25618
|
+
function createErrorToolResultBlock(args) {
|
|
25619
|
+
const detail = typeof args.errorDetail === "string" ? args.errorDetail : typeof args.content === "string" ? args.content : JSON.stringify(args.content);
|
|
25620
|
+
const errorCode = args.errorCode;
|
|
25621
|
+
const errorClass = args.errorClass ?? getErrorClassFromCode(errorCode);
|
|
25622
|
+
const summary = detail ? summarizeError(detail) : "";
|
|
25623
|
+
return {
|
|
25624
|
+
type: "tool_result",
|
|
25625
|
+
content: args.content,
|
|
25626
|
+
is_error: true,
|
|
25627
|
+
tool_use_id: args.toolUseId,
|
|
25628
|
+
error_class: errorClass,
|
|
25629
|
+
...errorCode ? { error_code: errorCode } : {},
|
|
25630
|
+
...summary ? { error_summary: summary } : {},
|
|
25631
|
+
...detail ? { error_detail: detail } : {},
|
|
25632
|
+
...args.rootToolUseId ? { root_tool_use_id: args.rootToolUseId } : {}
|
|
25633
|
+
};
|
|
25634
|
+
}
|
|
25724
25635
|
|
|
25725
25636
|
// src/ui/components/binary-feedback/BinaryFeedback.tsx
|
|
25726
25637
|
import { default as React99, useCallback as useCallback15 } from "react";
|
|
@@ -26764,7 +26675,6 @@ function getCoreTools() {
|
|
|
26764
26675
|
{ name: "LS", description: "List directory contents" },
|
|
26765
26676
|
{ name: "WebFetch", description: "Fetch web content" },
|
|
26766
26677
|
{ name: "WebSearch", description: "Search the web" },
|
|
26767
|
-
{ name: "Batch", description: "Execute multiple tool calls in parallel" },
|
|
26768
26678
|
{ name: "TodoWrite", description: "Manage task lists" }
|
|
26769
26679
|
];
|
|
26770
26680
|
return tools.filter((t) => t.name !== "Task" && t.name !== "ExitPlanMode");
|
|
@@ -26800,7 +26710,7 @@ import { homedir as homedir7 } from "os";
|
|
|
26800
26710
|
// src/commands/agents/generation.ts
|
|
26801
26711
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
26802
26712
|
async function generateAgentWithClaude(prompt) {
|
|
26803
|
-
const { queryModel } = await import("./llm-
|
|
26713
|
+
const { queryModel } = await import("./llm-LYDFVXMB.js");
|
|
26804
26714
|
const systemPrompt = `You are an expert at creating AI agent configurations. Based on the user's description, generate a specialized agent configuration.
|
|
26805
26715
|
|
|
26806
26716
|
Return your response as a JSON object with exactly these fields:
|
|
@@ -27096,12 +27006,6 @@ var COLOR_OPTIONS = [
|
|
|
27096
27006
|
"pink",
|
|
27097
27007
|
"cyan"
|
|
27098
27008
|
];
|
|
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
27009
|
function openInEditor(filePath) {
|
|
27106
27010
|
return new Promise((resolve11, reject) => {
|
|
27107
27011
|
const platform = process.platform;
|
|
@@ -27712,7 +27616,8 @@ function ToolPicker(props) {
|
|
|
27712
27616
|
});
|
|
27713
27617
|
};
|
|
27714
27618
|
const complete = () => {
|
|
27715
|
-
|
|
27619
|
+
const next = selected.length === allToolNames.length && allToolNames.every((n) => selected.includes(n)) ? void 0 : selected;
|
|
27620
|
+
props.onComplete(next);
|
|
27716
27621
|
};
|
|
27717
27622
|
const categorized = useMemo25(() => {
|
|
27718
27623
|
const readOnly = /* @__PURE__ */ new Set(["Read", "Glob", "Grep", "LS"]);
|
|
@@ -30800,17 +30705,10 @@ It is critical that you mark todos as completed as soon as you are done with a t
|
|
|
30800
30705
|
1. **Modification Check**: Before editing, you MUST verify if the change is already present (e.g. use \`grep\` or \`read\`).
|
|
30801
30706
|
2. **Precise Targeting**: For code injection, prefer using LSP to find exact function boundaries, or Read the file to get unique context.
|
|
30802
30707
|
3. **Artifact Verification**: After completing a complex task, verify the artifacts (e.g. check if files exist using \`ls\`).
|
|
30803
|
-
4. **LSP Instinct**: Before modifying any code, you MUST use \`
|
|
30804
|
-
5. **Atomic Verification**: When editing code, especially in critical or complex files, you should strongly consider setting \`verify: true\` in the \`
|
|
30805
|
-
6. **Semantic Search**: When searching for code concepts (e.g. "AuthLogic", "UserHandler") rather than exact filenames, prefer using \`
|
|
30806
|
-
7. **Reference Guard**: Be aware that deleting files might be blocked if they are referenced elsewhere. If the \`
|
|
30807
|
-
|
|
30808
|
-
# Index Tree First Strategy
|
|
30809
|
-
- Every analysis must be grounded in a verifiable index tree; avoid blind matching
|
|
30810
|
-
- Build the tree in layers: Root \u2192 Core Directories \u2192 Secondary Modules
|
|
30811
|
-
- Use LS to map layers, then confirm with Glob before Grep/Read
|
|
30812
|
-
- Treat truncated trees as hints only, not for precise paths
|
|
30813
|
-
- Use the tree to narrow scope, then locate exact files and symbols
|
|
30708
|
+
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.
|
|
30709
|
+
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.
|
|
30710
|
+
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.
|
|
30711
|
+
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.
|
|
30814
30712
|
|
|
30815
30713
|
# LSP \u540E\u7F6E\u4E0E\u8303\u56F4\u9650\u5236
|
|
30816
30714
|
- \u4F18\u5148\u987A\u5E8F\uFF1A\u7ED3\u6784\u6811 -> \u70ED\u70B9\u5B9A\u4F4D -> Read -> LSP
|
|
@@ -30930,11 +30828,10 @@ NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTAN
|
|
|
30930
30828
|
|
|
30931
30829
|
# Cognitive Search Strategy
|
|
30932
30830
|
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.
|
|
30933
|
-
- Example: \`
|
|
30934
|
-
- Example: \`
|
|
30831
|
+
- Example: \`GrepTool(pattern: "AuthFeatr", semantic: true)\` will find "AuthFeature".
|
|
30832
|
+
- Example: \`GlobTool(pattern: "tests", semantic: true)\` will find test files based on project structure.
|
|
30935
30833
|
2. **Exact Identifier**: WHEN you know the precise class/function name (e.g., "UserProfile", "initDatabase"), use standard Grep/Glob without \`semantic\` flag.
|
|
30936
30834
|
3. **Exploration**: If standard search returns 0 results, AUTOMATICALLY retry with \`semantic: true\`.
|
|
30937
|
-
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.
|
|
30938
30835
|
|
|
30939
30836
|
# File Modification Strategy (The Universal Edit Tool)
|
|
30940
30837
|
When you need to modify files, rely on the **Edit Tool** for almost all tasks.
|
|
@@ -30951,7 +30848,7 @@ When you need to modify files, rely on the **Edit Tool** for almost all tasks.
|
|
|
30951
30848
|
|
|
30952
30849
|
# Cognitive Safety & Verification
|
|
30953
30850
|
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.
|
|
30954
|
-
2. **Precise Targeting**: For code injection, prefer using LSP (\`
|
|
30851
|
+
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.
|
|
30955
30852
|
3. **Artifact Verification**: After completing a complex task, verify the artifacts (e.g. check if files exist using \`ls\`, or content matches using \`grep\`).
|
|
30956
30853
|
|
|
30957
30854
|
${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"}
|
|
@@ -30965,12 +30862,11 @@ IMPORTANT: Before you begin work, think about what the code you're editing is su
|
|
|
30965
30862
|
async function getEnvInfo() {
|
|
30966
30863
|
const isGit = await getIsGit();
|
|
30967
30864
|
return `Here is useful information about the environment you are running in:
|
|
30968
|
-
|
|
30969
30865
|
<env>
|
|
30970
|
-
Today's date: ${(/* @__PURE__ */ new Date()).toLocaleDateString()}
|
|
30971
|
-
Platform: ${env.platform}
|
|
30972
30866
|
Working directory: ${getCwd()}
|
|
30973
30867
|
Is directory a git repo: ${isGit ? "Yes" : "No"}
|
|
30868
|
+
Platform: ${env.platform}
|
|
30869
|
+
Today's date: ${(/* @__PURE__ */ new Date()).toLocaleDateString()}
|
|
30974
30870
|
</env>`;
|
|
30975
30871
|
}
|
|
30976
30872
|
async function getAgentPrompt() {
|
|
@@ -31030,9 +30926,6 @@ export {
|
|
|
31030
30926
|
addToHistory,
|
|
31031
30927
|
countTokens,
|
|
31032
30928
|
__isToolUseLikeBlockForTests,
|
|
31033
|
-
__autoBatchToolUseBlocksForTests,
|
|
31034
|
-
__applyAutoBatchAggregationForTests,
|
|
31035
|
-
__rewriteToolUseBlocksForTests,
|
|
31036
30929
|
__ToolUseQueueForTests,
|
|
31037
30930
|
query,
|
|
31038
30931
|
runToolUse,
|