pybao-cli 1.4.79 → 1.4.81
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-WXPYXBW2.js +46 -0
- package/dist/{acp-LFAZWNAU.js → acp-YXMNP56B.js} +29 -29
- package/dist/{agentsValidate-VAKP37AV.js → agentsValidate-LQFWOCPZ.js} +7 -9
- package/dist/agentsValidate-LQFWOCPZ.js.map +7 -0
- package/dist/{ask-DVWLMETD.js → ask-CUR6IJ2W.js} +28 -28
- package/dist/{autoUpdater-ZONSGWDV.js → autoUpdater-DEH233RT.js} +3 -3
- package/dist/{chunk-XCLIPMK2.js → chunk-2NFKKANF.js} +2 -2
- package/dist/{chunk-QCQKQYHB.js → chunk-37ZXN5M4.js} +1 -1
- package/dist/{chunk-UVWCNMNT.js → chunk-4NNDWUSZ.js} +2 -2
- package/dist/{chunk-YAB2P7Z6.js → chunk-4SWM6FWR.js} +2 -2
- package/dist/{chunk-O5YYU7UE.js → chunk-4VUECEM6.js} +2 -2
- package/dist/{chunk-RP7S6VRQ.js → chunk-5KAIY3II.js} +3 -3
- package/dist/{chunk-PGJGFV3X.js → chunk-6XINCIUI.js} +1 -1
- package/dist/{chunk-HMBKKXU6.js → chunk-7ANXEZRS.js} +3 -3
- package/dist/{chunk-3W3REVMM.js → chunk-AB3F7T5N.js} +3 -3
- package/dist/{chunk-APJZFS3A.js → chunk-B3NR3UMC.js} +4 -4
- package/dist/{chunk-MQRP4UNR.js → chunk-BJMVIICS.js} +4 -4
- package/dist/{chunk-PKYY4R5O.js → chunk-BX6HNPWQ.js} +3 -3
- package/dist/{chunk-6MCCU5HD.js → chunk-CCF52HVZ.js} +1 -1
- package/dist/{chunk-6MCCU5HD.js.map → chunk-CCF52HVZ.js.map} +1 -1
- package/dist/{chunk-T37A6AUP.js → chunk-CLGB56HY.js} +4 -4
- package/dist/{chunk-T37A6AUP.js.map → chunk-CLGB56HY.js.map} +2 -2
- package/dist/{chunk-O22YUF2L.js → chunk-EYY3QDKX.js} +2 -2
- package/dist/{chunk-YBEEF7QI.js → chunk-FDGIVQNE.js} +1 -1
- package/dist/{chunk-MWRFRW2T.js → chunk-GMKASRN7.js} +1 -1
- package/dist/{chunk-VBMEUTXH.js → chunk-GS4PRJHV.js} +4 -4
- package/dist/{chunk-IPP5A2AQ.js → chunk-H44O47XJ.js} +1 -1
- package/dist/{chunk-OAE4H4IJ.js → chunk-HIZXCXUG.js} +4 -4
- package/dist/{chunk-2MX4EYNA.js → chunk-HNHWG52B.js} +1 -1
- package/dist/{chunk-3VR4CRJ4.js → chunk-JVF6KNE3.js} +1 -1
- package/dist/{chunk-IOBCYL3L.js → chunk-KH3U5BR5.js} +3 -3
- package/dist/{chunk-H4KSNG7W.js → chunk-MKNRYFQR.js} +2 -2
- package/dist/{chunk-WTVPYBKC.js → chunk-PRRYL2E2.js} +16 -22
- package/dist/chunk-PRRYL2E2.js.map +7 -0
- package/dist/{chunk-S54ET2XN.js → chunk-TVUG5GLX.js} +665 -1333
- package/dist/{chunk-S54ET2XN.js.map → chunk-TVUG5GLX.js.map} +4 -4
- package/dist/{chunk-3LSW3TMW.js → chunk-UUS77RPP.js} +5 -25
- package/dist/chunk-UUS77RPP.js.map +7 -0
- package/dist/{chunk-CFH53NUP.js → chunk-VW3NZKCP.js} +1 -1
- package/dist/{chunk-X3JZNSZK.js → chunk-Z73SPR4B.js} +3 -3
- package/dist/{chunk-OI65UMMM.js → chunk-ZE75JZFY.js} +3 -3
- package/dist/{cli-7KBVIN3R.js → cli-VNT2RTPP.js} +87 -87
- package/dist/commands-LAZD5O4M.js +50 -0
- package/dist/{config-UMAGXL7E.js → config-VK55G2IB.js} +4 -4
- package/dist/{context-UFPZGQRP.js → context-QHTEENJ6.js} +6 -6
- package/dist/{customCommands-3ZSM7UHN.js → customCommands-HRHE7ZIM.js} +4 -4
- package/dist/{env-FUWEP475.js → env-GGYUE5V7.js} +2 -2
- package/dist/{file-DOL32HV4.js → file-KHYC624L.js} +4 -4
- package/dist/index.js +3 -3
- package/dist/{llm-47NQPJBY.js → llm-A3S75CLF.js} +29 -29
- package/dist/{llmLazy-KN2P4WFX.js → llmLazy-USVVGSVL.js} +1 -1
- package/dist/{loader-3Q4S43I6.js → loader-JPKYTFFC.js} +4 -4
- package/dist/{lsp-NFGTJCU5.js → lsp-B7QJVI2U.js} +6 -6
- package/dist/{lspAnchor-F47HITWT.js → lspAnchor-JJJ2WKI7.js} +6 -6
- package/dist/{mcp-5NCHVDZ6.js → mcp-YOR7UMEZ.js} +7 -7
- package/dist/{mentionProcessor-ANECUK7D.js → mentionProcessor-5CYA4NR4.js} +5 -5
- package/dist/{messages-5L3AW7OV.js → messages-ICKAWGUW.js} +1 -1
- package/dist/{model-GFRJS7ZB.js → model-P33QONA2.js} +5 -5
- package/dist/{openai-2TQXBY5Z.js → openai-POLCH476.js} +5 -5
- package/dist/{outputStyles-GNA2ZNUQ.js → outputStyles-EZGCOEE2.js} +4 -4
- package/dist/{pluginRuntime-GX2IALNV.js → pluginRuntime-KJ3YFO2O.js} +6 -6
- package/dist/{pluginValidation-MIJ2CBAD.js → pluginValidation-MR5GV7PL.js} +6 -6
- package/dist/prompts-P4JU57HZ.js +52 -0
- package/dist/{pybAgentSessionLoad-REO2PT44.js → pybAgentSessionLoad-TRSWA62U.js} +4 -4
- package/dist/{pybAgentSessionResume-PDCQVVYN.js → pybAgentSessionResume-3IRNTCVI.js} +4 -4
- package/dist/{pybAgentStreamJsonSession-TIT6LIJI.js → pybAgentStreamJsonSession-5IBYEXS5.js} +1 -1
- package/dist/{pybHooks-IMBRLFTP.js → pybHooks-HFAKEYDS.js} +4 -4
- package/dist/query-NHQFKSCC.js +54 -0
- package/dist/{registry-GTSSEC4J.js → registry-LOKL3JBE.js} +5 -5
- package/dist/{ripgrep-4EY5IP33.js → ripgrep-X4LOQHA7.js} +3 -3
- package/dist/{skillMarketplace-PM7FTQJ2.js → skillMarketplace-UITGQNZD.js} +3 -3
- package/dist/{state-3QNGKL6Z.js → state-I7LIGIFJ.js} +2 -2
- package/dist/{theme-LTCVN7SH.js → theme-RVIXXPSQ.js} +5 -5
- package/dist/{toolPermissionSettings-WMLU2QLS.js → toolPermissionSettings-TALALPH3.js} +6 -6
- package/dist/tools-HVGZBEHZ.js +51 -0
- package/dist/{userInput-VTW67UPI.js → userInput-WFPUGJ4L.js} +30 -30
- package/package.json +1 -1
- package/dist/REPL-FITDCCKL.js +0 -46
- package/dist/agentsValidate-VAKP37AV.js.map +0 -7
- package/dist/chunk-3LSW3TMW.js.map +0 -7
- package/dist/chunk-WTVPYBKC.js.map +0 -7
- package/dist/commands-7H5ABX36.js +0 -50
- package/dist/prompts-S7DXNYXT.js +0 -52
- package/dist/query-2F5RTZ3R.js +0 -54
- package/dist/tools-D5VDYMRE.js +0 -51
- /package/dist/{REPL-FITDCCKL.js.map → REPL-WXPYXBW2.js.map} +0 -0
- /package/dist/{acp-LFAZWNAU.js.map → acp-YXMNP56B.js.map} +0 -0
- /package/dist/{ask-DVWLMETD.js.map → ask-CUR6IJ2W.js.map} +0 -0
- /package/dist/{autoUpdater-ZONSGWDV.js.map → autoUpdater-DEH233RT.js.map} +0 -0
- /package/dist/{chunk-XCLIPMK2.js.map → chunk-2NFKKANF.js.map} +0 -0
- /package/dist/{chunk-QCQKQYHB.js.map → chunk-37ZXN5M4.js.map} +0 -0
- /package/dist/{chunk-UVWCNMNT.js.map → chunk-4NNDWUSZ.js.map} +0 -0
- /package/dist/{chunk-YAB2P7Z6.js.map → chunk-4SWM6FWR.js.map} +0 -0
- /package/dist/{chunk-O5YYU7UE.js.map → chunk-4VUECEM6.js.map} +0 -0
- /package/dist/{chunk-RP7S6VRQ.js.map → chunk-5KAIY3II.js.map} +0 -0
- /package/dist/{chunk-PGJGFV3X.js.map → chunk-6XINCIUI.js.map} +0 -0
- /package/dist/{chunk-HMBKKXU6.js.map → chunk-7ANXEZRS.js.map} +0 -0
- /package/dist/{chunk-3W3REVMM.js.map → chunk-AB3F7T5N.js.map} +0 -0
- /package/dist/{chunk-APJZFS3A.js.map → chunk-B3NR3UMC.js.map} +0 -0
- /package/dist/{chunk-MQRP4UNR.js.map → chunk-BJMVIICS.js.map} +0 -0
- /package/dist/{chunk-PKYY4R5O.js.map → chunk-BX6HNPWQ.js.map} +0 -0
- /package/dist/{chunk-O22YUF2L.js.map → chunk-EYY3QDKX.js.map} +0 -0
- /package/dist/{chunk-YBEEF7QI.js.map → chunk-FDGIVQNE.js.map} +0 -0
- /package/dist/{chunk-MWRFRW2T.js.map → chunk-GMKASRN7.js.map} +0 -0
- /package/dist/{chunk-VBMEUTXH.js.map → chunk-GS4PRJHV.js.map} +0 -0
- /package/dist/{chunk-IPP5A2AQ.js.map → chunk-H44O47XJ.js.map} +0 -0
- /package/dist/{chunk-OAE4H4IJ.js.map → chunk-HIZXCXUG.js.map} +0 -0
- /package/dist/{chunk-2MX4EYNA.js.map → chunk-HNHWG52B.js.map} +0 -0
- /package/dist/{chunk-3VR4CRJ4.js.map → chunk-JVF6KNE3.js.map} +0 -0
- /package/dist/{chunk-IOBCYL3L.js.map → chunk-KH3U5BR5.js.map} +0 -0
- /package/dist/{chunk-H4KSNG7W.js.map → chunk-MKNRYFQR.js.map} +0 -0
- /package/dist/{chunk-CFH53NUP.js.map → chunk-VW3NZKCP.js.map} +0 -0
- /package/dist/{chunk-X3JZNSZK.js.map → chunk-Z73SPR4B.js.map} +0 -0
- /package/dist/{chunk-OI65UMMM.js.map → chunk-ZE75JZFY.js.map} +0 -0
- /package/dist/{cli-7KBVIN3R.js.map → cli-VNT2RTPP.js.map} +0 -0
- /package/dist/{commands-7H5ABX36.js.map → commands-LAZD5O4M.js.map} +0 -0
- /package/dist/{config-UMAGXL7E.js.map → config-VK55G2IB.js.map} +0 -0
- /package/dist/{context-UFPZGQRP.js.map → context-QHTEENJ6.js.map} +0 -0
- /package/dist/{customCommands-3ZSM7UHN.js.map → customCommands-HRHE7ZIM.js.map} +0 -0
- /package/dist/{env-FUWEP475.js.map → env-GGYUE5V7.js.map} +0 -0
- /package/dist/{file-DOL32HV4.js.map → file-KHYC624L.js.map} +0 -0
- /package/dist/{llm-47NQPJBY.js.map → llm-A3S75CLF.js.map} +0 -0
- /package/dist/{llmLazy-KN2P4WFX.js.map → llmLazy-USVVGSVL.js.map} +0 -0
- /package/dist/{loader-3Q4S43I6.js.map → loader-JPKYTFFC.js.map} +0 -0
- /package/dist/{lsp-NFGTJCU5.js.map → lsp-B7QJVI2U.js.map} +0 -0
- /package/dist/{lspAnchor-F47HITWT.js.map → lspAnchor-JJJ2WKI7.js.map} +0 -0
- /package/dist/{mcp-5NCHVDZ6.js.map → mcp-YOR7UMEZ.js.map} +0 -0
- /package/dist/{mentionProcessor-ANECUK7D.js.map → mentionProcessor-5CYA4NR4.js.map} +0 -0
- /package/dist/{messages-5L3AW7OV.js.map → messages-ICKAWGUW.js.map} +0 -0
- /package/dist/{model-GFRJS7ZB.js.map → model-P33QONA2.js.map} +0 -0
- /package/dist/{openai-2TQXBY5Z.js.map → openai-POLCH476.js.map} +0 -0
- /package/dist/{outputStyles-GNA2ZNUQ.js.map → outputStyles-EZGCOEE2.js.map} +0 -0
- /package/dist/{pluginRuntime-GX2IALNV.js.map → pluginRuntime-KJ3YFO2O.js.map} +0 -0
- /package/dist/{pluginValidation-MIJ2CBAD.js.map → pluginValidation-MR5GV7PL.js.map} +0 -0
- /package/dist/{prompts-S7DXNYXT.js.map → prompts-P4JU57HZ.js.map} +0 -0
- /package/dist/{pybAgentSessionLoad-REO2PT44.js.map → pybAgentSessionLoad-TRSWA62U.js.map} +0 -0
- /package/dist/{pybAgentSessionResume-PDCQVVYN.js.map → pybAgentSessionResume-3IRNTCVI.js.map} +0 -0
- /package/dist/{pybAgentStreamJsonSession-TIT6LIJI.js.map → pybAgentStreamJsonSession-5IBYEXS5.js.map} +0 -0
- /package/dist/{pybHooks-IMBRLFTP.js.map → pybHooks-HFAKEYDS.js.map} +0 -0
- /package/dist/{query-2F5RTZ3R.js.map → query-NHQFKSCC.js.map} +0 -0
- /package/dist/{registry-GTSSEC4J.js.map → registry-LOKL3JBE.js.map} +0 -0
- /package/dist/{ripgrep-4EY5IP33.js.map → ripgrep-X4LOQHA7.js.map} +0 -0
- /package/dist/{skillMarketplace-PM7FTQJ2.js.map → skillMarketplace-UITGQNZD.js.map} +0 -0
- /package/dist/{state-3QNGKL6Z.js.map → state-I7LIGIFJ.js.map} +0 -0
- /package/dist/{theme-LTCVN7SH.js.map → theme-RVIXXPSQ.js.map} +0 -0
- /package/dist/{toolPermissionSettings-WMLU2QLS.js.map → toolPermissionSettings-TALALPH3.js.map} +0 -0
- /package/dist/{tools-D5VDYMRE.js.map → tools-HVGZBEHZ.js.map} +0 -0
- /package/dist/{userInput-VTW67UPI.js.map → userInput-WFPUGJ4L.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-7ANXEZRS.js";
|
|
7
7
|
import {
|
|
8
8
|
loadPybAgentSessionMessages
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-FDGIVQNE.js";
|
|
10
10
|
import {
|
|
11
11
|
listPybAgentSessions
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-VW3NZKCP.js";
|
|
13
13
|
import {
|
|
14
14
|
appendSessionCustomTitleRecord,
|
|
15
15
|
appendSessionJsonlFromMessage,
|
|
16
16
|
appendSessionTagRecord
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-4NNDWUSZ.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-KH3U5BR5.js";
|
|
30
30
|
import {
|
|
31
31
|
DEFAULT_OUTPUT_STYLE,
|
|
32
32
|
getAvailableOutputStyles,
|
|
@@ -35,17 +35,17 @@ import {
|
|
|
35
35
|
getOutputStyleSystemPromptAdditions,
|
|
36
36
|
resolveOutputStyleName,
|
|
37
37
|
setCurrentOutputStyle
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-4VUECEM6.js";
|
|
39
39
|
import {
|
|
40
40
|
fetchCustomModels,
|
|
41
41
|
getModelFeatures,
|
|
42
42
|
getSessionState
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-MKNRYFQR.js";
|
|
44
44
|
import {
|
|
45
45
|
queryLLM,
|
|
46
46
|
queryQuick,
|
|
47
47
|
verifyApiKey
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-BJMVIICS.js";
|
|
49
49
|
import {
|
|
50
50
|
DEFAULT_TIMEOUT_MS,
|
|
51
51
|
FallbackToolUseRejectedMessage,
|
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
listMCPServers,
|
|
60
60
|
loadMergedSettings,
|
|
61
61
|
normalizeSandboxRuntimeConfigFromSettings
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-HIZXCXUG.js";
|
|
63
63
|
import {
|
|
64
64
|
addMarketplace,
|
|
65
65
|
disableSkillPlugin,
|
|
@@ -72,11 +72,11 @@ import {
|
|
|
72
72
|
refreshMarketplaceAsync,
|
|
73
73
|
removeMarketplace,
|
|
74
74
|
uninstallSkillPlugin
|
|
75
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-HNHWG52B.js";
|
|
76
76
|
import {
|
|
77
77
|
loadToolPermissionContextFromDisk,
|
|
78
78
|
persistToolPermissionUpdateToDisk
|
|
79
|
-
} from "./chunk-
|
|
79
|
+
} from "./chunk-BX6HNPWQ.js";
|
|
80
80
|
import {
|
|
81
81
|
applyToolPermissionContextUpdate,
|
|
82
82
|
applyToolPermissionContextUpdates,
|
|
@@ -87,13 +87,13 @@ import {
|
|
|
87
87
|
generateSystemReminders,
|
|
88
88
|
resetReminderSession,
|
|
89
89
|
systemReminderService
|
|
90
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-2NFKKANF.js";
|
|
91
91
|
import {
|
|
92
92
|
clearAgentCache,
|
|
93
93
|
getActiveAgents,
|
|
94
94
|
getAgentByType,
|
|
95
95
|
getAllAgents
|
|
96
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-CLGB56HY.js";
|
|
97
97
|
import {
|
|
98
98
|
API_ERROR_MESSAGE_PREFIX,
|
|
99
99
|
CANCEL_MESSAGE,
|
|
@@ -124,7 +124,7 @@ import {
|
|
|
124
124
|
processUserInput,
|
|
125
125
|
reorderMessages,
|
|
126
126
|
stripSystemMessages
|
|
127
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-H44O47XJ.js";
|
|
128
128
|
import {
|
|
129
129
|
getRequestStatus,
|
|
130
130
|
setRequestStatus,
|
|
@@ -154,7 +154,7 @@ import {
|
|
|
154
154
|
normalizeFilePath,
|
|
155
155
|
readTextContent,
|
|
156
156
|
writeTextContent
|
|
157
|
-
} from "./chunk-
|
|
157
|
+
} from "./chunk-EYY3QDKX.js";
|
|
158
158
|
import {
|
|
159
159
|
parseBlockEdits
|
|
160
160
|
} from "./chunk-QWIBSCDN.js";
|
|
@@ -164,18 +164,18 @@ import {
|
|
|
164
164
|
ParserRegistry,
|
|
165
165
|
initParser,
|
|
166
166
|
loadLanguage
|
|
167
|
-
} from "./chunk-
|
|
167
|
+
} from "./chunk-GS4PRJHV.js";
|
|
168
168
|
import {
|
|
169
169
|
getSettingsFileCandidates,
|
|
170
170
|
loadSettingsWithLegacyFallback,
|
|
171
171
|
readSettingsFile
|
|
172
|
-
} from "./chunk-
|
|
172
|
+
} from "./chunk-JVF6KNE3.js";
|
|
173
173
|
import {
|
|
174
174
|
getCustomCommandDirectories,
|
|
175
175
|
hasCustomCommands,
|
|
176
176
|
loadCustomCommands,
|
|
177
177
|
reloadCustomCommands
|
|
178
|
-
} from "./chunk-
|
|
178
|
+
} from "./chunk-4SWM6FWR.js";
|
|
179
179
|
import {
|
|
180
180
|
getSessionPlugins
|
|
181
181
|
} from "./chunk-BJSWTHRM.js";
|
|
@@ -183,7 +183,7 @@ import {
|
|
|
183
183
|
ModelManager,
|
|
184
184
|
getModelManager,
|
|
185
185
|
isDefaultSlowAndCapableModel
|
|
186
|
-
} from "./chunk-
|
|
186
|
+
} from "./chunk-Z73SPR4B.js";
|
|
187
187
|
import {
|
|
188
188
|
getCodeStyle,
|
|
189
189
|
getContext,
|
|
@@ -191,13 +191,13 @@ import {
|
|
|
191
191
|
getIsGit,
|
|
192
192
|
getProjectDocs,
|
|
193
193
|
getProjectStructureStatisticsBlock
|
|
194
|
-
} from "./chunk-
|
|
194
|
+
} from "./chunk-B3NR3UMC.js";
|
|
195
195
|
import {
|
|
196
196
|
ripGrep
|
|
197
|
-
} from "./chunk-
|
|
197
|
+
} from "./chunk-37ZXN5M4.js";
|
|
198
198
|
import {
|
|
199
199
|
getTheme
|
|
200
|
-
} from "./chunk-
|
|
200
|
+
} from "./chunk-GMKASRN7.js";
|
|
201
201
|
import {
|
|
202
202
|
DEFAULT_GLOBAL_CONFIG,
|
|
203
203
|
enableConfigs,
|
|
@@ -210,7 +210,7 @@ import {
|
|
|
210
210
|
saveGlobalConfig,
|
|
211
211
|
setAllPointersToModel,
|
|
212
212
|
setModelPointer
|
|
213
|
-
} from "./chunk-
|
|
213
|
+
} from "./chunk-ZE75JZFY.js";
|
|
214
214
|
import {
|
|
215
215
|
AbortError
|
|
216
216
|
} from "./chunk-RQVLBMP7.js";
|
|
@@ -219,7 +219,7 @@ import {
|
|
|
219
219
|
getCurrentRequest,
|
|
220
220
|
logUserFriendly,
|
|
221
221
|
markPhase
|
|
222
|
-
} from "./chunk-
|
|
222
|
+
} from "./chunk-6XINCIUI.js";
|
|
223
223
|
import {
|
|
224
224
|
ASCII_LOGO,
|
|
225
225
|
BunShell,
|
|
@@ -231,7 +231,6 @@ import {
|
|
|
231
231
|
SESSION_ID,
|
|
232
232
|
captureException,
|
|
233
233
|
dateToFilename,
|
|
234
|
-
enterPlanMode,
|
|
235
234
|
enterPlanModeForConversationKey,
|
|
236
235
|
env,
|
|
237
236
|
execFileNoThrow,
|
|
@@ -252,7 +251,6 @@ import {
|
|
|
252
251
|
isMainPlanFilePathForActiveConversation,
|
|
253
252
|
logError,
|
|
254
253
|
overwriteLog,
|
|
255
|
-
readPlanFile,
|
|
256
254
|
renderBackgroundShellStatusAttachment,
|
|
257
255
|
renderBashNotification,
|
|
258
256
|
resolveXdgDataPath,
|
|
@@ -260,10 +258,10 @@ import {
|
|
|
260
258
|
setCwd,
|
|
261
259
|
shouldApplyToolOutputTruncation,
|
|
262
260
|
truncateToolOutput
|
|
263
|
-
} from "./chunk-
|
|
261
|
+
} from "./chunk-UUS77RPP.js";
|
|
264
262
|
import {
|
|
265
263
|
MACRO
|
|
266
|
-
} from "./chunk-
|
|
264
|
+
} from "./chunk-CCF52HVZ.js";
|
|
267
265
|
import {
|
|
268
266
|
__export
|
|
269
267
|
} from "./chunk-I3J4JYES.js";
|
|
@@ -272,8 +270,8 @@ import {
|
|
|
272
270
|
import { statSync as statSync13 } from "fs";
|
|
273
271
|
import { EOL as EOL3 } from "os";
|
|
274
272
|
import { isAbsolute as isAbsolute8, relative as relative12, resolve as resolve10 } from "path";
|
|
275
|
-
import * as
|
|
276
|
-
import { z as
|
|
273
|
+
import * as React106 from "react";
|
|
274
|
+
import { z as z13 } from "zod";
|
|
277
275
|
|
|
278
276
|
// src/utils/commands/index.ts
|
|
279
277
|
import { memoize } from "lodash-es";
|
|
@@ -444,7 +442,7 @@ var getCommandSubcommandPrefix = memoize(
|
|
|
444
442
|
var getCommandPrefix = memoize(
|
|
445
443
|
async (command4, abortSignal) => {
|
|
446
444
|
const { systemPrompt, userPrompt } = buildBashCommandPrefixDetectionPrompt(command4);
|
|
447
|
-
const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryQuick: queryQuick2 } = await import("./llm-
|
|
445
|
+
const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryQuick: queryQuick2 } = await import("./llm-A3S75CLF.js");
|
|
448
446
|
const response = await queryQuick2({
|
|
449
447
|
systemPrompt,
|
|
450
448
|
userPrompt,
|
|
@@ -4246,7 +4244,7 @@ function formatParseError(error) {
|
|
|
4246
4244
|
return error instanceof Error ? error.message : String(error);
|
|
4247
4245
|
}
|
|
4248
4246
|
async function defaultGateQuery(args) {
|
|
4249
|
-
const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryLLM: queryLLM2 } = await import("./llm-
|
|
4247
|
+
const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryLLM: queryLLM2 } = await import("./llm-A3S75CLF.js");
|
|
4250
4248
|
const queryLLMFn = args.queryLLMOverride ?? queryLLM2;
|
|
4251
4249
|
const messages = [
|
|
4252
4250
|
{
|
|
@@ -5265,8 +5263,8 @@ ${formatted}`;
|
|
|
5265
5263
|
};
|
|
5266
5264
|
|
|
5267
5265
|
// src/ui/components/permissions/web-fetch-permission-request/WebFetchPermissionRequest.tsx
|
|
5268
|
-
import { Box as
|
|
5269
|
-
import
|
|
5266
|
+
import { Box as Box76, Text as Text80, useInput as useInput29 } from "ink";
|
|
5267
|
+
import React105, { useMemo as useMemo27 } from "react";
|
|
5270
5268
|
import chalk16 from "chalk";
|
|
5271
5269
|
|
|
5272
5270
|
// src/ui/components/custom-select/select.tsx
|
|
@@ -6643,7 +6641,7 @@ var FileEditTool = {
|
|
|
6643
6641
|
const originalFileContent = currentFileContent;
|
|
6644
6642
|
let totalPatch = [];
|
|
6645
6643
|
const { SmartEdit } = await import("./smart-edit-AWHJDSU6.js");
|
|
6646
|
-
const { findLspAnchor } = await import("./lspAnchor-
|
|
6644
|
+
const { findLspAnchor } = await import("./lspAnchor-JJJ2WKI7.js");
|
|
6647
6645
|
for (const op of editOperations) {
|
|
6648
6646
|
const normalizedSearch = normalizeLineEndings(op.search);
|
|
6649
6647
|
const normalizedReplace = normalizeLineEndings(op.replace);
|
|
@@ -8977,8 +8975,8 @@ var WebSearchTool = {
|
|
|
8977
8975
|
};
|
|
8978
8976
|
|
|
8979
8977
|
// src/tools/interaction/SlashCommandTool/SlashCommandTool.tsx
|
|
8980
|
-
import { z as
|
|
8981
|
-
import * as
|
|
8978
|
+
import { z as z11 } from "zod";
|
|
8979
|
+
import * as React103 from "react";
|
|
8982
8980
|
|
|
8983
8981
|
// src/ui/components/Bug.tsx
|
|
8984
8982
|
import { Box as Box17, Text as Text19, useInput as useInput5 } from "ink";
|
|
@@ -11347,7 +11345,7 @@ async function createAndStoreApiKey(accessToken) {
|
|
|
11347
11345
|
}
|
|
11348
11346
|
saveGlobalConfig(config2);
|
|
11349
11347
|
try {
|
|
11350
|
-
const { resetAnthropicClient } = await import("./llm-
|
|
11348
|
+
const { resetAnthropicClient } = await import("./llm-A3S75CLF.js");
|
|
11351
11349
|
resetAnthropicClient();
|
|
11352
11350
|
} catch {
|
|
11353
11351
|
}
|
|
@@ -15714,7 +15712,7 @@ async function refreshPluginRuntimeFromInstalls() {
|
|
|
15714
15712
|
const existingRoots = getSessionPlugins().map((p) => p.rootDir);
|
|
15715
15713
|
const dirs = Array.from(/* @__PURE__ */ new Set([...existingRoots, ...installedRoots]));
|
|
15716
15714
|
if (dirs.length === 0) return [];
|
|
15717
|
-
const { configureSessionPlugins } = await import("./pluginRuntime-
|
|
15715
|
+
const { configureSessionPlugins } = await import("./pluginRuntime-KJ3YFO2O.js");
|
|
15718
15716
|
const { errors } = await configureSessionPlugins({ pluginDirs: dirs });
|
|
15719
15717
|
return errors;
|
|
15720
15718
|
}
|
|
@@ -16383,7 +16381,7 @@ async function call(onDone, context) {
|
|
|
16383
16381
|
ModelConfig,
|
|
16384
16382
|
{
|
|
16385
16383
|
onClose: () => {
|
|
16386
|
-
import("./model-
|
|
16384
|
+
import("./model-P33QONA2.js").then(({ reloadModelManager: reloadModelManager2 }) => {
|
|
16387
16385
|
reloadModelManager2();
|
|
16388
16386
|
triggerModelConfigChange();
|
|
16389
16387
|
onDone();
|
|
@@ -17517,14 +17515,14 @@ async function call2(onDone, context) {
|
|
|
17517
17515
|
}
|
|
17518
17516
|
|
|
17519
17517
|
// src/commands/resume.tsx
|
|
17520
|
-
import * as
|
|
17518
|
+
import * as React100 from "react";
|
|
17521
17519
|
|
|
17522
17520
|
// src/ui/screens/ResumeConversation.tsx
|
|
17523
|
-
import
|
|
17521
|
+
import React99 from "react";
|
|
17524
17522
|
import { render } from "ink";
|
|
17525
17523
|
|
|
17526
17524
|
// src/ui/screens/REPL.tsx
|
|
17527
|
-
import { Box as
|
|
17525
|
+
import { Box as Box72, Newline as Newline4, Static as Static2 } from "ink";
|
|
17528
17526
|
|
|
17529
17527
|
// src/ui/components/CostThresholdDialog.tsx
|
|
17530
17528
|
import { Box as Box37, Text as Text42, useInput as useInput17 } from "ink";
|
|
@@ -17577,8 +17575,8 @@ function CostThresholdDialog({ onDone }) {
|
|
|
17577
17575
|
}
|
|
17578
17576
|
|
|
17579
17577
|
// src/ui/screens/REPL.tsx
|
|
17580
|
-
import * as
|
|
17581
|
-
import { useEffect as
|
|
17578
|
+
import * as React97 from "react";
|
|
17579
|
+
import { useEffect as useEffect25, useMemo as useMemo25, useRef as useRef13, useState as useState27, useCallback as useCallback16 } from "react";
|
|
17582
17580
|
|
|
17583
17581
|
// src/ui/components/Message.tsx
|
|
17584
17582
|
import { Box as Box51 } from "ink";
|
|
@@ -17793,10 +17791,6 @@ function getPermissionMode(context) {
|
|
|
17793
17791
|
isBypassPermissionsModeAvailable: !safeMode
|
|
17794
17792
|
});
|
|
17795
17793
|
}
|
|
17796
|
-
function setPermissionMode(context, mode) {
|
|
17797
|
-
const conversationKey = getConversationKey(context);
|
|
17798
|
-
permissionModeByConversationKey.set(conversationKey, mode);
|
|
17799
|
-
}
|
|
17800
17794
|
|
|
17801
17795
|
// src/utils/permissions/toolPermissionContextState.ts
|
|
17802
17796
|
var toolPermissionContextByConversationKey = /* @__PURE__ */ new Map();
|
|
@@ -19832,8 +19826,8 @@ function TaskPanel({
|
|
|
19832
19826
|
}
|
|
19833
19827
|
|
|
19834
19828
|
// src/ui/components/permissions/PermissionRequest.tsx
|
|
19835
|
-
import { useInput as
|
|
19836
|
-
import * as
|
|
19829
|
+
import { useInput as useInput23 } from "ink";
|
|
19830
|
+
import * as React88 from "react";
|
|
19837
19831
|
|
|
19838
19832
|
// src/ui/components/permissions/file-edit-permission-request/FileEditPermissionRequest.tsx
|
|
19839
19833
|
import chalk7 from "chalk";
|
|
@@ -21541,220 +21535,64 @@ function SkillPermissionRequest({
|
|
|
21541
21535
|
);
|
|
21542
21536
|
}
|
|
21543
21537
|
|
|
21544
|
-
// src/tools/
|
|
21538
|
+
// src/tools/interaction/AskUserQuestionTool/AskUserQuestionTool.tsx
|
|
21545
21539
|
import { Box as Box65, Text as Text70 } from "ink";
|
|
21546
21540
|
import React86 from "react";
|
|
21547
21541
|
import { z as z10 } from "zod";
|
|
21548
21542
|
|
|
21549
|
-
// src/tools/
|
|
21550
|
-
var
|
|
21551
|
-
var
|
|
21552
|
-
var
|
|
21553
|
-
|
|
21554
|
-
|
|
21555
|
-
|
|
21556
|
-
|
|
21557
|
-
**Prefer using EnterPlanMode** for implementation tasks unless they're simple. Use it when ANY of these conditions apply:
|
|
21558
|
-
|
|
21559
|
-
1. **New Feature Implementation**: Adding meaningful new functionality
|
|
21560
|
-
- Example: "Add a logout button" - where should it go? What should happen on click?
|
|
21561
|
-
- Example: "Add form validation" - what rules? What error messages?
|
|
21562
|
-
|
|
21563
|
-
2. **Multiple Valid Approaches**: The task can be solved in several different ways
|
|
21564
|
-
- Example: "Add caching to the API" - could use Redis, in-memory, file-based, etc.
|
|
21565
|
-
- Example: "Improve performance" - many optimization strategies possible
|
|
21566
|
-
|
|
21567
|
-
3. **Code Modifications**: Changes that affect existing behavior or structure
|
|
21568
|
-
- Example: "Update the login flow" - what exactly should change?
|
|
21569
|
-
- Example: "Refactor this component" - what's the target architecture?
|
|
21570
|
-
|
|
21571
|
-
4. **Architectural Decisions**: The task requires choosing between patterns or technologies
|
|
21572
|
-
- Example: "Add real-time updates" - WebSockets vs SSE vs polling
|
|
21573
|
-
- Example: "Implement state management" - Redux vs Context vs custom solution
|
|
21574
|
-
|
|
21575
|
-
5. **Multi-File Changes**: The task will likely touch more than 2-3 files
|
|
21576
|
-
- Example: "Refactor the authentication system"
|
|
21577
|
-
- Example: "Add a new API endpoint with tests"
|
|
21578
|
-
|
|
21579
|
-
6. **Unclear Requirements**: You need to explore before understanding the full scope
|
|
21580
|
-
- Example: "Make the app faster" - need to profile and identify bottlenecks
|
|
21581
|
-
- Example: "Fix the bug in checkout" - need to investigate root cause
|
|
21582
|
-
|
|
21583
|
-
7. **User Preferences Matter**: The implementation could reasonably go multiple ways
|
|
21584
|
-
- If you would use AskUserQuestion to clarify the approach, use EnterPlanMode instead
|
|
21585
|
-
- Plan mode lets you explore first, then present options with context
|
|
21586
|
-
|
|
21587
|
-
## When NOT to Use This Tool
|
|
21588
|
-
|
|
21589
|
-
Only skip EnterPlanMode for simple tasks:
|
|
21590
|
-
- Single-line or few-line fixes (typos, obvious bugs, small tweaks)
|
|
21591
|
-
- Adding a single function with clear requirements
|
|
21592
|
-
- Tasks where the user has given very specific, detailed instructions
|
|
21593
|
-
- Pure research/exploration tasks (use the Task tool with explore agent instead)
|
|
21594
|
-
|
|
21595
|
-
## What Happens in Plan Mode
|
|
21596
|
-
|
|
21597
|
-
In plan mode, you'll:
|
|
21598
|
-
1. Thoroughly explore the codebase using Glob, Grep, Read, ls, and Lsp tools
|
|
21599
|
-
2. Understand existing patterns and architecture
|
|
21600
|
-
3. Design an implementation approach
|
|
21601
|
-
4. Write your plan to the plan file
|
|
21602
|
-
5. Use AskUserQuestion if you need to clarify approaches
|
|
21603
|
-
6. Exit plan mode with ExitPlanMode when ready for user review
|
|
21604
|
-
|
|
21605
|
-
## Examples
|
|
21606
|
-
|
|
21607
|
-
### GOOD - Use EnterPlanMode:
|
|
21608
|
-
User: "Add user authentication to the app"
|
|
21609
|
-
- Requires architectural decisions (session vs JWT, where to store tokens, middleware structure)
|
|
21610
|
-
|
|
21611
|
-
User: "Optimize the database queries"
|
|
21612
|
-
- Multiple approaches possible, need to profile first, significant impact
|
|
21613
|
-
|
|
21614
|
-
User: "Implement dark mode"
|
|
21615
|
-
- Architectural decision on theme system, affects many components
|
|
21616
|
-
|
|
21617
|
-
User: "Add a delete button to the user profile"
|
|
21618
|
-
- Seems simple but involves: where to place it, confirmation dialog, API call, error handling, state updates
|
|
21619
|
-
|
|
21620
|
-
User: "Update the error handling in the API"
|
|
21621
|
-
- Affects multiple files, user should approve the approach
|
|
21622
|
-
|
|
21623
|
-
### BAD - Don't use EnterPlanMode:
|
|
21624
|
-
User: "Fix the typo in the README"
|
|
21625
|
-
- Straightforward, no planning needed
|
|
21626
|
-
|
|
21627
|
-
User: "Add a console.log to debug this function"
|
|
21628
|
-
- Simple, obvious implementation
|
|
21629
|
-
|
|
21630
|
-
User: "What files handle routing?"
|
|
21631
|
-
- Research task, not implementation planning
|
|
21632
|
-
|
|
21633
|
-
## Important Notes
|
|
21634
|
-
|
|
21635
|
-
- This tool immediately enters plan mode without requiring user confirmation
|
|
21636
|
-
- If unsure whether to use it, err on the side of planning - structured analysis leads to better solutions
|
|
21637
|
-
- Users can still control the mode via keyboard shortcuts (alt+m / shift+tab)`;
|
|
21638
|
-
var EXIT_DESCRIPTION = "Prompts the user to exit plan mode and start coding";
|
|
21639
|
-
var EXIT_PROMPT = `Use this tool when you are in plan mode and have finished writing your plan to the plan file and are ready for user approval.
|
|
21640
|
-
|
|
21641
|
-
## How This Tool Works
|
|
21642
|
-
- You should have already written your plan to the plan file specified in the plan mode system message
|
|
21643
|
-
- This tool does NOT take the plan content as a parameter - it will read the plan from the file you wrote
|
|
21644
|
-
- This tool simply signals that you're done planning and ready for the user to review and approve
|
|
21645
|
-
- The user will see the contents of your plan file when they review it
|
|
21646
|
-
|
|
21647
|
-
## When to Use This Tool
|
|
21648
|
-
IMPORTANT: Only use this tool when the task requires planning the implementation steps of a task that requires writing code. For research tasks where you're gathering information, searching files, reading files or in general trying to understand the codebase - do NOT use this tool.
|
|
21649
|
-
|
|
21650
|
-
## Handling Ambiguity in Plans
|
|
21651
|
-
Before using this tool, ensure your plan is clear and unambiguous. If there are multiple valid approaches or unclear requirements:
|
|
21652
|
-
1. Use the AskUserQuestion tool to clarify with the user
|
|
21653
|
-
2. Ask about specific implementation choices (e.g., architectural patterns, which library to use)
|
|
21654
|
-
3. Clarify any assumptions that could affect the implementation
|
|
21655
|
-
4. Edit your plan file to incorporate user feedback
|
|
21656
|
-
5. Only proceed with ExitPlanMode after resolving ambiguities and updating the plan file
|
|
21657
|
-
|
|
21658
|
-
## Examples
|
|
21543
|
+
// src/tools/interaction/AskUserQuestionTool/prompt.ts
|
|
21544
|
+
var TOOL_NAME_FOR_PROMPT6 = "AskUserQuestion";
|
|
21545
|
+
var DESCRIPTION6 = "Asks the user multiple choice questions to gather information, clarify ambiguity, understand preferences, make decisions or offer them choices.";
|
|
21546
|
+
var PROMPT6 = `Use this tool when you need to ask the user questions during execution. This allows you to:
|
|
21547
|
+
1. Gather user preferences or requirements
|
|
21548
|
+
2. Clarify ambiguous instructions
|
|
21549
|
+
3. Get decisions on implementation choices as you work
|
|
21550
|
+
4. Offer choices to the user about what direction to take.
|
|
21659
21551
|
|
|
21660
|
-
|
|
21661
|
-
|
|
21662
|
-
|
|
21552
|
+
Usage notes:
|
|
21553
|
+
- Users will always be able to select "Other" to provide custom text input
|
|
21554
|
+
- Use multiSelect: true to allow multiple answers to be selected for a question
|
|
21555
|
+
- If you recommend a specific option, make that the first option in the list and add "(Recommended)" at the end of the label`;
|
|
21663
21556
|
|
|
21664
|
-
// src/tools/
|
|
21665
|
-
var
|
|
21666
|
-
|
|
21667
|
-
|
|
21668
|
-
|
|
21669
|
-
|
|
21670
|
-
|
|
21671
|
-
|
|
21672
|
-
|
|
21673
|
-
|
|
21674
|
-
|
|
21675
|
-
|
|
21676
|
-
|
|
21677
|
-
|
|
21678
|
-
|
|
21679
|
-
|
|
21680
|
-
|
|
21681
|
-
|
|
21557
|
+
// src/tools/interaction/AskUserQuestionTool/AskUserQuestionTool.tsx
|
|
21558
|
+
var optionSchema = z10.object({
|
|
21559
|
+
label: z10.string(),
|
|
21560
|
+
description: z10.string()
|
|
21561
|
+
});
|
|
21562
|
+
var questionSchema = z10.object({
|
|
21563
|
+
question: z10.string(),
|
|
21564
|
+
header: z10.string(),
|
|
21565
|
+
options: z10.array(optionSchema).min(2).max(4),
|
|
21566
|
+
multiSelect: z10.boolean()
|
|
21567
|
+
});
|
|
21568
|
+
var inputSchema10 = z10.strictObject({
|
|
21569
|
+
questions: z10.array(questionSchema).min(1).max(4),
|
|
21570
|
+
answers: z10.record(z10.string(), z10.string()).optional()
|
|
21571
|
+
}).refine(
|
|
21572
|
+
(input) => {
|
|
21573
|
+
const questionTexts = input.questions.map((q) => q.question);
|
|
21574
|
+
if (questionTexts.length !== new Set(questionTexts).size) return false;
|
|
21575
|
+
for (const question of input.questions) {
|
|
21576
|
+
const optionLabels = question.options.map((option) => option.label);
|
|
21577
|
+
if (optionLabels.length !== new Set(optionLabels).size) return false;
|
|
21578
|
+
}
|
|
21682
21579
|
return true;
|
|
21683
21580
|
},
|
|
21684
|
-
|
|
21685
|
-
|
|
21686
|
-
},
|
|
21687
|
-
requiresUserInteraction() {
|
|
21688
|
-
return false;
|
|
21689
|
-
},
|
|
21690
|
-
async prompt() {
|
|
21691
|
-
return ENTER_PROMPT;
|
|
21692
|
-
},
|
|
21693
|
-
renderToolUseMessage() {
|
|
21694
|
-
return "";
|
|
21695
|
-
},
|
|
21696
|
-
renderToolUseRejectedMessage() {
|
|
21697
|
-
const theme = getTheme();
|
|
21698
|
-
return /* @__PURE__ */ React86.createElement(Box65, { flexDirection: "row", marginTop: 1 }, /* @__PURE__ */ React86.createElement(Text70, { color: theme.text }, BLACK_CIRCLE), /* @__PURE__ */ React86.createElement(Text70, null, " Plan mode entry was cancelled"));
|
|
21699
|
-
},
|
|
21700
|
-
renderToolResultMessage(_output) {
|
|
21701
|
-
const theme = getTheme();
|
|
21702
|
-
return /* @__PURE__ */ React86.createElement(Box65, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React86.createElement(Box65, { flexDirection: "row" }, /* @__PURE__ */ React86.createElement(Text70, { color: theme.planMode }, BLACK_CIRCLE), /* @__PURE__ */ React86.createElement(Text70, null, " Entered plan mode")), /* @__PURE__ */ React86.createElement(Box65, { paddingLeft: 2 }, /* @__PURE__ */ React86.createElement(Text70, { dimColor: true }, "Pyb Agent is now exploring and designing an implementation approach.")));
|
|
21703
|
-
},
|
|
21704
|
-
renderResultForAssistant(output) {
|
|
21705
|
-
return `${output.message}
|
|
21706
|
-
|
|
21707
|
-
In plan mode, you should:
|
|
21708
|
-
1. Thoroughly explore the codebase to understand existing patterns
|
|
21709
|
-
2. Identify similar features and architectural approaches
|
|
21710
|
-
3. Consider multiple approaches and their trade-offs
|
|
21711
|
-
4. Use AskUserQuestion if you need to clarify the approach
|
|
21712
|
-
5. Design a concrete implementation strategy
|
|
21713
|
-
6. Write your plan to the plan file
|
|
21714
|
-
7. When ready, use ExitPlanMode for user review
|
|
21715
|
-
|
|
21716
|
-
Remember: DO NOT write or edit any files yet (except the plan file). This is a read-only exploration and planning phase.`;
|
|
21717
|
-
},
|
|
21718
|
-
async *call(_input, context) {
|
|
21719
|
-
if (context?.agentId) {
|
|
21720
|
-
throw new Error("EnterPlanMode tool cannot be used in agent contexts");
|
|
21721
|
-
}
|
|
21722
|
-
setPermissionMode(context, "plan");
|
|
21723
|
-
enterPlanMode(context);
|
|
21724
|
-
const output = {
|
|
21725
|
-
message: "Entered plan mode. You should now focus on exploring the codebase and designing an implementation approach."
|
|
21726
|
-
};
|
|
21727
|
-
yield {
|
|
21728
|
-
type: "result",
|
|
21729
|
-
data: output,
|
|
21730
|
-
resultForAssistant: this.renderResultForAssistant(output)
|
|
21731
|
-
};
|
|
21581
|
+
{
|
|
21582
|
+
message: "Question texts must be unique, option labels must be unique within each question"
|
|
21732
21583
|
}
|
|
21733
|
-
|
|
21734
|
-
|
|
21735
|
-
|
|
21736
|
-
import { Box as Box66, Text as Text71 } from "ink";
|
|
21737
|
-
import React87 from "react";
|
|
21738
|
-
import { z as z11 } from "zod";
|
|
21739
|
-
function getExitPlanModePlanText(conversationKey) {
|
|
21740
|
-
const { content } = readPlanFile(void 0, conversationKey);
|
|
21741
|
-
return content || "No plan found. Please write your plan to the plan file first.";
|
|
21742
|
-
}
|
|
21743
|
-
var inputSchema11 = z11.strictObject({
|
|
21744
|
-
launchSwarm: z11.boolean().optional().describe("Whether to launch a swarm to implement the plan"),
|
|
21745
|
-
teammateCount: z11.number().optional().describe("Number of teammates to spawn in the swarm")
|
|
21746
|
-
}).passthrough();
|
|
21747
|
-
var ExitPlanModeTool = {
|
|
21748
|
-
name: EXIT_TOOL_NAME,
|
|
21584
|
+
);
|
|
21585
|
+
var AskUserQuestionTool = {
|
|
21586
|
+
name: TOOL_NAME_FOR_PROMPT6,
|
|
21749
21587
|
async description() {
|
|
21750
|
-
return
|
|
21588
|
+
return DESCRIPTION6;
|
|
21751
21589
|
},
|
|
21752
21590
|
userFacingName() {
|
|
21753
21591
|
return "";
|
|
21754
21592
|
},
|
|
21755
|
-
inputSchema:
|
|
21593
|
+
inputSchema: inputSchema10,
|
|
21756
21594
|
isReadOnly() {
|
|
21757
|
-
return
|
|
21595
|
+
return true;
|
|
21758
21596
|
},
|
|
21759
21597
|
isConcurrencySafe() {
|
|
21760
21598
|
return true;
|
|
@@ -21769,107 +21607,25 @@ var ExitPlanModeTool = {
|
|
|
21769
21607
|
return true;
|
|
21770
21608
|
},
|
|
21771
21609
|
async prompt() {
|
|
21772
|
-
return
|
|
21610
|
+
return PROMPT6;
|
|
21773
21611
|
},
|
|
21774
21612
|
renderToolUseMessage() {
|
|
21775
|
-
return
|
|
21613
|
+
return null;
|
|
21776
21614
|
},
|
|
21777
|
-
renderToolUseRejectedMessage(
|
|
21615
|
+
renderToolUseRejectedMessage() {
|
|
21778
21616
|
const theme = getTheme();
|
|
21779
|
-
|
|
21780
|
-
const { content } = readPlanFile(void 0, conversationKey);
|
|
21781
|
-
const plan = getExitPlanModePlanText(conversationKey);
|
|
21782
|
-
return /* @__PURE__ */ React87.createElement(Box66, { flexDirection: "column", marginTop: 1, width: "100%" }, /* @__PURE__ */ React87.createElement(Box66, { flexDirection: "row" }, /* @__PURE__ */ React87.createElement(Text71, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React87.createElement(Box66, { flexDirection: "column", width: "100%" }, /* @__PURE__ */ React87.createElement(Text71, { color: theme.error }, "User rejected Pyb Agent's plan:"), /* @__PURE__ */ React87.createElement(
|
|
21783
|
-
Box66,
|
|
21784
|
-
{
|
|
21785
|
-
borderStyle: "round",
|
|
21786
|
-
borderColor: theme.planMode,
|
|
21787
|
-
borderDimColor: true,
|
|
21788
|
-
paddingX: 1,
|
|
21789
|
-
overflow: "hidden"
|
|
21790
|
-
},
|
|
21791
|
-
/* @__PURE__ */ React87.createElement(Text71, { dimColor: true }, plan)
|
|
21792
|
-
))));
|
|
21617
|
+
return /* @__PURE__ */ React86.createElement(Box65, { flexDirection: "row", marginTop: 1 }, /* @__PURE__ */ React86.createElement(Text70, { color: theme.text }, BLACK_CIRCLE, "\xA0"), /* @__PURE__ */ React86.createElement(Text70, null, "User declined to answer questions"));
|
|
21793
21618
|
},
|
|
21794
|
-
renderToolResultMessage(output) {
|
|
21619
|
+
renderToolResultMessage(output, _options) {
|
|
21795
21620
|
const theme = getTheme();
|
|
21796
|
-
|
|
21797
|
-
const plan = output.plan || "No plan found";
|
|
21798
|
-
return /* @__PURE__ */ React87.createElement(Box66, { flexDirection: "column", marginTop: 1, width: "100%" }, /* @__PURE__ */ React87.createElement(Box66, { flexDirection: "row" }, /* @__PURE__ */ React87.createElement(Text71, { color: theme.planMode }, BLACK_CIRCLE), /* @__PURE__ */ React87.createElement(Text71, null, " User approved Pyb Agent's plan")), /* @__PURE__ */ React87.createElement(Box66, { flexDirection: "row" }, /* @__PURE__ */ React87.createElement(Text71, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React87.createElement(Box66, { flexDirection: "column" }, planPath ? /* @__PURE__ */ React87.createElement(Text71, { dimColor: true }, "Plan saved to: ", planPath, " \xB7 /plan to edit") : null, /* @__PURE__ */ React87.createElement(Text71, { dimColor: true }, plan))));
|
|
21621
|
+
return /* @__PURE__ */ React86.createElement(Box65, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React86.createElement(Box65, { flexDirection: "row" }, /* @__PURE__ */ React86.createElement(Text70, { color: theme.text }, BLACK_CIRCLE, "\xA0"), /* @__PURE__ */ React86.createElement(Text70, null, "User answered Pyb Agent's questions:")), /* @__PURE__ */ React86.createElement(Box65, { flexDirection: "column", paddingLeft: 2 }, Object.entries(output.answers).map(([question, answer]) => /* @__PURE__ */ React86.createElement(Box65, { key: question }, /* @__PURE__ */ React86.createElement(Text70, { dimColor: true }, "\xB7 ", question, " \u2192 ", answer)))));
|
|
21799
21622
|
},
|
|
21800
21623
|
renderResultForAssistant(output) {
|
|
21801
|
-
|
|
21802
|
-
|
|
21803
|
-
}
|
|
21804
|
-
if (output.launchSwarm && output.teammateCount) {
|
|
21805
|
-
return `User has approved your plan AND requested a swarm of ${output.teammateCount} teammates to implement it.
|
|
21806
|
-
|
|
21807
|
-
Please follow these steps to launch the swarm:
|
|
21808
|
-
|
|
21809
|
-
1. **Create tasks from your plan** - Parse your plan and create tasks using TaskCreateTool for each actionable item. Each task should have a clear subject and description.
|
|
21810
|
-
|
|
21811
|
-
2. **Create a team** - Use TeammateTool with operation: "spawnTeam" to create a new team:
|
|
21812
|
-
\`\`\`json
|
|
21813
|
-
{
|
|
21814
|
-
"operation": "spawnTeam",
|
|
21815
|
-
"team_name": "plan-implementation",
|
|
21816
|
-
"description": "Team implementing the approved plan"
|
|
21817
|
-
}
|
|
21818
|
-
\`\`\`
|
|
21819
|
-
|
|
21820
|
-
3. **Spawn ${output.teammateCount} teammates** - Use TeammateTool with operation: "spawn" for each teammate:
|
|
21821
|
-
\`\`\`json
|
|
21822
|
-
{
|
|
21823
|
-
"operation": "spawn",
|
|
21824
|
-
"name": "worker-1",
|
|
21825
|
-
"prompt": "You are part of a team implementing a plan. Check your mailbox for task assignments.",
|
|
21826
|
-
"team_name": "plan-implementation",
|
|
21827
|
-
"agent_type": "worker"
|
|
21828
|
-
}
|
|
21829
|
-
\`\`\`
|
|
21830
|
-
|
|
21831
|
-
4. **Assign tasks to teammates** - Use TeammateTool with operation: "assignTask" to distribute work:
|
|
21832
|
-
\`\`\`json
|
|
21833
|
-
{
|
|
21834
|
-
"operation": "assignTask",
|
|
21835
|
-
"taskId": "1",
|
|
21836
|
-
"assignee": "<agent_id from spawn>",
|
|
21837
|
-
"team_name": "plan-implementation"
|
|
21838
|
-
}
|
|
21839
|
-
\`\`\`
|
|
21840
|
-
|
|
21841
|
-
5. **Gather findings and post summary** - As the leader/coordinator, monitor your teammates' progress. When they complete their tasks and report back, gather their findings and synthesize a final summary for the user explaining what was accomplished, any issues encountered, and next steps if applicable.
|
|
21842
|
-
|
|
21843
|
-
Your plan has been saved to: ${output.filePath}
|
|
21844
|
-
|
|
21845
|
-
## Approved Plan:
|
|
21846
|
-
${output.plan}`;
|
|
21847
|
-
}
|
|
21848
|
-
return `User has approved your plan. You can now start coding. Start with updating your todo list if applicable
|
|
21849
|
-
|
|
21850
|
-
Your plan has been saved to: ${output.filePath}
|
|
21851
|
-
You can refer back to it if needed during implementation.
|
|
21852
|
-
|
|
21853
|
-
## Approved Plan:
|
|
21854
|
-
${output.plan}`;
|
|
21624
|
+
const formatted = Object.entries(output.answers).map(([question, answer]) => `"${question}"="${answer}"`).join(", ");
|
|
21625
|
+
return `User has answered your questions: ${formatted}. You can now continue with the user's answers in mind.`;
|
|
21855
21626
|
},
|
|
21856
|
-
async *call(
|
|
21857
|
-
const
|
|
21858
|
-
const planFilePath = getPlanFilePath(context?.agentId, conversationKey);
|
|
21859
|
-
const { content, exists } = readPlanFile(context?.agentId, conversationKey);
|
|
21860
|
-
if (!exists) {
|
|
21861
|
-
throw new Error(
|
|
21862
|
-
`No plan file found at ${planFilePath}. Please write your plan to this file before calling ExitPlanMode.`
|
|
21863
|
-
);
|
|
21864
|
-
}
|
|
21865
|
-
const isAgent = !!context?.agentId;
|
|
21866
|
-
const output = {
|
|
21867
|
-
plan: content,
|
|
21868
|
-
isAgent,
|
|
21869
|
-
filePath: planFilePath,
|
|
21870
|
-
launchSwarm: input.launchSwarm,
|
|
21871
|
-
teammateCount: input.teammateCount
|
|
21872
|
-
};
|
|
21627
|
+
async *call({ questions, answers: prefilled }) {
|
|
21628
|
+
const output = { questions, answers: prefilled ?? {} };
|
|
21873
21629
|
yield {
|
|
21874
21630
|
type: "result",
|
|
21875
21631
|
data: output,
|
|
@@ -21878,613 +21634,59 @@ ${output.plan}`;
|
|
|
21878
21634
|
}
|
|
21879
21635
|
};
|
|
21880
21636
|
|
|
21881
|
-
// src/ui/components/permissions/
|
|
21882
|
-
import {
|
|
21883
|
-
import
|
|
21884
|
-
|
|
21885
|
-
|
|
21886
|
-
|
|
21887
|
-
|
|
21888
|
-
|
|
21889
|
-
const
|
|
21890
|
-
|
|
21891
|
-
if (
|
|
21892
|
-
|
|
21893
|
-
|
|
21894
|
-
|
|
21895
|
-
});
|
|
21896
|
-
return /* @__PURE__ */ React88.createElement(
|
|
21897
|
-
Box67,
|
|
21898
|
-
{
|
|
21899
|
-
flexDirection: "column",
|
|
21900
|
-
borderStyle: "round",
|
|
21901
|
-
borderColor: theme.permission,
|
|
21902
|
-
marginTop: 1,
|
|
21903
|
-
paddingLeft: 1,
|
|
21904
|
-
paddingRight: 1,
|
|
21905
|
-
paddingBottom: 1
|
|
21906
|
-
},
|
|
21907
|
-
/* @__PURE__ */ React88.createElement(PermissionRequestTitle, { title: "Enter plan mode?", riskScore: null }),
|
|
21908
|
-
/* @__PURE__ */ React88.createElement(Box67, { flexDirection: "column", paddingX: 2, paddingY: 1 }, /* @__PURE__ */ React88.createElement(Text72, null, "The assistant wants to enter plan mode to explore and design an implementation approach.")),
|
|
21909
|
-
/* @__PURE__ */ React88.createElement(Box67, { flexDirection: "column", paddingX: 2 }, /* @__PURE__ */ React88.createElement(Text72, { dimColor: true }, "In plan mode, the assistant will:"), /* @__PURE__ */ React88.createElement(Text72, { dimColor: true }, " \xB7 Explore the codebase thoroughly"), /* @__PURE__ */ React88.createElement(Text72, { dimColor: true }, " \xB7 Identify existing patterns"), /* @__PURE__ */ React88.createElement(Text72, { dimColor: true }, " \xB7 Design an implementation strategy"), /* @__PURE__ */ React88.createElement(Text72, { dimColor: true }, " \xB7 Present a plan for your approval")),
|
|
21910
|
-
/* @__PURE__ */ React88.createElement(Box67, { flexDirection: "column", paddingX: 2, marginTop: 1 }, /* @__PURE__ */ React88.createElement(Text72, { dimColor: true }, "No code changes will be made until you approve the plan.")),
|
|
21911
|
-
/* @__PURE__ */ React88.createElement(Box67, { flexDirection: "column" }, /* @__PURE__ */ React88.createElement(Text72, null, "Would you like to proceed?"), /* @__PURE__ */ React88.createElement(
|
|
21912
|
-
Select,
|
|
21913
|
-
{
|
|
21914
|
-
options: [
|
|
21915
|
-
{ label: "Yes, enter plan mode", value: "yes" },
|
|
21916
|
-
{ label: "No, start implementing now", value: "no" }
|
|
21917
|
-
],
|
|
21918
|
-
onChange: (value) => {
|
|
21919
|
-
if (value === "yes") {
|
|
21920
|
-
setMode("plan");
|
|
21921
|
-
toolUseConfirm.onAllow("temporary");
|
|
21922
|
-
onDone();
|
|
21923
|
-
return;
|
|
21924
|
-
}
|
|
21925
|
-
toolUseConfirm.onReject();
|
|
21926
|
-
onDone();
|
|
21927
|
-
}
|
|
21928
|
-
}
|
|
21929
|
-
))
|
|
21930
|
-
);
|
|
21637
|
+
// src/ui/components/permissions/ask-user-question-permission-request/AskUserQuestionPermissionRequest.tsx
|
|
21638
|
+
import React87, { useCallback as useCallback11, useMemo as useMemo23, useState as useState21 } from "react";
|
|
21639
|
+
import { Box as Box66, Text as Text71, useInput as useInput22 } from "ink";
|
|
21640
|
+
import figures8 from "figures";
|
|
21641
|
+
import stringWidth from "string-width";
|
|
21642
|
+
function isTextInputChar(input, key) {
|
|
21643
|
+
if (key.ctrl || key.meta || key.tab) return false;
|
|
21644
|
+
if (typeof input !== "string" || input.length === 0) return false;
|
|
21645
|
+
for (const char of input) {
|
|
21646
|
+
const code = char.codePointAt(0);
|
|
21647
|
+
if (code === void 0) return false;
|
|
21648
|
+
if (code < 32 || code === 127) return false;
|
|
21649
|
+
}
|
|
21650
|
+
return true;
|
|
21931
21651
|
}
|
|
21932
|
-
|
|
21933
|
-
|
|
21934
|
-
|
|
21935
|
-
|
|
21936
|
-
|
|
21937
|
-
// src/utils/system/externalEditor.ts
|
|
21938
|
-
import { spawn, spawnSync } from "child_process";
|
|
21939
|
-
import { mkdtempSync, readFileSync as readFileSync9, rmSync as rmSync2, writeFileSync as writeFileSync4 } from "fs";
|
|
21940
|
-
import { tmpdir } from "os";
|
|
21941
|
-
import { join as join8 } from "path";
|
|
21942
|
-
var isWindows = process.platform === "win32";
|
|
21943
|
-
function isCommandAvailable(command4) {
|
|
21944
|
-
const checker = isWindows ? "where" : "which";
|
|
21945
|
-
const result = spawnSync(checker, [command4], { stdio: "ignore" });
|
|
21946
|
-
return result.status === 0;
|
|
21652
|
+
function applySingleSelectNav(args) {
|
|
21653
|
+
const { focusedOptionIndex, key, optionCount } = args;
|
|
21654
|
+
if (key.downArrow) return Math.min(optionCount - 1, focusedOptionIndex + 1);
|
|
21655
|
+
if (key.upArrow) return Math.max(0, focusedOptionIndex - 1);
|
|
21656
|
+
return focusedOptionIndex;
|
|
21947
21657
|
}
|
|
21948
|
-
function
|
|
21949
|
-
const
|
|
21950
|
-
|
|
21658
|
+
function applyMultiSelectNav(args) {
|
|
21659
|
+
const { state, key, optionCount } = args;
|
|
21660
|
+
const nextKey = key.downArrow || key.tab && !key.shift;
|
|
21661
|
+
const prevKey = key.upArrow || key.tab && key.shift;
|
|
21662
|
+
if (state.isSubmitFocused) {
|
|
21663
|
+
if (prevKey) {
|
|
21664
|
+
return {
|
|
21665
|
+
focusedOptionIndex: Math.max(0, optionCount - 1),
|
|
21666
|
+
isSubmitFocused: false
|
|
21667
|
+
};
|
|
21668
|
+
}
|
|
21669
|
+
return state;
|
|
21670
|
+
}
|
|
21671
|
+
if (nextKey) {
|
|
21672
|
+
if (state.focusedOptionIndex >= optionCount - 1) {
|
|
21673
|
+
return { ...state, isSubmitFocused: true };
|
|
21674
|
+
}
|
|
21675
|
+
return { ...state, focusedOptionIndex: state.focusedOptionIndex + 1 };
|
|
21676
|
+
}
|
|
21677
|
+
if (prevKey) {
|
|
21951
21678
|
return {
|
|
21952
|
-
|
|
21953
|
-
|
|
21954
|
-
displayName: envEditor.trim(),
|
|
21955
|
-
shell: true
|
|
21679
|
+
...state,
|
|
21680
|
+
focusedOptionIndex: Math.max(0, state.focusedOptionIndex - 1)
|
|
21956
21681
|
};
|
|
21957
21682
|
}
|
|
21958
|
-
|
|
21959
|
-
|
|
21960
|
-
|
|
21961
|
-
|
|
21962
|
-
|
|
21963
|
-
|
|
21964
|
-
|
|
21965
|
-
}
|
|
21966
|
-
if (!isWindows) {
|
|
21967
|
-
if (isCommandAvailable("nano")) {
|
|
21968
|
-
candidates.push({
|
|
21969
|
-
command: "nano",
|
|
21970
|
-
args: [],
|
|
21971
|
-
displayName: "nano"
|
|
21972
|
-
});
|
|
21973
|
-
}
|
|
21974
|
-
if (isCommandAvailable("vim")) {
|
|
21975
|
-
candidates.push({
|
|
21976
|
-
command: "vim",
|
|
21977
|
-
args: [],
|
|
21978
|
-
displayName: "vim"
|
|
21979
|
-
});
|
|
21980
|
-
}
|
|
21981
|
-
if (isCommandAvailable("open")) {
|
|
21982
|
-
candidates.push({
|
|
21983
|
-
command: "open",
|
|
21984
|
-
args: ["-W", "-t"],
|
|
21985
|
-
displayName: "open -W -t"
|
|
21986
|
-
});
|
|
21987
|
-
}
|
|
21988
|
-
} else {
|
|
21989
|
-
candidates.push({
|
|
21990
|
-
command: "notepad",
|
|
21991
|
-
args: [],
|
|
21992
|
-
displayName: "notepad"
|
|
21993
|
-
});
|
|
21994
|
-
}
|
|
21995
|
-
return candidates.find((candidate) => isCommandAvailable(candidate.command)) ?? null;
|
|
21996
|
-
}
|
|
21997
|
-
function restoreStdinState(previouslyRaw) {
|
|
21998
|
-
if (!process.stdin.isTTY) return;
|
|
21999
|
-
process.stdin.resume();
|
|
22000
|
-
if (previouslyRaw && process.stdin.setRawMode) {
|
|
22001
|
-
process.stdin.setRawMode(true);
|
|
22002
|
-
}
|
|
22003
|
-
}
|
|
22004
|
-
function normalizeNewlines(text) {
|
|
22005
|
-
return text.replace(/\r\n/g, "\n");
|
|
22006
|
-
}
|
|
22007
|
-
async function launchExternalEditor(initialText) {
|
|
22008
|
-
const editorCommand = resolveEditorCommand();
|
|
22009
|
-
if (!editorCommand) {
|
|
22010
|
-
return {
|
|
22011
|
-
text: null,
|
|
22012
|
-
error: new Error(
|
|
22013
|
-
"No editor found. Set $VISUAL or $EDITOR, or install code, nano, vim, or notepad."
|
|
22014
|
-
)
|
|
22015
|
-
};
|
|
22016
|
-
}
|
|
22017
|
-
const dir = mkdtempSync(join8(tmpdir(), "pyb-edit-"));
|
|
22018
|
-
const filePath = join8(dir, "message.txt");
|
|
22019
|
-
writeFileSync4(filePath, initialText, "utf-8");
|
|
22020
|
-
const wasRaw = Boolean(process.stdin.isTTY && process.stdin.isRaw);
|
|
22021
|
-
if (process.stdin.isTTY) {
|
|
22022
|
-
process.stdin.pause();
|
|
22023
|
-
if (process.stdin.setRawMode) {
|
|
22024
|
-
process.stdin.setRawMode(false);
|
|
22025
|
-
}
|
|
22026
|
-
}
|
|
22027
|
-
try {
|
|
22028
|
-
await new Promise((resolve11, reject) => {
|
|
22029
|
-
const child = spawn(
|
|
22030
|
-
editorCommand.command,
|
|
22031
|
-
[...editorCommand.args, filePath],
|
|
22032
|
-
{
|
|
22033
|
-
stdio: "inherit",
|
|
22034
|
-
shell: editorCommand.shell ?? false
|
|
22035
|
-
}
|
|
22036
|
-
);
|
|
22037
|
-
child.on("error", reject);
|
|
22038
|
-
child.on("exit", (code, signal) => {
|
|
22039
|
-
if (code === 0 || code === null) {
|
|
22040
|
-
resolve11();
|
|
22041
|
-
} else {
|
|
22042
|
-
reject(
|
|
22043
|
-
new Error(
|
|
22044
|
-
`Editor exited with code ${code}${signal ? ` (signal ${signal})` : ""}`
|
|
22045
|
-
)
|
|
22046
|
-
);
|
|
22047
|
-
}
|
|
22048
|
-
});
|
|
22049
|
-
});
|
|
22050
|
-
} catch (error) {
|
|
22051
|
-
restoreStdinState(wasRaw);
|
|
22052
|
-
rmSync2(dir, { recursive: true, force: true });
|
|
22053
|
-
return {
|
|
22054
|
-
text: null,
|
|
22055
|
-
editorLabel: editorCommand.displayName,
|
|
22056
|
-
error
|
|
22057
|
-
};
|
|
22058
|
-
}
|
|
22059
|
-
restoreStdinState(wasRaw);
|
|
22060
|
-
try {
|
|
22061
|
-
const edited = normalizeNewlines(readFileSync9(filePath, "utf-8"));
|
|
22062
|
-
rmSync2(dir, { recursive: true, force: true });
|
|
22063
|
-
return { text: edited, editorLabel: editorCommand.displayName };
|
|
22064
|
-
} catch (error) {
|
|
22065
|
-
rmSync2(dir, { recursive: true, force: true });
|
|
22066
|
-
return {
|
|
22067
|
-
text: null,
|
|
22068
|
-
editorLabel: editorCommand.displayName,
|
|
22069
|
-
error
|
|
22070
|
-
};
|
|
22071
|
-
}
|
|
22072
|
-
}
|
|
22073
|
-
async function launchExternalEditorForFilePath(filePath) {
|
|
22074
|
-
const editorCommand = resolveEditorCommand();
|
|
22075
|
-
if (!editorCommand) {
|
|
22076
|
-
return {
|
|
22077
|
-
ok: false,
|
|
22078
|
-
error: new Error(
|
|
22079
|
-
"No editor found. Set $VISUAL or $EDITOR, or install code, nano, vim, or notepad."
|
|
22080
|
-
)
|
|
22081
|
-
};
|
|
22082
|
-
}
|
|
22083
|
-
const wasRaw = Boolean(process.stdin.isTTY && process.stdin.isRaw);
|
|
22084
|
-
if (process.stdin.isTTY) {
|
|
22085
|
-
process.stdin.pause();
|
|
22086
|
-
if (process.stdin.setRawMode) {
|
|
22087
|
-
process.stdin.setRawMode(false);
|
|
22088
|
-
}
|
|
22089
|
-
}
|
|
22090
|
-
try {
|
|
22091
|
-
await new Promise((resolve11, reject) => {
|
|
22092
|
-
const child = spawn(
|
|
22093
|
-
editorCommand.command,
|
|
22094
|
-
[...editorCommand.args, filePath],
|
|
22095
|
-
{
|
|
22096
|
-
stdio: "inherit",
|
|
22097
|
-
shell: editorCommand.shell ?? false
|
|
22098
|
-
}
|
|
22099
|
-
);
|
|
22100
|
-
child.on("error", reject);
|
|
22101
|
-
child.on("exit", (code, signal) => {
|
|
22102
|
-
if (code === 0 || code === null) {
|
|
22103
|
-
resolve11();
|
|
22104
|
-
} else {
|
|
22105
|
-
reject(
|
|
22106
|
-
new Error(
|
|
22107
|
-
`Editor exited with code ${code}${signal ? ` (signal ${signal})` : ""}`
|
|
22108
|
-
)
|
|
22109
|
-
);
|
|
22110
|
-
}
|
|
22111
|
-
});
|
|
22112
|
-
});
|
|
22113
|
-
} catch (error) {
|
|
22114
|
-
restoreStdinState(wasRaw);
|
|
22115
|
-
return {
|
|
22116
|
-
ok: false,
|
|
22117
|
-
editorLabel: editorCommand.displayName,
|
|
22118
|
-
error
|
|
22119
|
-
};
|
|
22120
|
-
}
|
|
22121
|
-
restoreStdinState(wasRaw);
|
|
22122
|
-
return { ok: true, editorLabel: editorCommand.displayName };
|
|
22123
|
-
}
|
|
22124
|
-
|
|
22125
|
-
// src/ui/components/permissions/plan-mode-permission-request/ExitPlanModePermissionRequest.tsx
|
|
22126
|
-
import { writeFileSync as writeFileSync5 } from "fs";
|
|
22127
|
-
function getExitPlanModeOptions(args) {
|
|
22128
|
-
const options = [];
|
|
22129
|
-
options.push(
|
|
22130
|
-
args.bypassAvailable ? { label: "Yes, and bypass permissions", value: "yes-bypass" } : { label: "Yes, and auto-accept edits", value: "yes-accept" }
|
|
22131
|
-
);
|
|
22132
|
-
if (args.launchSwarmAvailable) {
|
|
22133
|
-
options.push({
|
|
22134
|
-
label: `Yes, and launch swarm (${args.teammateCount} teammates)`,
|
|
22135
|
-
value: "yes-launch-swarm"
|
|
22136
|
-
});
|
|
22137
|
-
}
|
|
22138
|
-
options.push({
|
|
22139
|
-
label: "Yes, and manually approve edits",
|
|
22140
|
-
value: "yes-default"
|
|
22141
|
-
});
|
|
22142
|
-
options.push({ label: "No, keep planning", value: "no" });
|
|
22143
|
-
return options;
|
|
22144
|
-
}
|
|
22145
|
-
function planPlaceholder() {
|
|
22146
|
-
return "No plan found. Please write your plan to the plan file first.";
|
|
22147
|
-
}
|
|
22148
|
-
function ExitPlanModePermissionRequest({
|
|
22149
|
-
toolUseConfirm,
|
|
22150
|
-
onDone
|
|
22151
|
-
}) {
|
|
22152
|
-
const theme = getTheme();
|
|
22153
|
-
const { setMode } = usePermissionContext();
|
|
22154
|
-
const conversationKey = getPlanConversationKey(toolUseConfirm.toolUseContext);
|
|
22155
|
-
const planFilePath = useMemo23(
|
|
22156
|
-
() => getPlanFilePath(void 0, conversationKey),
|
|
22157
|
-
[conversationKey]
|
|
22158
|
-
);
|
|
22159
|
-
const planFromInput = typeof toolUseConfirm.input?.plan === "string" && String(toolUseConfirm.input.plan).trim().length > 0 ? String(toolUseConfirm.input.plan) : null;
|
|
22160
|
-
const planSource = planFromInput ? "input" : "file";
|
|
22161
|
-
const [planText, setPlanText] = useState21(() => {
|
|
22162
|
-
if (planSource === "input") {
|
|
22163
|
-
return planFromInput;
|
|
22164
|
-
}
|
|
22165
|
-
const { content, exists } = readPlanFile(void 0, conversationKey);
|
|
22166
|
-
return exists ? content : planPlaceholder();
|
|
22167
|
-
});
|
|
22168
|
-
const [planExists, setPlanExists] = useState21(() => {
|
|
22169
|
-
if (planSource === "input") return false;
|
|
22170
|
-
const { exists } = readPlanFile(void 0, conversationKey);
|
|
22171
|
-
return exists;
|
|
22172
|
-
});
|
|
22173
|
-
const [planSaved, setPlanSaved] = useState21(false);
|
|
22174
|
-
const [showRejectInput, setShowRejectInput] = useState21(false);
|
|
22175
|
-
const [rejectFeedback, setRejectFeedback] = useState21("");
|
|
22176
|
-
const [rejectError, setRejectError] = useState21(null);
|
|
22177
|
-
const [rejectCursorOffset, setRejectCursorOffset] = useState21(0);
|
|
22178
|
-
const [focusedOption, setFocusedOption] = useState21(null);
|
|
22179
|
-
const [teammateCount, setTeammateCount] = useState21(3);
|
|
22180
|
-
useEffect20(() => {
|
|
22181
|
-
if (!planSaved) return;
|
|
22182
|
-
const timeout = setTimeout(() => setPlanSaved(false), 5e3);
|
|
22183
|
-
return () => clearTimeout(timeout);
|
|
22184
|
-
}, [planSaved]);
|
|
22185
|
-
useInput23((input, key) => {
|
|
22186
|
-
if (key.escape && !showRejectInput) {
|
|
22187
|
-
toolUseConfirm.onReject();
|
|
22188
|
-
onDone();
|
|
22189
|
-
return;
|
|
22190
|
-
}
|
|
22191
|
-
if (key.tab && focusedOption === "yes-launch-swarm") {
|
|
22192
|
-
setTeammateCount((prev) => {
|
|
22193
|
-
const allowed = [2, 3, 4, 6, 8];
|
|
22194
|
-
const idx = Math.max(0, allowed.indexOf(prev));
|
|
22195
|
-
return allowed[(idx + 1) % allowed.length];
|
|
22196
|
-
});
|
|
22197
|
-
return;
|
|
22198
|
-
}
|
|
22199
|
-
if (!(key.ctrl && input.toLowerCase() === "g")) return;
|
|
22200
|
-
void (async () => {
|
|
22201
|
-
if (planSource === "input") {
|
|
22202
|
-
const edited = await launchExternalEditor(planText);
|
|
22203
|
-
if (edited.text !== null) {
|
|
22204
|
-
setPlanText(edited.text);
|
|
22205
|
-
setPlanSaved(true);
|
|
22206
|
-
}
|
|
22207
|
-
return;
|
|
22208
|
-
}
|
|
22209
|
-
if (!planExists) {
|
|
22210
|
-
const initial = planText === planPlaceholder() ? "# Plan\n" : planText;
|
|
22211
|
-
try {
|
|
22212
|
-
writeFileSync5(planFilePath, initial, "utf-8");
|
|
22213
|
-
} catch {
|
|
22214
|
-
const edited = await launchExternalEditor(initial);
|
|
22215
|
-
if (edited.text !== null) {
|
|
22216
|
-
setPlanText(edited.text);
|
|
22217
|
-
setPlanSaved(true);
|
|
22218
|
-
}
|
|
22219
|
-
return;
|
|
22220
|
-
}
|
|
22221
|
-
}
|
|
22222
|
-
const opened = await launchExternalEditorForFilePath(planFilePath);
|
|
22223
|
-
if (opened.ok) {
|
|
22224
|
-
const next = readPlanFile(void 0, conversationKey);
|
|
22225
|
-
setPlanExists(next.exists);
|
|
22226
|
-
setPlanText(next.exists ? next.content : planPlaceholder());
|
|
22227
|
-
setPlanSaved(true);
|
|
22228
|
-
}
|
|
22229
|
-
})();
|
|
22230
|
-
});
|
|
22231
|
-
const bypassAvailable = toolUseConfirm.toolUseContext.options?.safeMode !== true;
|
|
22232
|
-
const launchSwarmAvailable = false;
|
|
22233
|
-
const options = useMemo23(
|
|
22234
|
-
() => getExitPlanModeOptions({
|
|
22235
|
-
bypassAvailable,
|
|
22236
|
-
launchSwarmAvailable,
|
|
22237
|
-
teammateCount
|
|
22238
|
-
}),
|
|
22239
|
-
[bypassAvailable, launchSwarmAvailable, teammateCount]
|
|
22240
|
-
);
|
|
22241
|
-
if (showRejectInput) {
|
|
22242
|
-
return /* @__PURE__ */ React89.createElement(
|
|
22243
|
-
Box68,
|
|
22244
|
-
{
|
|
22245
|
-
flexDirection: "column",
|
|
22246
|
-
borderStyle: "round",
|
|
22247
|
-
borderColor: theme.permission,
|
|
22248
|
-
marginTop: 1,
|
|
22249
|
-
paddingLeft: 1,
|
|
22250
|
-
paddingRight: 1,
|
|
22251
|
-
paddingBottom: 1
|
|
22252
|
-
},
|
|
22253
|
-
/* @__PURE__ */ React89.createElement(PermissionRequestTitle, { title: "No, keep planning", riskScore: null }),
|
|
22254
|
-
/* @__PURE__ */ React89.createElement(Box68, { flexDirection: "column", paddingX: 2, paddingY: 1 }, /* @__PURE__ */ React89.createElement(Text73, { dimColor: true }, "Type here to tell Pyb Agent what to change (Enter submits, Esc cancels)"), rejectError ? /* @__PURE__ */ React89.createElement(Text73, { color: theme.error }, rejectError) : null, /* @__PURE__ */ React89.createElement(
|
|
22255
|
-
TextInput,
|
|
22256
|
-
{
|
|
22257
|
-
value: rejectFeedback,
|
|
22258
|
-
onChange: (value) => {
|
|
22259
|
-
setRejectFeedback(value);
|
|
22260
|
-
setRejectError(null);
|
|
22261
|
-
},
|
|
22262
|
-
onSubmit: () => {
|
|
22263
|
-
const trimmed = rejectFeedback.trim();
|
|
22264
|
-
if (!trimmed) {
|
|
22265
|
-
setRejectError("Please enter what you want changed.");
|
|
22266
|
-
return;
|
|
22267
|
-
}
|
|
22268
|
-
toolUseConfirm.onReject(trimmed);
|
|
22269
|
-
onDone();
|
|
22270
|
-
},
|
|
22271
|
-
onExit: () => {
|
|
22272
|
-
setShowRejectInput(false);
|
|
22273
|
-
setRejectFeedback("");
|
|
22274
|
-
setRejectError(null);
|
|
22275
|
-
},
|
|
22276
|
-
columns: 80,
|
|
22277
|
-
cursorOffset: rejectCursorOffset,
|
|
22278
|
-
onChangeCursorOffset: setRejectCursorOffset
|
|
22279
|
-
}
|
|
22280
|
-
))
|
|
22281
|
-
);
|
|
22282
|
-
}
|
|
22283
|
-
return /* @__PURE__ */ React89.createElement(
|
|
22284
|
-
Box68,
|
|
22285
|
-
{
|
|
22286
|
-
flexDirection: "column",
|
|
22287
|
-
borderStyle: "round",
|
|
22288
|
-
borderColor: theme.permission,
|
|
22289
|
-
marginTop: 1,
|
|
22290
|
-
paddingLeft: 1,
|
|
22291
|
-
paddingRight: 1,
|
|
22292
|
-
paddingBottom: 1
|
|
22293
|
-
},
|
|
22294
|
-
/* @__PURE__ */ React89.createElement(PermissionRequestTitle, { title: "Ready to code?", riskScore: null }),
|
|
22295
|
-
/* @__PURE__ */ React89.createElement(Box68, { flexDirection: "column", paddingX: 2, paddingY: 1 }, /* @__PURE__ */ React89.createElement(Text73, null, "Here is Pyb Agent's plan:"), /* @__PURE__ */ React89.createElement(
|
|
22296
|
-
Box68,
|
|
22297
|
-
{
|
|
22298
|
-
borderStyle: "dashed",
|
|
22299
|
-
borderColor: theme.secondaryBorder,
|
|
22300
|
-
borderDimColor: true,
|
|
22301
|
-
borderLeft: false,
|
|
22302
|
-
borderRight: false,
|
|
22303
|
-
paddingX: 1,
|
|
22304
|
-
paddingY: 0,
|
|
22305
|
-
marginBottom: 1,
|
|
22306
|
-
flexDirection: "column"
|
|
22307
|
-
},
|
|
22308
|
-
/* @__PURE__ */ React89.createElement(Text73, null, planText)
|
|
22309
|
-
)),
|
|
22310
|
-
/* @__PURE__ */ React89.createElement(Box68, { flexDirection: "column", paddingX: 2 }, /* @__PURE__ */ React89.createElement(Text73, { dimColor: true }, "Tip: Press ctrl+g to edit", " ", planSource === "file" ? `plan file: ${planFilePath}` : "plan text", planSaved ? " \xB7 Plan saved!" : "")),
|
|
22311
|
-
/* @__PURE__ */ React89.createElement(Box68, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React89.createElement(Text73, { dimColor: true }, "Would you like to proceed?"), /* @__PURE__ */ React89.createElement(
|
|
22312
|
-
Select,
|
|
22313
|
-
{
|
|
22314
|
-
options,
|
|
22315
|
-
onFocus: (value) => setFocusedOption(value),
|
|
22316
|
-
onChange: (value) => {
|
|
22317
|
-
if (value === "no") {
|
|
22318
|
-
setShowRejectInput(true);
|
|
22319
|
-
return;
|
|
22320
|
-
}
|
|
22321
|
-
const nextMode = value === "yes-bypass" ? "bypassPermissions" : value === "yes-accept" ? "acceptEdits" : value === "yes-launch-swarm" ? "bypassPermissions" : "default";
|
|
22322
|
-
setMode(nextMode);
|
|
22323
|
-
if (value === "yes-launch-swarm") {
|
|
22324
|
-
;
|
|
22325
|
-
toolUseConfirm.input.launchSwarm = true;
|
|
22326
|
-
toolUseConfirm.input.teammateCount = teammateCount;
|
|
22327
|
-
}
|
|
22328
|
-
toolUseConfirm.onAllow("temporary");
|
|
22329
|
-
onDone();
|
|
22330
|
-
}
|
|
22331
|
-
}
|
|
22332
|
-
))
|
|
22333
|
-
);
|
|
22334
|
-
}
|
|
22335
|
-
|
|
22336
|
-
// src/tools/interaction/AskUserQuestionTool/AskUserQuestionTool.tsx
|
|
22337
|
-
import { Box as Box69, Text as Text74 } from "ink";
|
|
22338
|
-
import React90 from "react";
|
|
22339
|
-
import { z as z12 } from "zod";
|
|
22340
|
-
|
|
22341
|
-
// src/tools/interaction/AskUserQuestionTool/prompt.ts
|
|
22342
|
-
var TOOL_NAME_FOR_PROMPT6 = "AskUserQuestion";
|
|
22343
|
-
var DESCRIPTION6 = "Asks the user multiple choice questions to gather information, clarify ambiguity, understand preferences, make decisions or offer them choices.";
|
|
22344
|
-
var PROMPT6 = `Use this tool when you need to ask the user questions during execution. This allows you to:
|
|
22345
|
-
1. Gather user preferences or requirements
|
|
22346
|
-
2. Clarify ambiguous instructions
|
|
22347
|
-
3. Get decisions on implementation choices as you work
|
|
22348
|
-
4. Offer choices to the user about what direction to take.
|
|
22349
|
-
|
|
22350
|
-
Usage notes:
|
|
22351
|
-
- Users will always be able to select "Other" to provide custom text input
|
|
22352
|
-
- Use multiSelect: true to allow multiple answers to be selected for a question
|
|
22353
|
-
- If you recommend a specific option, make that the first option in the list and add "(Recommended)" at the end of the label`;
|
|
22354
|
-
|
|
22355
|
-
// src/tools/interaction/AskUserQuestionTool/AskUserQuestionTool.tsx
|
|
22356
|
-
var optionSchema = z12.object({
|
|
22357
|
-
label: z12.string(),
|
|
22358
|
-
description: z12.string()
|
|
22359
|
-
});
|
|
22360
|
-
var questionSchema = z12.object({
|
|
22361
|
-
question: z12.string(),
|
|
22362
|
-
header: z12.string(),
|
|
22363
|
-
options: z12.array(optionSchema).min(2).max(4),
|
|
22364
|
-
multiSelect: z12.boolean()
|
|
22365
|
-
});
|
|
22366
|
-
var inputSchema12 = z12.strictObject({
|
|
22367
|
-
questions: z12.array(questionSchema).min(1).max(4),
|
|
22368
|
-
answers: z12.record(z12.string(), z12.string()).optional()
|
|
22369
|
-
}).refine(
|
|
22370
|
-
(input) => {
|
|
22371
|
-
const questionTexts = input.questions.map((q) => q.question);
|
|
22372
|
-
if (questionTexts.length !== new Set(questionTexts).size) return false;
|
|
22373
|
-
for (const question of input.questions) {
|
|
22374
|
-
const optionLabels = question.options.map((option) => option.label);
|
|
22375
|
-
if (optionLabels.length !== new Set(optionLabels).size) return false;
|
|
22376
|
-
}
|
|
22377
|
-
return true;
|
|
22378
|
-
},
|
|
22379
|
-
{
|
|
22380
|
-
message: "Question texts must be unique, option labels must be unique within each question"
|
|
22381
|
-
}
|
|
22382
|
-
);
|
|
22383
|
-
var AskUserQuestionTool = {
|
|
22384
|
-
name: TOOL_NAME_FOR_PROMPT6,
|
|
22385
|
-
async description() {
|
|
22386
|
-
return DESCRIPTION6;
|
|
22387
|
-
},
|
|
22388
|
-
userFacingName() {
|
|
22389
|
-
return "";
|
|
22390
|
-
},
|
|
22391
|
-
inputSchema: inputSchema12,
|
|
22392
|
-
isReadOnly() {
|
|
22393
|
-
return true;
|
|
22394
|
-
},
|
|
22395
|
-
isConcurrencySafe() {
|
|
22396
|
-
return true;
|
|
22397
|
-
},
|
|
22398
|
-
async isEnabled() {
|
|
22399
|
-
return true;
|
|
22400
|
-
},
|
|
22401
|
-
needsPermissions() {
|
|
22402
|
-
return true;
|
|
22403
|
-
},
|
|
22404
|
-
requiresUserInteraction() {
|
|
22405
|
-
return true;
|
|
22406
|
-
},
|
|
22407
|
-
async prompt() {
|
|
22408
|
-
return PROMPT6;
|
|
22409
|
-
},
|
|
22410
|
-
renderToolUseMessage() {
|
|
22411
|
-
return null;
|
|
22412
|
-
},
|
|
22413
|
-
renderToolUseRejectedMessage() {
|
|
22414
|
-
const theme = getTheme();
|
|
22415
|
-
return /* @__PURE__ */ React90.createElement(Box69, { flexDirection: "row", marginTop: 1 }, /* @__PURE__ */ React90.createElement(Text74, { color: theme.text }, BLACK_CIRCLE, "\xA0"), /* @__PURE__ */ React90.createElement(Text74, null, "User declined to answer questions"));
|
|
22416
|
-
},
|
|
22417
|
-
renderToolResultMessage(output, _options) {
|
|
22418
|
-
const theme = getTheme();
|
|
22419
|
-
return /* @__PURE__ */ React90.createElement(Box69, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React90.createElement(Box69, { flexDirection: "row" }, /* @__PURE__ */ React90.createElement(Text74, { color: theme.text }, BLACK_CIRCLE, "\xA0"), /* @__PURE__ */ React90.createElement(Text74, null, "User answered Pyb Agent's questions:")), /* @__PURE__ */ React90.createElement(Box69, { flexDirection: "column", paddingLeft: 2 }, Object.entries(output.answers).map(([question, answer]) => /* @__PURE__ */ React90.createElement(Box69, { key: question }, /* @__PURE__ */ React90.createElement(Text74, { dimColor: true }, "\xB7 ", question, " \u2192 ", answer)))));
|
|
22420
|
-
},
|
|
22421
|
-
renderResultForAssistant(output) {
|
|
22422
|
-
const formatted = Object.entries(output.answers).map(([question, answer]) => `"${question}"="${answer}"`).join(", ");
|
|
22423
|
-
return `User has answered your questions: ${formatted}. You can now continue with the user's answers in mind.`;
|
|
22424
|
-
},
|
|
22425
|
-
async *call({ questions, answers: prefilled }) {
|
|
22426
|
-
const output = { questions, answers: prefilled ?? {} };
|
|
22427
|
-
yield {
|
|
22428
|
-
type: "result",
|
|
22429
|
-
data: output,
|
|
22430
|
-
resultForAssistant: this.renderResultForAssistant(output)
|
|
22431
|
-
};
|
|
22432
|
-
}
|
|
22433
|
-
};
|
|
22434
|
-
|
|
22435
|
-
// src/ui/components/permissions/ask-user-question-permission-request/AskUserQuestionPermissionRequest.tsx
|
|
22436
|
-
import React91, { useCallback as useCallback11, useMemo as useMemo24, useState as useState22 } from "react";
|
|
22437
|
-
import { Box as Box70, Text as Text75, useInput as useInput24 } from "ink";
|
|
22438
|
-
import figures8 from "figures";
|
|
22439
|
-
import stringWidth from "string-width";
|
|
22440
|
-
function isTextInputChar(input, key) {
|
|
22441
|
-
if (key.ctrl || key.meta || key.tab) return false;
|
|
22442
|
-
if (typeof input !== "string" || input.length === 0) return false;
|
|
22443
|
-
for (const char of input) {
|
|
22444
|
-
const code = char.codePointAt(0);
|
|
22445
|
-
if (code === void 0) return false;
|
|
22446
|
-
if (code < 32 || code === 127) return false;
|
|
22447
|
-
}
|
|
22448
|
-
return true;
|
|
22449
|
-
}
|
|
22450
|
-
function applySingleSelectNav(args) {
|
|
22451
|
-
const { focusedOptionIndex, key, optionCount } = args;
|
|
22452
|
-
if (key.downArrow) return Math.min(optionCount - 1, focusedOptionIndex + 1);
|
|
22453
|
-
if (key.upArrow) return Math.max(0, focusedOptionIndex - 1);
|
|
22454
|
-
return focusedOptionIndex;
|
|
22455
|
-
}
|
|
22456
|
-
function applyMultiSelectNav(args) {
|
|
22457
|
-
const { state, key, optionCount } = args;
|
|
22458
|
-
const nextKey = key.downArrow || key.tab && !key.shift;
|
|
22459
|
-
const prevKey = key.upArrow || key.tab && key.shift;
|
|
22460
|
-
if (state.isSubmitFocused) {
|
|
22461
|
-
if (prevKey) {
|
|
22462
|
-
return {
|
|
22463
|
-
focusedOptionIndex: Math.max(0, optionCount - 1),
|
|
22464
|
-
isSubmitFocused: false
|
|
22465
|
-
};
|
|
22466
|
-
}
|
|
22467
|
-
return state;
|
|
22468
|
-
}
|
|
22469
|
-
if (nextKey) {
|
|
22470
|
-
if (state.focusedOptionIndex >= optionCount - 1) {
|
|
22471
|
-
return { ...state, isSubmitFocused: true };
|
|
22472
|
-
}
|
|
22473
|
-
return { ...state, focusedOptionIndex: state.focusedOptionIndex + 1 };
|
|
22474
|
-
}
|
|
22475
|
-
if (prevKey) {
|
|
22476
|
-
return {
|
|
22477
|
-
...state,
|
|
22478
|
-
focusedOptionIndex: Math.max(0, state.focusedOptionIndex - 1)
|
|
22479
|
-
};
|
|
22480
|
-
}
|
|
22481
|
-
return state;
|
|
22482
|
-
}
|
|
22483
|
-
function truncateWithEllipsis(label, maxWidth) {
|
|
22484
|
-
if (stringWidth(label) <= maxWidth) return label;
|
|
22485
|
-
let candidate = label;
|
|
22486
|
-
while (candidate.length > 1 && stringWidth(candidate + "\u2026") > maxWidth) {
|
|
22487
|
-
candidate = candidate.slice(0, -1);
|
|
21683
|
+
return state;
|
|
21684
|
+
}
|
|
21685
|
+
function truncateWithEllipsis(label, maxWidth) {
|
|
21686
|
+
if (stringWidth(label) <= maxWidth) return label;
|
|
21687
|
+
let candidate = label;
|
|
21688
|
+
while (candidate.length > 1 && stringWidth(candidate + "\u2026") > maxWidth) {
|
|
21689
|
+
candidate = candidate.slice(0, -1);
|
|
22488
21690
|
}
|
|
22489
21691
|
return candidate.length ? candidate + "\u2026" : "\u2026";
|
|
22490
21692
|
}
|
|
@@ -22541,7 +21743,7 @@ function AskUserQuestionPermissionRequest({
|
|
|
22541
21743
|
}) {
|
|
22542
21744
|
const theme = getTheme();
|
|
22543
21745
|
const { columns } = useTerminalSize();
|
|
22544
|
-
const parsed =
|
|
21746
|
+
const parsed = useMemo23(() => {
|
|
22545
21747
|
const result = AskUserQuestionTool.inputSchema.safeParse(
|
|
22546
21748
|
toolUseConfirm.input
|
|
22547
21749
|
);
|
|
@@ -22556,18 +21758,18 @@ function AskUserQuestionPermissionRequest({
|
|
|
22556
21758
|
};
|
|
22557
21759
|
}, [toolUseConfirm.input]);
|
|
22558
21760
|
const questions = parsed.questions;
|
|
22559
|
-
const [currentQuestionIndex, setCurrentQuestionIndex] =
|
|
22560
|
-
const [focusedOptionIndex, setFocusedOptionIndex] =
|
|
22561
|
-
const [isMultiSelectSubmitFocused, setIsMultiSelectSubmitFocused] =
|
|
22562
|
-
const [answers, setAnswers] =
|
|
21761
|
+
const [currentQuestionIndex, setCurrentQuestionIndex] = useState21(0);
|
|
21762
|
+
const [focusedOptionIndex, setFocusedOptionIndex] = useState21(0);
|
|
21763
|
+
const [isMultiSelectSubmitFocused, setIsMultiSelectSubmitFocused] = useState21(false);
|
|
21764
|
+
const [answers, setAnswers] = useState21(
|
|
22563
21765
|
parsed.initialAnswers
|
|
22564
21766
|
);
|
|
22565
|
-
const [questionStates, setQuestionStates] =
|
|
21767
|
+
const [questionStates, setQuestionStates] = useState21({});
|
|
22566
21768
|
const currentQuestion = questions[currentQuestionIndex];
|
|
22567
21769
|
const isSubmitTab = currentQuestionIndex === questions.length;
|
|
22568
21770
|
const hideSubmitTab = questions.length === 1 && !questions[0]?.multiSelect;
|
|
22569
21771
|
const maxTabIndex = hideSubmitTab ? Math.max(0, questions.length - 1) : questions.length;
|
|
22570
|
-
const tabHeaders =
|
|
21772
|
+
const tabHeaders = useMemo23(
|
|
22571
21773
|
() => getTabHeaders({
|
|
22572
21774
|
questions,
|
|
22573
21775
|
currentQuestionIndex,
|
|
@@ -22613,7 +21815,7 @@ function AskUserQuestionPermissionRequest({
|
|
|
22613
21815
|
},
|
|
22614
21816
|
[]
|
|
22615
21817
|
);
|
|
22616
|
-
|
|
21818
|
+
useInput22((input, key) => {
|
|
22617
21819
|
if (key.escape) {
|
|
22618
21820
|
cancel();
|
|
22619
21821
|
return;
|
|
@@ -22788,18 +21990,18 @@ function AskUserQuestionPermissionRequest({
|
|
|
22788
21990
|
const rightArrowInactive = currentQuestionIndex === maxTabIndex;
|
|
22789
21991
|
const allQuestionsAnswered = questions.every((q) => q?.question && Boolean(answers[q.question])) ?? false;
|
|
22790
21992
|
if (questions.length === 0) {
|
|
22791
|
-
return /* @__PURE__ */
|
|
21993
|
+
return /* @__PURE__ */ React87.createElement(Box66, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React87.createElement(Text71, { color: theme.error }, "Invalid AskUserQuestion input."), /* @__PURE__ */ React87.createElement(Text71, { dimColor: true }, "Press Esc to cancel."));
|
|
22792
21994
|
}
|
|
22793
|
-
return /* @__PURE__ */
|
|
22794
|
-
|
|
21995
|
+
return /* @__PURE__ */ React87.createElement(Box66, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React87.createElement(
|
|
21996
|
+
Box66,
|
|
22795
21997
|
{
|
|
22796
21998
|
borderTop: true,
|
|
22797
21999
|
borderColor: theme.secondaryText,
|
|
22798
22000
|
flexDirection: "column",
|
|
22799
22001
|
paddingTop: 0
|
|
22800
22002
|
},
|
|
22801
|
-
/* @__PURE__ */
|
|
22802
|
-
|
|
22003
|
+
/* @__PURE__ */ React87.createElement(Box66, { flexDirection: "row", marginBottom: 1 }, showArrows && /* @__PURE__ */ React87.createElement(
|
|
22004
|
+
Text71,
|
|
22803
22005
|
{
|
|
22804
22006
|
color: currentQuestionIndex === 0 ? theme.secondaryText : void 0
|
|
22805
22007
|
},
|
|
@@ -22810,16 +22012,16 @@ function AskUserQuestionPermissionRequest({
|
|
|
22810
22012
|
const checkbox = question.question && answers[question.question] ? figures8.checkboxOn : figures8.checkboxOff;
|
|
22811
22013
|
const headerText = tabHeaders[index] ?? question.header ?? `Q${index + 1}`;
|
|
22812
22014
|
const tabText = ` ${checkbox} ${headerText} `;
|
|
22813
|
-
return /* @__PURE__ */
|
|
22814
|
-
|
|
22015
|
+
return /* @__PURE__ */ React87.createElement(React87.Fragment, { key: question.question || `question-${index}` }, /* @__PURE__ */ React87.createElement(
|
|
22016
|
+
Text71,
|
|
22815
22017
|
{
|
|
22816
22018
|
backgroundColor: isSelected ? theme.permission : void 0,
|
|
22817
22019
|
color: isSelected ? inverseText : void 0
|
|
22818
22020
|
},
|
|
22819
22021
|
tabText
|
|
22820
22022
|
));
|
|
22821
|
-
}), !hideSubmitTab && /* @__PURE__ */
|
|
22822
|
-
|
|
22023
|
+
}), !hideSubmitTab && /* @__PURE__ */ React87.createElement(
|
|
22024
|
+
Text71,
|
|
22823
22025
|
{
|
|
22824
22026
|
backgroundColor: isSubmitTab ? theme.permission : void 0,
|
|
22825
22027
|
color: isSubmitTab ? inverseText : void 0
|
|
@@ -22828,23 +22030,23 @@ function AskUserQuestionPermissionRequest({
|
|
|
22828
22030
|
figures8.tick,
|
|
22829
22031
|
" Submit",
|
|
22830
22032
|
" "
|
|
22831
|
-
), showArrows && /* @__PURE__ */
|
|
22832
|
-
!isSubmitTab && currentQuestion && /* @__PURE__ */
|
|
22033
|
+
), showArrows && /* @__PURE__ */ React87.createElement(Text71, { color: rightArrowInactive ? theme.secondaryText : void 0 }, " ", "\u2192")),
|
|
22034
|
+
!isSubmitTab && currentQuestion && /* @__PURE__ */ React87.createElement(React87.Fragment, null, /* @__PURE__ */ React87.createElement(Text71, { bold: true }, currentQuestion.question), /* @__PURE__ */ React87.createElement(Box66, { flexDirection: "column", marginTop: 1 }, (() => {
|
|
22833
22035
|
const rawSelected = activeQuestionState?.selectedValue;
|
|
22834
22036
|
const selectedValues = Array.isArray(rawSelected) ? rawSelected : [];
|
|
22835
22037
|
const otherSelected = currentQuestion.multiSelect ? selectedValues.includes("__other__") : rawSelected === "__other__";
|
|
22836
22038
|
const otherText = questionStates[currentQuestion.question]?.textInputValue ?? "";
|
|
22837
22039
|
const otherPlaceholder = currentQuestion.multiSelect ? "Type something" : "Type something.";
|
|
22838
22040
|
const otherLine = otherText.length > 0 ? otherText : isOtherFocused || otherSelected ? otherPlaceholder : "";
|
|
22839
|
-
return /* @__PURE__ */
|
|
22041
|
+
return /* @__PURE__ */ React87.createElement(React87.Fragment, null, currentQuestion.options.map((option, index) => {
|
|
22840
22042
|
const isFocused = !isMultiSelectSubmitFocused && index === focusedOptionIndex;
|
|
22841
22043
|
const isSelected = currentQuestion.multiSelect ? selectedValues.includes(option.label) : rawSelected === option.label;
|
|
22842
22044
|
const pointer = isFocused ? figures8.pointer : " ";
|
|
22843
22045
|
const color = isFocused ? theme.pyb : theme.text;
|
|
22844
22046
|
const indicator = currentQuestion.multiSelect ? isSelected ? figures8.checkboxOn : figures8.checkboxOff : isSelected ? figures8.tick : " ";
|
|
22845
|
-
return /* @__PURE__ */
|
|
22846
|
-
}), /* @__PURE__ */
|
|
22847
|
-
|
|
22047
|
+
return /* @__PURE__ */ React87.createElement(Box66, { key: option.label, flexDirection: "column" }, /* @__PURE__ */ React87.createElement(Text71, { color }, pointer, " ", indicator, " ", option.label), /* @__PURE__ */ React87.createElement(Text71, { color: theme.secondaryText }, " ", option.description));
|
|
22048
|
+
}), /* @__PURE__ */ React87.createElement(Box66, { flexDirection: "column" }, /* @__PURE__ */ React87.createElement(Text71, { color: isOtherFocused ? theme.pyb : theme.text }, isOtherFocused ? figures8.pointer : " ", " ", currentQuestion.multiSelect ? otherSelected ? figures8.checkboxOn : figures8.checkboxOff : otherSelected ? figures8.tick : " ", " ", "Other"), (isOtherFocused || otherSelected || otherText.trim().length > 0) && /* @__PURE__ */ React87.createElement(Text71, { color: theme.secondaryText }, otherLine, isOtherFocused && /* @__PURE__ */ React87.createElement(Text71, { color: "gray" }, "\u258C"))), currentQuestion.multiSelect && /* @__PURE__ */ React87.createElement(Box66, { marginTop: 0 }, /* @__PURE__ */ React87.createElement(
|
|
22049
|
+
Text71,
|
|
22848
22050
|
{
|
|
22849
22051
|
color: isMultiSelectSubmitFocused ? theme.pyb : theme.text,
|
|
22850
22052
|
bold: isMultiSelectSubmitFocused
|
|
@@ -22852,9 +22054,9 @@ function AskUserQuestionPermissionRequest({
|
|
|
22852
22054
|
isMultiSelectSubmitFocused ? figures8.pointer : " ",
|
|
22853
22055
|
" ",
|
|
22854
22056
|
currentQuestionIndex === questions.length - 1 ? "Submit" : "Next"
|
|
22855
|
-
)), /* @__PURE__ */
|
|
22057
|
+
)), /* @__PURE__ */ React87.createElement(Box66, { marginTop: 1 }, /* @__PURE__ */ React87.createElement(Text71, { color: theme.secondaryText, dimColor: true }, "Enter to select \xB7 Tab/Arrow keys to navigate \xB7 Esc to cancel")));
|
|
22856
22058
|
})())),
|
|
22857
|
-
isSubmitTab && /* @__PURE__ */
|
|
22059
|
+
isSubmitTab && /* @__PURE__ */ React87.createElement(Box66, { flexDirection: "column" }, /* @__PURE__ */ React87.createElement(Text71, { bold: true }, "Review your answers"), !allQuestionsAnswered && /* @__PURE__ */ React87.createElement(Box66, { marginTop: 1 }, /* @__PURE__ */ React87.createElement(Text71, { color: theme.warning }, figures8.warning, " You have not answered all questions")), /* @__PURE__ */ React87.createElement(Box66, { flexDirection: "column", marginTop: 1 }, questions.filter((q) => q?.question && answers[q.question]).map((q) => /* @__PURE__ */ React87.createElement(Box66, { key: q.question, flexDirection: "column", marginLeft: 1 }, /* @__PURE__ */ React87.createElement(Text71, null, figures8.bullet, " ", q.question), /* @__PURE__ */ React87.createElement(Box66, { marginLeft: 2 }, /* @__PURE__ */ React87.createElement(Text71, { color: theme.success }, figures8.arrowRight, " ", answers[q.question]))))), /* @__PURE__ */ React87.createElement(Box66, { marginTop: 1 }, /* @__PURE__ */ React87.createElement(Text71, { color: theme.secondaryText }, "Ready to submit your answers?")), /* @__PURE__ */ React87.createElement(Box66, { marginTop: 1 }, /* @__PURE__ */ React87.createElement(
|
|
22858
22060
|
Select,
|
|
22859
22061
|
{
|
|
22860
22062
|
options: [
|
|
@@ -22895,10 +22097,6 @@ function permissionComponentForTool(tool) {
|
|
|
22895
22097
|
return SkillPermissionRequest;
|
|
22896
22098
|
case WebFetchTool:
|
|
22897
22099
|
return WebFetchPermissionRequest;
|
|
22898
|
-
case EnterPlanModeTool:
|
|
22899
|
-
return EnterPlanModePermissionRequest;
|
|
22900
|
-
case ExitPlanModeTool:
|
|
22901
|
-
return ExitPlanModePermissionRequest;
|
|
22902
22100
|
case AskUserQuestionTool:
|
|
22903
22101
|
return AskUserQuestionPermissionRequest;
|
|
22904
22102
|
default:
|
|
@@ -22913,7 +22111,7 @@ function PermissionRequest({
|
|
|
22913
22111
|
onDone,
|
|
22914
22112
|
verbose
|
|
22915
22113
|
}) {
|
|
22916
|
-
|
|
22114
|
+
useInput23((input, key) => {
|
|
22917
22115
|
if (key.ctrl && input === "c") {
|
|
22918
22116
|
onDone();
|
|
22919
22117
|
toolUseConfirm.onReject();
|
|
@@ -22924,7 +22122,7 @@ function PermissionRequest({
|
|
|
22924
22122
|
`${PRODUCT_NAME} needs your permission to use ${toolName}`
|
|
22925
22123
|
);
|
|
22926
22124
|
const PermissionComponent = permissionComponentForTool(toolUseConfirm.tool);
|
|
22927
|
-
return /* @__PURE__ */
|
|
22125
|
+
return /* @__PURE__ */ React88.createElement(
|
|
22928
22126
|
PermissionComponent,
|
|
22929
22127
|
{
|
|
22930
22128
|
toolUseConfirm,
|
|
@@ -22935,11 +22133,11 @@ function PermissionRequest({
|
|
|
22935
22133
|
}
|
|
22936
22134
|
|
|
22937
22135
|
// src/ui/components/PromptInput.tsx
|
|
22938
|
-
import { Box as
|
|
22939
|
-
import * as
|
|
22136
|
+
import { Box as Box69, Text as Text74, useInput as useInput25 } from "ink";
|
|
22137
|
+
import * as React92 from "react";
|
|
22940
22138
|
|
|
22941
22139
|
// src/ui/hooks/useArrowKeyHistory.ts
|
|
22942
|
-
import { useState as
|
|
22140
|
+
import { useState as useState22 } from "react";
|
|
22943
22141
|
|
|
22944
22142
|
// src/app/history.ts
|
|
22945
22143
|
var MAX_HISTORY_ITEMS = 100;
|
|
@@ -22961,8 +22159,8 @@ function addToHistory(command4) {
|
|
|
22961
22159
|
|
|
22962
22160
|
// src/ui/hooks/useArrowKeyHistory.ts
|
|
22963
22161
|
function useArrowKeyHistory(onSetInput, currentInput) {
|
|
22964
|
-
const [historyIndex, setHistoryIndex] =
|
|
22965
|
-
const [lastTypedInput, setLastTypedInput] =
|
|
22162
|
+
const [historyIndex, setHistoryIndex] = useState22(0);
|
|
22163
|
+
const [lastTypedInput, setLastTypedInput] = useState22("");
|
|
22966
22164
|
const updateInput = (input) => {
|
|
22967
22165
|
if (input !== void 0) {
|
|
22968
22166
|
const mode = input.startsWith("!") ? "bash" : "prompt";
|
|
@@ -23006,8 +22204,8 @@ function useArrowKeyHistory(onSetInput, currentInput) {
|
|
|
23006
22204
|
}
|
|
23007
22205
|
|
|
23008
22206
|
// src/ui/hooks/useUnifiedCompletion.ts
|
|
23009
|
-
import { useState as
|
|
23010
|
-
import { useInput as
|
|
22207
|
+
import { useState as useState23, useCallback as useCallback12, useEffect as useEffect20, useRef as useRef9 } from "react";
|
|
22208
|
+
import { useInput as useInput24 } from "ink";
|
|
23011
22209
|
|
|
23012
22210
|
// src/utils/completion/context.ts
|
|
23013
22211
|
function getCompletionContext(args) {
|
|
@@ -23078,7 +22276,7 @@ function getCompletionContext(args) {
|
|
|
23078
22276
|
|
|
23079
22277
|
// src/utils/completion/fileSuggestions.ts
|
|
23080
22278
|
import { existsSync as existsSync13, readdirSync as readdirSync3, statSync as statSync11 } from "fs";
|
|
23081
|
-
import { basename as basename4, dirname as dirname8, join as
|
|
22279
|
+
import { basename as basename4, dirname as dirname8, join as join8, resolve as resolve8 } from "path";
|
|
23082
22280
|
function generateFileSuggestions(args) {
|
|
23083
22281
|
const { prefix, cwd } = args;
|
|
23084
22282
|
try {
|
|
@@ -23112,8 +22310,8 @@ function generateFileSuggestions(args) {
|
|
|
23112
22310
|
return false;
|
|
23113
22311
|
return true;
|
|
23114
22312
|
}).sort((a, b) => {
|
|
23115
|
-
const aPath =
|
|
23116
|
-
const bPath =
|
|
22313
|
+
const aPath = join8(searchDir, a);
|
|
22314
|
+
const bPath = join8(searchDir, b);
|
|
23117
22315
|
const aIsDir = statSync11(aPath).isDirectory();
|
|
23118
22316
|
const bIsDir = statSync11(bPath).isDirectory();
|
|
23119
22317
|
if (aIsDir && !bIsDir) return -1;
|
|
@@ -23121,7 +22319,7 @@ function generateFileSuggestions(args) {
|
|
|
23121
22319
|
return a.toLowerCase().localeCompare(b.toLowerCase());
|
|
23122
22320
|
}).slice(0, 25);
|
|
23123
22321
|
return entries.map((entry) => {
|
|
23124
|
-
const entryPath =
|
|
22322
|
+
const entryPath = join8(searchDir, entry);
|
|
23125
22323
|
const isDir = statSync11(entryPath).isDirectory();
|
|
23126
22324
|
const icon = isDir ? "\u{1F4C1}" : "\u{1F4C4}";
|
|
23127
22325
|
let value;
|
|
@@ -24413,7 +23611,7 @@ function useUnifiedCompletion({
|
|
|
24413
23611
|
disableSlashCommands = false,
|
|
24414
23612
|
onSubmit
|
|
24415
23613
|
}) {
|
|
24416
|
-
const [state, setState] =
|
|
23614
|
+
const [state, setState] = useState23(INITIAL_STATE);
|
|
24417
23615
|
const updateState = useCallback12((updates) => {
|
|
24418
23616
|
setState((prev) => ({ ...prev, ...updates }));
|
|
24419
23617
|
}, []);
|
|
@@ -24449,8 +23647,8 @@ function useUnifiedCompletion({
|
|
|
24449
23647
|
disableSlashCommands
|
|
24450
23648
|
});
|
|
24451
23649
|
}, [input, cursorOffset, disableSlashCommands]);
|
|
24452
|
-
const [systemCommands, setSystemCommands] =
|
|
24453
|
-
const [isLoadingCommands, setIsLoadingCommands] =
|
|
23650
|
+
const [systemCommands, setSystemCommands] = useState23([]);
|
|
23651
|
+
const [isLoadingCommands, setIsLoadingCommands] = useState23(false);
|
|
24454
23652
|
const loadSystemCommands = useCallback12(async () => {
|
|
24455
23653
|
if (systemCommands.length > 0 || isLoadingCommands) return;
|
|
24456
23654
|
setIsLoadingCommands(true);
|
|
@@ -24490,16 +23688,16 @@ function useUnifiedCompletion({
|
|
|
24490
23688
|
setIsLoadingCommands(false);
|
|
24491
23689
|
}
|
|
24492
23690
|
}, [systemCommands.length, isLoadingCommands]);
|
|
24493
|
-
|
|
23691
|
+
useEffect20(() => {
|
|
24494
23692
|
loadSystemCommands();
|
|
24495
23693
|
}, [loadSystemCommands]);
|
|
24496
|
-
const [agentSuggestions, setAgentSuggestions] =
|
|
23694
|
+
const [agentSuggestions, setAgentSuggestions] = useState23(
|
|
24497
23695
|
[]
|
|
24498
23696
|
);
|
|
24499
|
-
const [modelSuggestions, setModelSuggestions] =
|
|
23697
|
+
const [modelSuggestions, setModelSuggestions] = useState23(
|
|
24500
23698
|
[]
|
|
24501
23699
|
);
|
|
24502
|
-
|
|
23700
|
+
useEffect20(() => {
|
|
24503
23701
|
try {
|
|
24504
23702
|
const modelManager = getModelManager();
|
|
24505
23703
|
const allModels = modelManager.getAllAvailableModelNames();
|
|
@@ -24521,7 +23719,7 @@ function useUnifiedCompletion({
|
|
|
24521
23719
|
setModelSuggestions([]);
|
|
24522
23720
|
}
|
|
24523
23721
|
}, []);
|
|
24524
|
-
|
|
23722
|
+
useEffect20(() => {
|
|
24525
23723
|
getActiveAgents().then((agents) => {
|
|
24526
23724
|
const suggestions2 = agents.map((config2) => {
|
|
24527
23725
|
let shortDesc = config2.whenToUse;
|
|
@@ -24655,7 +23853,7 @@ function useUnifiedCompletion({
|
|
|
24655
23853
|
},
|
|
24656
23854
|
[input, onInputChange, setCursorOffset]
|
|
24657
23855
|
);
|
|
24658
|
-
|
|
23856
|
+
useInput24((input_str, key) => {
|
|
24659
23857
|
if (!__shouldHandleUnifiedCompletionTabKeyForTests(key)) return false;
|
|
24660
23858
|
const context = getWordAtCursor();
|
|
24661
23859
|
if (!context) return false;
|
|
@@ -24728,7 +23926,7 @@ function useUnifiedCompletion({
|
|
|
24728
23926
|
return true;
|
|
24729
23927
|
}
|
|
24730
23928
|
});
|
|
24731
|
-
|
|
23929
|
+
useInput24((inputChar, key) => {
|
|
24732
23930
|
if (key.return && !key.shift && !key.meta && state.isActive && state.suggestions.length > 0) {
|
|
24733
23931
|
const selectedSuggestion = state.suggestions[state.selectedIndex];
|
|
24734
23932
|
if (selectedSuggestion && state.context) {
|
|
@@ -24845,7 +24043,7 @@ function useUnifiedCompletion({
|
|
|
24845
24043
|
}
|
|
24846
24044
|
return false;
|
|
24847
24045
|
});
|
|
24848
|
-
|
|
24046
|
+
useInput24((input_str, key) => {
|
|
24849
24047
|
if (key.backspace || key.delete) {
|
|
24850
24048
|
if (state.isActive) {
|
|
24851
24049
|
resetCompletion();
|
|
@@ -24859,7 +24057,7 @@ function useUnifiedCompletion({
|
|
|
24859
24057
|
return false;
|
|
24860
24058
|
});
|
|
24861
24059
|
const lastInputRef = useRef9("");
|
|
24862
|
-
|
|
24060
|
+
useEffect20(() => {
|
|
24863
24061
|
if (lastInputRef.current === input) return;
|
|
24864
24062
|
const inputLengthChange = Math.abs(
|
|
24865
24063
|
input.length - lastInputRef.current.length
|
|
@@ -24953,7 +24151,7 @@ function __shouldHandleUnifiedCompletionTabKeyForTests(key) {
|
|
|
24953
24151
|
}
|
|
24954
24152
|
|
|
24955
24153
|
// src/ui/components/PromptInput.tsx
|
|
24956
|
-
import { memo, useCallback as useCallback13, useEffect as
|
|
24154
|
+
import { memo, useCallback as useCallback13, useEffect as useEffect22, useMemo as useMemo24, useState as useState25 } from "react";
|
|
24957
24155
|
|
|
24958
24156
|
// src/utils/model/tokens.ts
|
|
24959
24157
|
function countTokens(messages) {
|
|
@@ -24970,8 +24168,8 @@ function countTokens(messages) {
|
|
|
24970
24168
|
}
|
|
24971
24169
|
|
|
24972
24170
|
// src/ui/components/SentryErrorBoundary.ts
|
|
24973
|
-
import * as
|
|
24974
|
-
var SentryErrorBoundary = class extends
|
|
24171
|
+
import * as React89 from "react";
|
|
24172
|
+
var SentryErrorBoundary = class extends React89.Component {
|
|
24975
24173
|
constructor(props) {
|
|
24976
24174
|
super(props);
|
|
24977
24175
|
this.state = { hasError: false };
|
|
@@ -24994,8 +24192,8 @@ var SentryErrorBoundary = class extends React93.Component {
|
|
|
24994
24192
|
};
|
|
24995
24193
|
|
|
24996
24194
|
// src/ui/components/TokenWarning.tsx
|
|
24997
|
-
import { Box as
|
|
24998
|
-
import * as
|
|
24195
|
+
import { Box as Box67, Text as Text72 } from "ink";
|
|
24196
|
+
import * as React90 from "react";
|
|
24999
24197
|
var MAX_TOKENS = 19e4;
|
|
25000
24198
|
var WARNING_THRESHOLD = MAX_TOKENS * 0.6;
|
|
25001
24199
|
var ERROR_THRESHOLD = MAX_TOKENS * 0.8;
|
|
@@ -25005,12 +24203,149 @@ function TokenWarning({ tokenUsage }) {
|
|
|
25005
24203
|
return null;
|
|
25006
24204
|
}
|
|
25007
24205
|
const isError = tokenUsage >= ERROR_THRESHOLD;
|
|
25008
|
-
return /* @__PURE__ */
|
|
24206
|
+
return /* @__PURE__ */ React90.createElement(Box67, { flexDirection: "row" }, /* @__PURE__ */ React90.createElement(Text72, { color: isError ? theme.error : theme.warning }, "Context low (", Math.max(0, 100 - Math.round(tokenUsage / MAX_TOKENS * 100)), "% remaining) \xB7 Run /compact to compact & continue"));
|
|
24207
|
+
}
|
|
24208
|
+
|
|
24209
|
+
// src/utils/system/externalEditor.ts
|
|
24210
|
+
import { spawn, spawnSync } from "child_process";
|
|
24211
|
+
import { mkdtempSync, readFileSync as readFileSync9, rmSync as rmSync2, writeFileSync as writeFileSync4 } from "fs";
|
|
24212
|
+
import { tmpdir } from "os";
|
|
24213
|
+
import { join as join9 } from "path";
|
|
24214
|
+
var isWindows = process.platform === "win32";
|
|
24215
|
+
function isCommandAvailable(command4) {
|
|
24216
|
+
const checker = isWindows ? "where" : "which";
|
|
24217
|
+
const result = spawnSync(checker, [command4], { stdio: "ignore" });
|
|
24218
|
+
return result.status === 0;
|
|
24219
|
+
}
|
|
24220
|
+
function resolveEditorCommand() {
|
|
24221
|
+
const envEditor = process.env.VISUAL || process.env.EDITOR;
|
|
24222
|
+
if (envEditor?.trim()) {
|
|
24223
|
+
return {
|
|
24224
|
+
command: envEditor.trim(),
|
|
24225
|
+
args: [],
|
|
24226
|
+
displayName: envEditor.trim(),
|
|
24227
|
+
shell: true
|
|
24228
|
+
};
|
|
24229
|
+
}
|
|
24230
|
+
const candidates = [];
|
|
24231
|
+
if (isCommandAvailable("code")) {
|
|
24232
|
+
candidates.push({
|
|
24233
|
+
command: "code",
|
|
24234
|
+
args: ["-w"],
|
|
24235
|
+
displayName: "code -w"
|
|
24236
|
+
});
|
|
24237
|
+
}
|
|
24238
|
+
if (!isWindows) {
|
|
24239
|
+
if (isCommandAvailable("nano")) {
|
|
24240
|
+
candidates.push({
|
|
24241
|
+
command: "nano",
|
|
24242
|
+
args: [],
|
|
24243
|
+
displayName: "nano"
|
|
24244
|
+
});
|
|
24245
|
+
}
|
|
24246
|
+
if (isCommandAvailable("vim")) {
|
|
24247
|
+
candidates.push({
|
|
24248
|
+
command: "vim",
|
|
24249
|
+
args: [],
|
|
24250
|
+
displayName: "vim"
|
|
24251
|
+
});
|
|
24252
|
+
}
|
|
24253
|
+
if (isCommandAvailable("open")) {
|
|
24254
|
+
candidates.push({
|
|
24255
|
+
command: "open",
|
|
24256
|
+
args: ["-W", "-t"],
|
|
24257
|
+
displayName: "open -W -t"
|
|
24258
|
+
});
|
|
24259
|
+
}
|
|
24260
|
+
} else {
|
|
24261
|
+
candidates.push({
|
|
24262
|
+
command: "notepad",
|
|
24263
|
+
args: [],
|
|
24264
|
+
displayName: "notepad"
|
|
24265
|
+
});
|
|
24266
|
+
}
|
|
24267
|
+
return candidates.find((candidate) => isCommandAvailable(candidate.command)) ?? null;
|
|
24268
|
+
}
|
|
24269
|
+
function restoreStdinState(previouslyRaw) {
|
|
24270
|
+
if (!process.stdin.isTTY) return;
|
|
24271
|
+
process.stdin.resume();
|
|
24272
|
+
if (previouslyRaw && process.stdin.setRawMode) {
|
|
24273
|
+
process.stdin.setRawMode(true);
|
|
24274
|
+
}
|
|
24275
|
+
}
|
|
24276
|
+
function normalizeNewlines(text) {
|
|
24277
|
+
return text.replace(/\r\n/g, "\n");
|
|
24278
|
+
}
|
|
24279
|
+
async function launchExternalEditor(initialText) {
|
|
24280
|
+
const editorCommand = resolveEditorCommand();
|
|
24281
|
+
if (!editorCommand) {
|
|
24282
|
+
return {
|
|
24283
|
+
text: null,
|
|
24284
|
+
error: new Error(
|
|
24285
|
+
"No editor found. Set $VISUAL or $EDITOR, or install code, nano, vim, or notepad."
|
|
24286
|
+
)
|
|
24287
|
+
};
|
|
24288
|
+
}
|
|
24289
|
+
const dir = mkdtempSync(join9(tmpdir(), "pyb-edit-"));
|
|
24290
|
+
const filePath = join9(dir, "message.txt");
|
|
24291
|
+
writeFileSync4(filePath, initialText, "utf-8");
|
|
24292
|
+
const wasRaw = Boolean(process.stdin.isTTY && process.stdin.isRaw);
|
|
24293
|
+
if (process.stdin.isTTY) {
|
|
24294
|
+
process.stdin.pause();
|
|
24295
|
+
if (process.stdin.setRawMode) {
|
|
24296
|
+
process.stdin.setRawMode(false);
|
|
24297
|
+
}
|
|
24298
|
+
}
|
|
24299
|
+
try {
|
|
24300
|
+
await new Promise((resolve11, reject) => {
|
|
24301
|
+
const child = spawn(
|
|
24302
|
+
editorCommand.command,
|
|
24303
|
+
[...editorCommand.args, filePath],
|
|
24304
|
+
{
|
|
24305
|
+
stdio: "inherit",
|
|
24306
|
+
shell: editorCommand.shell ?? false
|
|
24307
|
+
}
|
|
24308
|
+
);
|
|
24309
|
+
child.on("error", reject);
|
|
24310
|
+
child.on("exit", (code, signal) => {
|
|
24311
|
+
if (code === 0 || code === null) {
|
|
24312
|
+
resolve11();
|
|
24313
|
+
} else {
|
|
24314
|
+
reject(
|
|
24315
|
+
new Error(
|
|
24316
|
+
`Editor exited with code ${code}${signal ? ` (signal ${signal})` : ""}`
|
|
24317
|
+
)
|
|
24318
|
+
);
|
|
24319
|
+
}
|
|
24320
|
+
});
|
|
24321
|
+
});
|
|
24322
|
+
} catch (error) {
|
|
24323
|
+
restoreStdinState(wasRaw);
|
|
24324
|
+
rmSync2(dir, { recursive: true, force: true });
|
|
24325
|
+
return {
|
|
24326
|
+
text: null,
|
|
24327
|
+
editorLabel: editorCommand.displayName,
|
|
24328
|
+
error
|
|
24329
|
+
};
|
|
24330
|
+
}
|
|
24331
|
+
restoreStdinState(wasRaw);
|
|
24332
|
+
try {
|
|
24333
|
+
const edited = normalizeNewlines(readFileSync9(filePath, "utf-8"));
|
|
24334
|
+
rmSync2(dir, { recursive: true, force: true });
|
|
24335
|
+
return { text: edited, editorLabel: editorCommand.displayName };
|
|
24336
|
+
} catch (error) {
|
|
24337
|
+
rmSync2(dir, { recursive: true, force: true });
|
|
24338
|
+
return {
|
|
24339
|
+
text: null,
|
|
24340
|
+
editorLabel: editorCommand.displayName,
|
|
24341
|
+
error
|
|
24342
|
+
};
|
|
24343
|
+
}
|
|
25009
24344
|
}
|
|
25010
24345
|
|
|
25011
24346
|
// src/utils/commands/hashCommand.ts
|
|
25012
24347
|
import { join as join10 } from "path";
|
|
25013
|
-
import { readFileSync as readFileSync10, writeFileSync as
|
|
24348
|
+
import { readFileSync as readFileSync10, writeFileSync as writeFileSync5 } from "fs";
|
|
25014
24349
|
function handleHashCommand(interpreted) {
|
|
25015
24350
|
try {
|
|
25016
24351
|
const cwd = process.cwd();
|
|
@@ -25039,7 +24374,7 @@ _Added on ${now.toLocaleString()} ${timezone}_`;
|
|
|
25039
24374
|
}
|
|
25040
24375
|
const separator = existingContent ? "\n\n" : "";
|
|
25041
24376
|
const newContent = `${existingContent}${separator}${interpreted}${timestamp}`;
|
|
25042
|
-
|
|
24377
|
+
writeFileSync5(file.path, newContent, "utf-8");
|
|
25043
24378
|
updatedFiles.push(file.name);
|
|
25044
24379
|
} catch (error) {
|
|
25045
24380
|
logError(error);
|
|
@@ -25051,8 +24386,8 @@ _Added on ${now.toLocaleString()} ${timezone}_`;
|
|
|
25051
24386
|
}
|
|
25052
24387
|
|
|
25053
24388
|
// src/ui/components/ModeIndicator.tsx
|
|
25054
|
-
import
|
|
25055
|
-
import { Box as
|
|
24389
|
+
import React91 from "react";
|
|
24390
|
+
import { Box as Box68, Text as Text73 } from "ink";
|
|
25056
24391
|
function __getModeIndicatorDisplayForTests(args) {
|
|
25057
24392
|
if (args.mode === "default") {
|
|
25058
24393
|
return {
|
|
@@ -25123,7 +24458,7 @@ function CompactModeIndicator() {
|
|
|
25123
24458
|
shortcutDisplayText: shortcut.displayText,
|
|
25124
24459
|
theme
|
|
25125
24460
|
});
|
|
25126
|
-
return /* @__PURE__ */
|
|
24461
|
+
return /* @__PURE__ */ React91.createElement(Text73, { color: indicator.color }, indicator.mainText, /* @__PURE__ */ React91.createElement(Text73, { dimColor: true }, indicator.shortcutHintText));
|
|
25127
24462
|
}
|
|
25128
24463
|
|
|
25129
24464
|
// src/utils/terminal/promptInputSpecialKey.ts
|
|
@@ -25160,7 +24495,7 @@ function logStartupProfile(event) {
|
|
|
25160
24495
|
}
|
|
25161
24496
|
|
|
25162
24497
|
// src/ui/hooks/useStatusLine.ts
|
|
25163
|
-
import { useEffect as
|
|
24498
|
+
import { useEffect as useEffect21, useRef as useRef10, useState as useState24 } from "react";
|
|
25164
24499
|
|
|
25165
24500
|
// src/services/ui/statusline.ts
|
|
25166
24501
|
import { join as join11 } from "path";
|
|
@@ -25202,12 +24537,12 @@ function normalizeStatusLineText(value) {
|
|
|
25202
24537
|
return singleLine.length > 300 ? `${singleLine.slice(0, 300)}\u2026` : singleLine;
|
|
25203
24538
|
}
|
|
25204
24539
|
function useStatusLine() {
|
|
25205
|
-
const [text, setText] =
|
|
24540
|
+
const [text, setText] = useState24(null);
|
|
25206
24541
|
const lastCommandRef = useRef10(null);
|
|
25207
24542
|
const abortRef = useRef10(null);
|
|
25208
24543
|
const configDir = process.env.PYB_CONFIG_DIR ?? process.env.CLAUDE_CONFIG_DIR;
|
|
25209
24544
|
const homeDir = typeof process.env.HOME === "string" ? process.env.HOME : typeof process.env.USERPROFILE === "string" ? process.env.USERPROFILE : void 0;
|
|
25210
|
-
|
|
24545
|
+
useEffect21(() => {
|
|
25211
24546
|
const enabled = process.env.PYB_STATUSLINE_ENABLED === "1" || process.env.NODE_ENV !== "test";
|
|
25212
24547
|
if (!enabled) return;
|
|
25213
24548
|
const shell = BunShell.getInstance();
|
|
@@ -25250,7 +24585,7 @@ function useStatusLine() {
|
|
|
25250
24585
|
// src/ui/components/PromptInput.tsx
|
|
25251
24586
|
async function interpretHashCommand(input) {
|
|
25252
24587
|
try {
|
|
25253
|
-
const { queryQuick: queryQuick2 } = await import("./llm-
|
|
24588
|
+
const { queryQuick: queryQuick2 } = await import("./llm-A3S75CLF.js");
|
|
25254
24589
|
const systemPrompt = [
|
|
25255
24590
|
"You're helping the user structure notes that will be added to their PYB.md file.",
|
|
25256
24591
|
"Format the user's input into a well-structured note that will be useful for later reference.",
|
|
@@ -25303,36 +24638,36 @@ function PromptInput({
|
|
|
25303
24638
|
readFileTimestamps,
|
|
25304
24639
|
onModelChange
|
|
25305
24640
|
}) {
|
|
25306
|
-
|
|
24641
|
+
useEffect22(() => {
|
|
25307
24642
|
if (!isDisabled && !isLoading) {
|
|
25308
24643
|
logStartupProfile("prompt_ready");
|
|
25309
24644
|
}
|
|
25310
24645
|
}, [isDisabled, isLoading]);
|
|
25311
|
-
const [exitMessage, setExitMessage] =
|
|
25312
|
-
const [rewindMessagePending, setRewindMessagePending] =
|
|
25313
|
-
const [message, setMessage] =
|
|
24646
|
+
const [exitMessage, setExitMessage] = useState25({ show: false });
|
|
24647
|
+
const [rewindMessagePending, setRewindMessagePending] = useState25(false);
|
|
24648
|
+
const [message, setMessage] = useState25({
|
|
25314
24649
|
show: false
|
|
25315
24650
|
});
|
|
25316
|
-
const [modelSwitchMessage, setModelSwitchMessage] =
|
|
24651
|
+
const [modelSwitchMessage, setModelSwitchMessage] = useState25({
|
|
25317
24652
|
show: false
|
|
25318
24653
|
});
|
|
25319
|
-
const [placeholder, setPlaceholder] =
|
|
25320
|
-
const [cursorOffset, setCursorOffset] =
|
|
25321
|
-
const [pastedTexts, setPastedTexts] =
|
|
25322
|
-
const [pastedImages, setPastedImages] =
|
|
25323
|
-
const [isEditingExternally, setIsEditingExternally] =
|
|
25324
|
-
const [currentPwd, setCurrentPwd] =
|
|
25325
|
-
const pastedTextCounter =
|
|
25326
|
-
const pastedImageCounter =
|
|
24654
|
+
const [placeholder, setPlaceholder] = useState25("");
|
|
24655
|
+
const [cursorOffset, setCursorOffset] = useState25(input.length);
|
|
24656
|
+
const [pastedTexts, setPastedTexts] = useState25([]);
|
|
24657
|
+
const [pastedImages, setPastedImages] = useState25([]);
|
|
24658
|
+
const [isEditingExternally, setIsEditingExternally] = useState25(false);
|
|
24659
|
+
const [currentPwd, setCurrentPwd] = useState25(process.cwd());
|
|
24660
|
+
const pastedTextCounter = React92.useRef(1);
|
|
24661
|
+
const pastedImageCounter = React92.useRef(1);
|
|
25327
24662
|
const { cycleMode, currentMode, toolPermissionContext } = usePermissionContext();
|
|
25328
|
-
const modeCycleShortcut =
|
|
24663
|
+
const modeCycleShortcut = useMemo24(() => getPermissionModeCycleShortcut(), []);
|
|
25329
24664
|
const showQuickModelSwitchShortcut = modeCycleShortcut.displayText !== "alt+m";
|
|
25330
24665
|
const handleRewindConversation = useDoublePress(
|
|
25331
24666
|
setRewindMessagePending,
|
|
25332
24667
|
() => onShowMessageSelector()
|
|
25333
24668
|
);
|
|
25334
24669
|
const { columns, rows } = useTerminalSize();
|
|
25335
|
-
const commandWidth =
|
|
24670
|
+
const commandWidth = useMemo24(
|
|
25336
24671
|
() => Math.max(...commands.map((cmd) => cmd.userFacingName().length)) + 5,
|
|
25337
24672
|
[commands]
|
|
25338
24673
|
);
|
|
@@ -25352,19 +24687,19 @@ function PromptInput({
|
|
|
25352
24687
|
});
|
|
25353
24688
|
const theme = getTheme();
|
|
25354
24689
|
const statusLine = useStatusLine();
|
|
25355
|
-
const renderedSuggestions =
|
|
24690
|
+
const renderedSuggestions = useMemo24(() => {
|
|
25356
24691
|
if (suggestions.length === 0) return null;
|
|
25357
24692
|
return suggestions.map((suggestion, index) => {
|
|
25358
24693
|
const isSelected = index === selectedIndex;
|
|
25359
24694
|
const isAgent = suggestion.type === "agent";
|
|
25360
24695
|
const displayColor = isSelected ? theme.suggestion : isAgent && suggestion.metadata?.color ? suggestion.metadata.color : void 0;
|
|
25361
|
-
return /* @__PURE__ */
|
|
25362
|
-
|
|
24696
|
+
return /* @__PURE__ */ React92.createElement(
|
|
24697
|
+
Box69,
|
|
25363
24698
|
{
|
|
25364
24699
|
key: `${suggestion.type}-${suggestion.value}-${index}`,
|
|
25365
24700
|
flexDirection: "row"
|
|
25366
24701
|
},
|
|
25367
|
-
/* @__PURE__ */
|
|
24702
|
+
/* @__PURE__ */ React92.createElement(Text74, { color: displayColor, dimColor: !isSelected && !displayColor }, isSelected ? "\u25C6 " : " ", suggestion.displayValue)
|
|
25368
24703
|
);
|
|
25369
24704
|
});
|
|
25370
24705
|
}, [suggestions, selectedIndex, theme.suggestion]);
|
|
@@ -25563,7 +24898,7 @@ function PromptInput({
|
|
|
25563
24898
|
if (messages2.length) {
|
|
25564
24899
|
if (mode === "bash") {
|
|
25565
24900
|
onQuery(messages2, newAbortController).then(async () => {
|
|
25566
|
-
const { getCwd: getCwd2 } = await import("./state-
|
|
24901
|
+
const { getCwd: getCwd2 } = await import("./state-I7LIGIFJ.js");
|
|
25567
24902
|
setCurrentPwd(getCwd2());
|
|
25568
24903
|
});
|
|
25569
24904
|
} else {
|
|
@@ -25609,11 +24944,11 @@ function PromptInput({
|
|
|
25609
24944
|
setCursorOffset(cursorOffset + pastedPrompt.length);
|
|
25610
24945
|
setPastedTexts((prev) => [...prev, { placeholder: pastedPrompt, text }]);
|
|
25611
24946
|
}
|
|
25612
|
-
|
|
24947
|
+
useEffect22(() => {
|
|
25613
24948
|
setPastedTexts((prev) => prev.filter((p) => input.includes(p.placeholder)));
|
|
25614
24949
|
setPastedImages((prev) => prev.filter((p) => input.includes(p.placeholder)));
|
|
25615
24950
|
}, [input]);
|
|
25616
|
-
|
|
24951
|
+
useInput25(
|
|
25617
24952
|
(inputChar, key) => {
|
|
25618
24953
|
if (mode === "bash" && (key.backspace || key.delete)) {
|
|
25619
24954
|
if (input === "") {
|
|
@@ -25702,10 +25037,10 @@ function PromptInput({
|
|
|
25702
25037
|
]
|
|
25703
25038
|
);
|
|
25704
25039
|
const textInputColumns = columns - 6;
|
|
25705
|
-
const tokenUsage =
|
|
25040
|
+
const tokenUsage = useMemo24(() => countTokens(messages), [messages]);
|
|
25706
25041
|
const modelManager = getModelManager();
|
|
25707
25042
|
const currentModelId = modelManager.getModel("main")?.id || null;
|
|
25708
|
-
const modelInfo =
|
|
25043
|
+
const modelInfo = useMemo24(() => {
|
|
25709
25044
|
const freshModelManager = getModelManager();
|
|
25710
25045
|
const currentModel = freshModelManager.getModel("main");
|
|
25711
25046
|
if (!currentModel) {
|
|
@@ -25719,17 +25054,17 @@ function PromptInput({
|
|
|
25719
25054
|
currentTokens: tokenUsage
|
|
25720
25055
|
};
|
|
25721
25056
|
}, [tokenUsage, modelSwitchMessage.show, submitCount, currentModelId]);
|
|
25722
|
-
return /* @__PURE__ */
|
|
25723
|
-
|
|
25057
|
+
return /* @__PURE__ */ React92.createElement(Box69, { flexDirection: "column" }, (mode === "bash" || modelInfo) && /* @__PURE__ */ React92.createElement(
|
|
25058
|
+
Box69,
|
|
25724
25059
|
{
|
|
25725
25060
|
justifyContent: "space-between",
|
|
25726
25061
|
marginBottom: 1,
|
|
25727
25062
|
flexDirection: "row"
|
|
25728
25063
|
},
|
|
25729
|
-
mode === "bash" ? /* @__PURE__ */
|
|
25730
|
-
modelInfo && /* @__PURE__ */
|
|
25731
|
-
), /* @__PURE__ */
|
|
25732
|
-
|
|
25064
|
+
mode === "bash" ? /* @__PURE__ */ React92.createElement(Text74, { color: theme.bashBorder }, "Shell PWD: ", currentPwd) : /* @__PURE__ */ React92.createElement(Text74, null, " "),
|
|
25065
|
+
modelInfo && /* @__PURE__ */ React92.createElement(Text74, { dimColor: true }, "[", modelInfo.provider, "] ", modelInfo.name, ":", " ", Math.round(modelInfo.currentTokens / 1e3), "k /", " ", Math.round(modelInfo.contextLength / 1e3), "k")
|
|
25066
|
+
), /* @__PURE__ */ React92.createElement(
|
|
25067
|
+
Box69,
|
|
25733
25068
|
{
|
|
25734
25069
|
alignItems: "flex-start",
|
|
25735
25070
|
justifyContent: "flex-start",
|
|
@@ -25743,8 +25078,8 @@ function PromptInput({
|
|
|
25743
25078
|
marginTop: 1,
|
|
25744
25079
|
width: "100%"
|
|
25745
25080
|
},
|
|
25746
|
-
/* @__PURE__ */
|
|
25747
|
-
|
|
25081
|
+
/* @__PURE__ */ React92.createElement(
|
|
25082
|
+
Box69,
|
|
25748
25083
|
{
|
|
25749
25084
|
alignItems: "flex-start",
|
|
25750
25085
|
alignSelf: "flex-start",
|
|
@@ -25752,9 +25087,9 @@ function PromptInput({
|
|
|
25752
25087
|
justifyContent: "flex-start",
|
|
25753
25088
|
width: 3
|
|
25754
25089
|
},
|
|
25755
|
-
mode === "bash" ? /* @__PURE__ */
|
|
25090
|
+
mode === "bash" ? /* @__PURE__ */ React92.createElement(Text74, { color: theme.bashBorder }, "\xA0!\xA0") : mode === "pyb" ? /* @__PURE__ */ React92.createElement(Text74, { color: theme.noting }, "\xA0#\xA0") : /* @__PURE__ */ React92.createElement(Text74, { color: isLoading ? theme.secondaryText : void 0 }, "P>\xA0")
|
|
25756
25091
|
),
|
|
25757
|
-
/* @__PURE__ */
|
|
25092
|
+
/* @__PURE__ */ React92.createElement(Box69, { paddingRight: 1 }, /* @__PURE__ */ React92.createElement(
|
|
25758
25093
|
TextInput,
|
|
25759
25094
|
{
|
|
25760
25095
|
multiline: true,
|
|
@@ -25779,44 +25114,44 @@ function PromptInput({
|
|
|
25779
25114
|
onSpecialKey: handleSpecialKey
|
|
25780
25115
|
}
|
|
25781
25116
|
))
|
|
25782
|
-
), !completionActive && suggestions.length === 0 && /* @__PURE__ */
|
|
25783
|
-
|
|
25117
|
+
), !completionActive && suggestions.length === 0 && /* @__PURE__ */ React92.createElement(Box69, { flexDirection: "column", paddingX: 2, paddingY: 0 }, /* @__PURE__ */ React92.createElement(Box69, { flexDirection: "row", justifyContent: "space-between" }, /* @__PURE__ */ React92.createElement(Box69, { justifyContent: "flex-start", gap: 1 }, exitMessage.show ? /* @__PURE__ */ React92.createElement(Text74, { dimColor: true }, "Press ", exitMessage.key, " again to exit") : message.show ? /* @__PURE__ */ React92.createElement(Text74, { dimColor: true }, message.text) : rewindMessagePending ? /* @__PURE__ */ React92.createElement(Text74, { dimColor: true }, "Press Escape again to undo") : modelSwitchMessage.show ? /* @__PURE__ */ React92.createElement(Text74, { color: theme.success }, modelSwitchMessage.text) : mode === "prompt" && currentMode !== "default" ? /* @__PURE__ */ React92.createElement(CompactModeIndicator, null) : /* @__PURE__ */ React92.createElement(React92.Fragment, null, /* @__PURE__ */ React92.createElement(
|
|
25118
|
+
Text74,
|
|
25784
25119
|
{
|
|
25785
25120
|
color: mode === "bash" ? theme.bashBorder : void 0,
|
|
25786
25121
|
dimColor: mode !== "bash"
|
|
25787
25122
|
},
|
|
25788
25123
|
"! run some shell command"
|
|
25789
|
-
), /* @__PURE__ */
|
|
25790
|
-
|
|
25124
|
+
), /* @__PURE__ */ React92.createElement(Text74, { dimColor: true }, " \xB7 / for commands"), /* @__PURE__ */ React92.createElement(
|
|
25125
|
+
Text74,
|
|
25791
25126
|
{
|
|
25792
25127
|
color: mode === "pyb" ? theme.noting : void 0,
|
|
25793
25128
|
dimColor: mode !== "pyb"
|
|
25794
25129
|
},
|
|
25795
25130
|
" ",
|
|
25796
25131
|
"\xB7 # tell agent something to remember forever"
|
|
25797
|
-
))), /* @__PURE__ */
|
|
25132
|
+
))), /* @__PURE__ */ React92.createElement(Box69, { justifyContent: "flex-end" }, /* @__PURE__ */ React92.createElement(Text74, { dimColor: true, wrap: "truncate-end" }, statusLine ? `${statusLine} \xB7 ESC to interrupt \xB7 2\xD7ESC for undo` : "ESC to interrupt \xB7 2\xD7ESC for undo"))), !exitMessage.show && !message.show && !modelSwitchMessage.show && !rewindMessagePending && /* @__PURE__ */ React92.createElement(Box69, { flexDirection: "row", justifyContent: "space-between" }, /* @__PURE__ */ React92.createElement(Box69, { justifyContent: "flex-start", gap: 1 }, /* @__PURE__ */ React92.createElement(Text74, { dimColor: true, wrap: "truncate-end" }, "option+enter: newline \xB7", " ", showQuickModelSwitchShortcut ? "option+m: switch model \xB7 " : "", "option+g: external editor \xB7 ", modeCycleShortcut.displayText, ": switch mode")), /* @__PURE__ */ React92.createElement(
|
|
25798
25133
|
SentryErrorBoundary,
|
|
25799
25134
|
{
|
|
25800
|
-
children: /* @__PURE__ */
|
|
25135
|
+
children: /* @__PURE__ */ React92.createElement(Box69, { justifyContent: "flex-end", gap: 1 }, /* @__PURE__ */ React92.createElement(TokenWarning, { tokenUsage }))
|
|
25801
25136
|
}
|
|
25802
|
-
))), suggestions.length > 0 && /* @__PURE__ */
|
|
25803
|
-
|
|
25137
|
+
))), suggestions.length > 0 && /* @__PURE__ */ React92.createElement(
|
|
25138
|
+
Box69,
|
|
25804
25139
|
{
|
|
25805
25140
|
flexDirection: "row",
|
|
25806
25141
|
justifyContent: "space-between",
|
|
25807
25142
|
paddingX: 2,
|
|
25808
25143
|
paddingY: 0
|
|
25809
25144
|
},
|
|
25810
|
-
/* @__PURE__ */
|
|
25811
|
-
|
|
25145
|
+
/* @__PURE__ */ React92.createElement(Box69, { flexDirection: "column" }, renderedSuggestions, /* @__PURE__ */ React92.createElement(
|
|
25146
|
+
Box69,
|
|
25812
25147
|
{
|
|
25813
25148
|
marginTop: 1,
|
|
25814
25149
|
paddingX: 3,
|
|
25815
25150
|
borderStyle: "round",
|
|
25816
25151
|
borderColor: "gray"
|
|
25817
25152
|
},
|
|
25818
|
-
/* @__PURE__ */
|
|
25819
|
-
|
|
25153
|
+
/* @__PURE__ */ React92.createElement(
|
|
25154
|
+
Text74,
|
|
25820
25155
|
{
|
|
25821
25156
|
dimColor: !emptyDirMessage,
|
|
25822
25157
|
color: emptyDirMessage ? "yellow" : void 0
|
|
@@ -25836,10 +25171,10 @@ function PromptInput({
|
|
|
25836
25171
|
})()
|
|
25837
25172
|
)
|
|
25838
25173
|
)),
|
|
25839
|
-
/* @__PURE__ */
|
|
25174
|
+
/* @__PURE__ */ React92.createElement(
|
|
25840
25175
|
SentryErrorBoundary,
|
|
25841
25176
|
{
|
|
25842
|
-
children: /* @__PURE__ */
|
|
25177
|
+
children: /* @__PURE__ */ React92.createElement(Box69, { justifyContent: "flex-end", gap: 1 }, /* @__PURE__ */ React92.createElement(TokenWarning, { tokenUsage: countTokens(messages) }))
|
|
25843
25178
|
}
|
|
25844
25179
|
)
|
|
25845
25180
|
));
|
|
@@ -25851,9 +25186,9 @@ function exit() {
|
|
|
25851
25186
|
}
|
|
25852
25187
|
|
|
25853
25188
|
// src/ui/hooks/useCostSummary.ts
|
|
25854
|
-
import { useEffect as
|
|
25189
|
+
import { useEffect as useEffect23 } from "react";
|
|
25855
25190
|
function useCostSummary() {
|
|
25856
|
-
|
|
25191
|
+
useEffect23(() => {
|
|
25857
25192
|
const onExit = () => {
|
|
25858
25193
|
process.stdout.write("\n" + formatTotalCost() + "\n");
|
|
25859
25194
|
const projectConfig = getCurrentProjectConfig();
|
|
@@ -25893,9 +25228,9 @@ function useApiKeyVerification() {
|
|
|
25893
25228
|
}
|
|
25894
25229
|
|
|
25895
25230
|
// src/ui/hooks/useCancelRequest.ts
|
|
25896
|
-
import { useInput as
|
|
25231
|
+
import { useInput as useInput26 } from "ink";
|
|
25897
25232
|
function useCancelRequest(setToolJSX, setToolUseConfirm, setBinaryFeedbackContext, onCancel, isLoading, isMessageSelectorVisible, abortSignal) {
|
|
25898
|
-
|
|
25233
|
+
useInput26((_, key) => {
|
|
25899
25234
|
if (!key.escape) {
|
|
25900
25235
|
return;
|
|
25901
25236
|
}
|
|
@@ -25956,7 +25291,7 @@ function useCanUseTool(setToolUseConfirm) {
|
|
|
25956
25291
|
const [description3, commandPrefix] = await Promise.all([
|
|
25957
25292
|
typeof tool.description === "function" ? tool.description(input) : Promise.resolve(tool.description ?? `Tool: ${tool.name}`),
|
|
25958
25293
|
tool === BashTool ? getCommandSubcommandPrefix(
|
|
25959
|
-
|
|
25294
|
+
inputSchema11.parse(input).command,
|
|
25960
25295
|
toolUseContext.abortController.signal
|
|
25961
25296
|
) : Promise.resolve(null)
|
|
25962
25297
|
]);
|
|
@@ -26004,9 +25339,9 @@ function useCanUseTool(setToolUseConfirm) {
|
|
|
26004
25339
|
var useCanUseTool_default = useCanUseTool;
|
|
26005
25340
|
|
|
26006
25341
|
// src/ui/hooks/useLogMessages.ts
|
|
26007
|
-
import { useEffect as
|
|
25342
|
+
import { useEffect as useEffect24 } from "react";
|
|
26008
25343
|
function useLogMessages(messages, messageLogName, forkNumber) {
|
|
26009
|
-
|
|
25344
|
+
useEffect24(() => {
|
|
26010
25345
|
overwriteLog(
|
|
26011
25346
|
getMessagesPath(messageLogName, forkNumber, 0),
|
|
26012
25347
|
messages.filter((_) => _.type !== "progress"),
|
|
@@ -27641,17 +26976,17 @@ function createErrorToolResultBlock(args) {
|
|
|
27641
26976
|
}
|
|
27642
26977
|
|
|
27643
26978
|
// src/ui/components/binary-feedback/BinaryFeedback.tsx
|
|
27644
|
-
import { default as
|
|
26979
|
+
import { default as React96, useCallback as useCallback15 } from "react";
|
|
27645
26980
|
|
|
27646
26981
|
// src/ui/components/binary-feedback/BinaryFeedbackView.tsx
|
|
27647
26982
|
import chalk14 from "chalk";
|
|
27648
|
-
import { Box as
|
|
26983
|
+
import { Box as Box71, Text as Text75, useInput as useInput27 } from "ink";
|
|
27649
26984
|
import Link2 from "ink-link";
|
|
27650
|
-
import
|
|
26985
|
+
import React95, { useState as useState26 } from "react";
|
|
27651
26986
|
|
|
27652
26987
|
// src/ui/components/binary-feedback/BinaryFeedbackOption.tsx
|
|
27653
|
-
import * as
|
|
27654
|
-
import { Box as
|
|
26988
|
+
import * as React94 from "react";
|
|
26989
|
+
import { Box as Box70 } from "ink";
|
|
27655
26990
|
function BinaryFeedbackOption({
|
|
27656
26991
|
debug: debug2,
|
|
27657
26992
|
erroredToolUseIDs,
|
|
@@ -27663,7 +26998,7 @@ function BinaryFeedbackOption({
|
|
|
27663
26998
|
verbose
|
|
27664
26999
|
}) {
|
|
27665
27000
|
const { columns } = useTerminalSize();
|
|
27666
|
-
return normalizeMessages([message]).filter((_) => _.type !== "progress").map((_, index) => /* @__PURE__ */
|
|
27001
|
+
return normalizeMessages([message]).filter((_) => _.type !== "progress").map((_, index) => /* @__PURE__ */ React94.createElement(Box70, { flexDirection: "column", key: index }, /* @__PURE__ */ React94.createElement(
|
|
27667
27002
|
Message,
|
|
27668
27003
|
{
|
|
27669
27004
|
addMargin: false,
|
|
@@ -27679,7 +27014,7 @@ function BinaryFeedbackOption({
|
|
|
27679
27014
|
verbose,
|
|
27680
27015
|
width: columns / 2 - 6
|
|
27681
27016
|
}
|
|
27682
|
-
), /* @__PURE__ */
|
|
27017
|
+
), /* @__PURE__ */ React94.createElement(AdditionalContext, { message: _, verbose })));
|
|
27683
27018
|
}
|
|
27684
27019
|
function AdditionalContext({
|
|
27685
27020
|
message,
|
|
@@ -27711,7 +27046,7 @@ function AdditionalContext({
|
|
|
27711
27046
|
} catch {
|
|
27712
27047
|
return null;
|
|
27713
27048
|
}
|
|
27714
|
-
return /* @__PURE__ */
|
|
27049
|
+
return /* @__PURE__ */ React94.createElement(
|
|
27715
27050
|
FileEditToolDiff,
|
|
27716
27051
|
{
|
|
27717
27052
|
file_path: input.data.file_path,
|
|
@@ -27727,7 +27062,7 @@ function AdditionalContext({
|
|
|
27727
27062
|
if (!input.success) {
|
|
27728
27063
|
return null;
|
|
27729
27064
|
}
|
|
27730
|
-
return /* @__PURE__ */
|
|
27065
|
+
return /* @__PURE__ */ React94.createElement(
|
|
27731
27066
|
FileWriteToolDiff,
|
|
27732
27067
|
{
|
|
27733
27068
|
file_path: input.data.file_path,
|
|
@@ -27780,10 +27115,10 @@ function BinaryFeedbackView({
|
|
|
27780
27115
|
verbose
|
|
27781
27116
|
}) {
|
|
27782
27117
|
const theme = getTheme();
|
|
27783
|
-
const [focused, setFocus] =
|
|
27784
|
-
const [focusValue, setFocusValue] =
|
|
27118
|
+
const [focused, setFocus] = useState26("no-preference");
|
|
27119
|
+
const [focusValue, setFocusValue] = useState26(void 0);
|
|
27785
27120
|
const exitState = useExitOnCtrlCD(() => process.exit(1));
|
|
27786
|
-
|
|
27121
|
+
useInput27((_input, key) => {
|
|
27787
27122
|
if (key.leftArrow) {
|
|
27788
27123
|
setFocusValue("prefer-left");
|
|
27789
27124
|
} else if (key.rightArrow) {
|
|
@@ -27792,8 +27127,8 @@ function BinaryFeedbackView({
|
|
|
27792
27127
|
onChoose?.("neither");
|
|
27793
27128
|
}
|
|
27794
27129
|
});
|
|
27795
|
-
return /* @__PURE__ */
|
|
27796
|
-
|
|
27130
|
+
return /* @__PURE__ */ React95.createElement(React95.Fragment, null, /* @__PURE__ */ React95.createElement(
|
|
27131
|
+
Box71,
|
|
27797
27132
|
{
|
|
27798
27133
|
flexDirection: "column",
|
|
27799
27134
|
height: "100%",
|
|
@@ -27801,9 +27136,9 @@ function BinaryFeedbackView({
|
|
|
27801
27136
|
borderStyle: "round",
|
|
27802
27137
|
borderColor: theme.permission
|
|
27803
27138
|
},
|
|
27804
|
-
/* @__PURE__ */
|
|
27805
|
-
/* @__PURE__ */
|
|
27806
|
-
|
|
27139
|
+
/* @__PURE__ */ React95.createElement(Box71, { width: "100%", justifyContent: "space-between", paddingX: 1 }, /* @__PURE__ */ React95.createElement(Text75, { bold: true, color: theme.permission }, "[ANT-ONLY] Help train ", PRODUCT_NAME), /* @__PURE__ */ React95.createElement(Text75, null, /* @__PURE__ */ React95.createElement(Link2, { url: HELP_URL }, "[?]"))),
|
|
27140
|
+
/* @__PURE__ */ React95.createElement(Box71, { flexDirection: "row", width: "100%", flexGrow: 1, paddingTop: 1 }, /* @__PURE__ */ React95.createElement(
|
|
27141
|
+
Box71,
|
|
27807
27142
|
{
|
|
27808
27143
|
flexDirection: "column",
|
|
27809
27144
|
flexGrow: 1,
|
|
@@ -27814,7 +27149,7 @@ function BinaryFeedbackView({
|
|
|
27814
27149
|
marginRight: 1,
|
|
27815
27150
|
padding: 1
|
|
27816
27151
|
},
|
|
27817
|
-
/* @__PURE__ */
|
|
27152
|
+
/* @__PURE__ */ React95.createElement(
|
|
27818
27153
|
BinaryFeedbackOption,
|
|
27819
27154
|
{
|
|
27820
27155
|
erroredToolUseIDs,
|
|
@@ -27827,8 +27162,8 @@ function BinaryFeedbackView({
|
|
|
27827
27162
|
verbose
|
|
27828
27163
|
}
|
|
27829
27164
|
)
|
|
27830
|
-
), /* @__PURE__ */
|
|
27831
|
-
|
|
27165
|
+
), /* @__PURE__ */ React95.createElement(
|
|
27166
|
+
Box71,
|
|
27832
27167
|
{
|
|
27833
27168
|
flexDirection: "column",
|
|
27834
27169
|
flexGrow: 1,
|
|
@@ -27839,7 +27174,7 @@ function BinaryFeedbackView({
|
|
|
27839
27174
|
marginLeft: 1,
|
|
27840
27175
|
padding: 1
|
|
27841
27176
|
},
|
|
27842
|
-
/* @__PURE__ */
|
|
27177
|
+
/* @__PURE__ */ React95.createElement(
|
|
27843
27178
|
BinaryFeedbackOption,
|
|
27844
27179
|
{
|
|
27845
27180
|
erroredToolUseIDs,
|
|
@@ -27853,7 +27188,7 @@ function BinaryFeedbackView({
|
|
|
27853
27188
|
}
|
|
27854
27189
|
)
|
|
27855
27190
|
)),
|
|
27856
|
-
/* @__PURE__ */
|
|
27191
|
+
/* @__PURE__ */ React95.createElement(Box71, { flexDirection: "column", paddingTop: 1, paddingX: 1 }, /* @__PURE__ */ React95.createElement(Text75, null, "How do you want to proceed?"), /* @__PURE__ */ React95.createElement(
|
|
27857
27192
|
Select,
|
|
27858
27193
|
{
|
|
27859
27194
|
options: getOptions2(),
|
|
@@ -27862,7 +27197,7 @@ function BinaryFeedbackView({
|
|
|
27862
27197
|
onChange: onChoose
|
|
27863
27198
|
}
|
|
27864
27199
|
))
|
|
27865
|
-
), exitState.pending ? /* @__PURE__ */
|
|
27200
|
+
), exitState.pending ? /* @__PURE__ */ React95.createElement(Box71, { marginLeft: 3 }, /* @__PURE__ */ React95.createElement(Text75, { dimColor: true }, "Press ", exitState.keyName, " again to exit")) : /* @__PURE__ */ React95.createElement(Text75, null, " "));
|
|
27866
27201
|
}
|
|
27867
27202
|
|
|
27868
27203
|
// src/ui/components/binary-feedback/BinaryFeedback.tsx
|
|
@@ -27888,7 +27223,7 @@ function BinaryFeedback({
|
|
|
27888
27223
|
useNotifyAfterTimeout(
|
|
27889
27224
|
`${PRODUCT_NAME} needs your input on a response comparison`
|
|
27890
27225
|
);
|
|
27891
|
-
return /* @__PURE__ */
|
|
27226
|
+
return /* @__PURE__ */ React96.createElement(
|
|
27892
27227
|
BinaryFeedbackView,
|
|
27893
27228
|
{
|
|
27894
27229
|
debug: debug2,
|
|
@@ -27977,36 +27312,36 @@ function REPL({
|
|
|
27977
27312
|
initialUpdateCommands,
|
|
27978
27313
|
autoExit
|
|
27979
27314
|
}) {
|
|
27980
|
-
const [verboseConfig] =
|
|
27315
|
+
const [verboseConfig] = useState27(
|
|
27981
27316
|
() => verboseFromCLI ?? getGlobalConfig().verbose
|
|
27982
27317
|
);
|
|
27983
27318
|
const verbose = verboseConfig;
|
|
27984
|
-
const [forkNumber, setForkNumber] =
|
|
27319
|
+
const [forkNumber, setForkNumber] = useState27(
|
|
27985
27320
|
getNextAvailableLogForkNumber(messageLogName, initialForkNumber, 0)
|
|
27986
27321
|
);
|
|
27987
|
-
const [uiRefreshCounter, setUiRefreshCounter] =
|
|
27322
|
+
const [uiRefreshCounter, setUiRefreshCounter] = useState27(0);
|
|
27988
27323
|
const [
|
|
27989
27324
|
forkConvoWithMessagesOnTheNextRender,
|
|
27990
27325
|
setForkConvoWithMessagesOnTheNextRender
|
|
27991
|
-
] =
|
|
27992
|
-
const [abortController, setAbortController] =
|
|
27993
|
-
const [isLoading, setIsLoading] =
|
|
27994
|
-
const [toolJSX, setToolJSX] =
|
|
27995
|
-
const [toolUseConfirm, setToolUseConfirm] =
|
|
27326
|
+
] = useState27(null);
|
|
27327
|
+
const [abortController, setAbortController] = useState27(null);
|
|
27328
|
+
const [isLoading, setIsLoading] = useState27(false);
|
|
27329
|
+
const [toolJSX, setToolJSX] = useState27(null);
|
|
27330
|
+
const [toolUseConfirm, setToolUseConfirm] = useState27(
|
|
27996
27331
|
null
|
|
27997
27332
|
);
|
|
27998
|
-
const [messages, setMessages2] =
|
|
27999
|
-
const [inputValue, setInputValue] =
|
|
28000
|
-
const [inputMode, setInputMode] =
|
|
27333
|
+
const [messages, setMessages2] = useState27(initialMessages ?? []);
|
|
27334
|
+
const [inputValue, setInputValue] = useState27("");
|
|
27335
|
+
const [inputMode, setInputMode] = useState27(
|
|
28001
27336
|
"prompt"
|
|
28002
27337
|
);
|
|
28003
|
-
const [submitCount, setSubmitCount] =
|
|
28004
|
-
const [isMessageSelectorVisible, setIsMessageSelectorVisible] =
|
|
28005
|
-
const [showCostDialog, setShowCostDialog] =
|
|
28006
|
-
const [haveShownCostDialog, setHaveShownCostDialog] =
|
|
27338
|
+
const [submitCount, setSubmitCount] = useState27(0);
|
|
27339
|
+
const [isMessageSelectorVisible, setIsMessageSelectorVisible] = useState27(false);
|
|
27340
|
+
const [showCostDialog, setShowCostDialog] = useState27(false);
|
|
27341
|
+
const [haveShownCostDialog, setHaveShownCostDialog] = useState27(
|
|
28007
27342
|
getGlobalConfig().hasAcknowledgedCostThreshold
|
|
28008
27343
|
);
|
|
28009
|
-
const [binaryFeedbackContext, setBinaryFeedbackContext] =
|
|
27344
|
+
const [binaryFeedbackContext, setBinaryFeedbackContext] = useState27(null);
|
|
28010
27345
|
const updateAvailableVersion = initialUpdateVersion ?? null;
|
|
28011
27346
|
const updateCommands = initialUpdateCommands ?? null;
|
|
28012
27347
|
const getBinaryFeedbackResponse = useCallback16(
|
|
@@ -28043,20 +27378,20 @@ function REPL({
|
|
|
28043
27378
|
isMessageSelectorVisible,
|
|
28044
27379
|
abortController?.signal
|
|
28045
27380
|
);
|
|
28046
|
-
|
|
27381
|
+
useEffect25(() => {
|
|
28047
27382
|
if (forkConvoWithMessagesOnTheNextRender) {
|
|
28048
27383
|
setForkNumber((_) => _ + 1);
|
|
28049
27384
|
setForkConvoWithMessagesOnTheNextRender(null);
|
|
28050
27385
|
setMessages2(forkConvoWithMessagesOnTheNextRender);
|
|
28051
27386
|
}
|
|
28052
27387
|
}, [forkConvoWithMessagesOnTheNextRender]);
|
|
28053
|
-
|
|
27388
|
+
useEffect25(() => {
|
|
28054
27389
|
const totalCost = getTotalCost();
|
|
28055
27390
|
if (totalCost >= 5 && !showCostDialog && !haveShownCostDialog) {
|
|
28056
27391
|
setShowCostDialog(true);
|
|
28057
27392
|
}
|
|
28058
27393
|
}, [messages, showCostDialog, haveShownCostDialog]);
|
|
28059
|
-
|
|
27394
|
+
useEffect25(() => {
|
|
28060
27395
|
if (autoExit && !isLoading) {
|
|
28061
27396
|
const tasks = listTasks({});
|
|
28062
27397
|
const hasTasks = tasks.length > 0;
|
|
@@ -28234,41 +27569,41 @@ function REPL({
|
|
|
28234
27569
|
setIsLoading(false);
|
|
28235
27570
|
}
|
|
28236
27571
|
useCostSummary();
|
|
28237
|
-
|
|
27572
|
+
useEffect25(() => {
|
|
28238
27573
|
const getMessages2 = () => messages;
|
|
28239
27574
|
setMessagesGetter(getMessages2);
|
|
28240
27575
|
setMessagesSetter(setMessages2);
|
|
28241
27576
|
}, [messages]);
|
|
28242
|
-
|
|
27577
|
+
useEffect25(() => {
|
|
28243
27578
|
setModelConfigChangeHandler(() => {
|
|
28244
27579
|
setUiRefreshCounter((prev) => prev + 1);
|
|
28245
27580
|
});
|
|
28246
27581
|
}, []);
|
|
28247
27582
|
useLogMessages(messages, messageLogName, forkNumber);
|
|
28248
27583
|
useLogStartupTime();
|
|
28249
|
-
|
|
27584
|
+
useEffect25(() => {
|
|
28250
27585
|
onInit();
|
|
28251
27586
|
}, []);
|
|
28252
|
-
const normalizedMessages =
|
|
27587
|
+
const normalizedMessages = useMemo25(
|
|
28253
27588
|
() => normalizeMessages(messages).filter(isNotEmptyMessage),
|
|
28254
27589
|
[messages]
|
|
28255
27590
|
);
|
|
28256
|
-
const displayMessages =
|
|
27591
|
+
const displayMessages = useMemo25(
|
|
28257
27592
|
() => filterProgressMessagesForTools(
|
|
28258
27593
|
normalizedMessages,
|
|
28259
27594
|
/* @__PURE__ */ new Set(["TaskCreate", "TaskUpdate", "TaskList", "TaskGet"])
|
|
28260
27595
|
),
|
|
28261
27596
|
[normalizedMessages]
|
|
28262
27597
|
);
|
|
28263
|
-
const unresolvedToolUseIDs =
|
|
27598
|
+
const unresolvedToolUseIDs = useMemo25(
|
|
28264
27599
|
() => getUnresolvedToolUseIDs(displayMessages),
|
|
28265
27600
|
[displayMessages]
|
|
28266
27601
|
);
|
|
28267
|
-
const inProgressToolUseIDs =
|
|
27602
|
+
const inProgressToolUseIDs = useMemo25(
|
|
28268
27603
|
() => getInProgressToolUseIDs(displayMessages),
|
|
28269
27604
|
[displayMessages]
|
|
28270
27605
|
);
|
|
28271
|
-
const erroredToolUseIDs =
|
|
27606
|
+
const erroredToolUseIDs = useMemo25(
|
|
28272
27607
|
() => new Set(
|
|
28273
27608
|
getErroredToolUseMessages(displayMessages).map(
|
|
28274
27609
|
(_) => _.message.content[0].id
|
|
@@ -28276,11 +27611,11 @@ function REPL({
|
|
|
28276
27611
|
),
|
|
28277
27612
|
[displayMessages]
|
|
28278
27613
|
);
|
|
28279
|
-
const orderedMessages =
|
|
27614
|
+
const orderedMessages = useMemo25(
|
|
28280
27615
|
() => reorderMessages(displayMessages),
|
|
28281
27616
|
[displayMessages]
|
|
28282
27617
|
);
|
|
28283
|
-
const replStaticPrefixLength =
|
|
27618
|
+
const replStaticPrefixLength = useMemo25(
|
|
28284
27619
|
() => getReplStaticPrefixLength(
|
|
28285
27620
|
orderedMessages,
|
|
28286
27621
|
normalizedMessages,
|
|
@@ -28288,10 +27623,10 @@ function REPL({
|
|
|
28288
27623
|
),
|
|
28289
27624
|
[orderedMessages, normalizedMessages, unresolvedToolUseIDs]
|
|
28290
27625
|
);
|
|
28291
|
-
const messagesJSX =
|
|
27626
|
+
const messagesJSX = useMemo25(() => {
|
|
28292
27627
|
return orderedMessages.map((_, index) => {
|
|
28293
27628
|
const toolUseID = getToolUseID(_);
|
|
28294
|
-
const message = _.type === "progress" ? _.content.message.content[0]?.type === "text" && _.content.message.content[0].text === INTERRUPT_MESSAGE ? /* @__PURE__ */
|
|
27629
|
+
const message = _.type === "progress" ? _.content.message.content[0]?.type === "text" && _.content.message.content[0].text === INTERRUPT_MESSAGE ? /* @__PURE__ */ React97.createElement(
|
|
28295
27630
|
Message,
|
|
28296
27631
|
{
|
|
28297
27632
|
message: _.content,
|
|
@@ -28306,10 +27641,10 @@ function REPL({
|
|
|
28306
27641
|
shouldAnimate: false,
|
|
28307
27642
|
shouldShowDot: false
|
|
28308
27643
|
}
|
|
28309
|
-
) : /* @__PURE__ */
|
|
27644
|
+
) : /* @__PURE__ */ React97.createElement(
|
|
28310
27645
|
MessageResponse,
|
|
28311
27646
|
{
|
|
28312
|
-
children: /* @__PURE__ */
|
|
27647
|
+
children: /* @__PURE__ */ React97.createElement(
|
|
28313
27648
|
Message,
|
|
28314
27649
|
{
|
|
28315
27650
|
message: _.content,
|
|
@@ -28328,7 +27663,7 @@ function REPL({
|
|
|
28328
27663
|
}
|
|
28329
27664
|
)
|
|
28330
27665
|
}
|
|
28331
|
-
) : /* @__PURE__ */
|
|
27666
|
+
) : /* @__PURE__ */ React97.createElement(
|
|
28332
27667
|
Message,
|
|
28333
27668
|
{
|
|
28334
27669
|
message: _,
|
|
@@ -28347,8 +27682,8 @@ function REPL({
|
|
|
28347
27682
|
const isInStaticPrefix = index < replStaticPrefixLength;
|
|
28348
27683
|
if (debug2) {
|
|
28349
27684
|
return {
|
|
28350
|
-
jsx: /* @__PURE__ */
|
|
28351
|
-
|
|
27685
|
+
jsx: /* @__PURE__ */ React97.createElement(
|
|
27686
|
+
Box72,
|
|
28352
27687
|
{
|
|
28353
27688
|
borderStyle: "single",
|
|
28354
27689
|
borderColor: isInStaticPrefix ? "green" : "red",
|
|
@@ -28360,7 +27695,7 @@ function REPL({
|
|
|
28360
27695
|
};
|
|
28361
27696
|
}
|
|
28362
27697
|
return {
|
|
28363
|
-
jsx: /* @__PURE__ */
|
|
27698
|
+
jsx: /* @__PURE__ */ React97.createElement(Box72, { key: _.uuid, width: "100%" }, message)
|
|
28364
27699
|
};
|
|
28365
27700
|
});
|
|
28366
27701
|
}, [
|
|
@@ -28380,10 +27715,10 @@ function REPL({
|
|
|
28380
27715
|
isDefaultModel,
|
|
28381
27716
|
replStaticPrefixLength
|
|
28382
27717
|
]);
|
|
28383
|
-
const staticItems =
|
|
27718
|
+
const staticItems = useMemo25(
|
|
28384
27719
|
() => [
|
|
28385
27720
|
{
|
|
28386
|
-
jsx: /* @__PURE__ */
|
|
27721
|
+
jsx: /* @__PURE__ */ React97.createElement(Box72, { flexDirection: "column", key: `logo${forkNumber}` }, /* @__PURE__ */ React97.createElement(
|
|
28387
27722
|
Logo,
|
|
28388
27723
|
{
|
|
28389
27724
|
mcpClients,
|
|
@@ -28391,7 +27726,7 @@ function REPL({
|
|
|
28391
27726
|
updateBannerVersion: updateAvailableVersion,
|
|
28392
27727
|
updateBannerCommands: updateCommands
|
|
28393
27728
|
}
|
|
28394
|
-
), /* @__PURE__ */
|
|
27729
|
+
), /* @__PURE__ */ React97.createElement(ProjectOnboarding, { workspaceDir: getOriginalCwd() }))
|
|
28395
27730
|
},
|
|
28396
27731
|
...messagesJSX.slice(0, replStaticPrefixLength)
|
|
28397
27732
|
],
|
|
@@ -28405,29 +27740,29 @@ function REPL({
|
|
|
28405
27740
|
updateCommands
|
|
28406
27741
|
]
|
|
28407
27742
|
);
|
|
28408
|
-
const transientItems =
|
|
27743
|
+
const transientItems = useMemo25(
|
|
28409
27744
|
() => messagesJSX.slice(replStaticPrefixLength),
|
|
28410
27745
|
[messagesJSX, replStaticPrefixLength]
|
|
28411
27746
|
);
|
|
28412
27747
|
const showingCostDialog = !isLoading && showCostDialog;
|
|
28413
27748
|
const conversationKey = `${messageLogName}:${forkNumber}`;
|
|
28414
|
-
return /* @__PURE__ */
|
|
27749
|
+
return /* @__PURE__ */ React97.createElement(
|
|
28415
27750
|
PermissionProvider,
|
|
28416
27751
|
{
|
|
28417
27752
|
conversationKey,
|
|
28418
27753
|
isBypassPermissionsModeAvailable: !safeMode
|
|
28419
27754
|
},
|
|
28420
|
-
/* @__PURE__ */
|
|
28421
|
-
|
|
27755
|
+
/* @__PURE__ */ React97.createElement(React97.Fragment, null, /* @__PURE__ */ React97.createElement(React97.Fragment, { key: `static-messages-${forkNumber}` }, /* @__PURE__ */ React97.createElement(Static2, { items: staticItems, children: (item) => item.jsx })), /* @__PURE__ */ React97.createElement(TaskPanel, null), transientItems.map((_) => _.jsx), /* @__PURE__ */ React97.createElement(
|
|
27756
|
+
Box72,
|
|
28422
27757
|
{
|
|
28423
27758
|
borderColor: "red",
|
|
28424
27759
|
borderStyle: debug2 ? "single" : void 0,
|
|
28425
27760
|
flexDirection: "column",
|
|
28426
27761
|
width: "100%"
|
|
28427
27762
|
},
|
|
28428
|
-
!toolJSX && !toolUseConfirm && !binaryFeedbackContext && isLoading && /* @__PURE__ */
|
|
27763
|
+
!toolJSX && !toolUseConfirm && !binaryFeedbackContext && isLoading && /* @__PURE__ */ React97.createElement(RequestStatusIndicator, null),
|
|
28429
27764
|
toolJSX ? toolJSX.jsx : null,
|
|
28430
|
-
!toolJSX && binaryFeedbackContext && !isMessageSelectorVisible && /* @__PURE__ */
|
|
27765
|
+
!toolJSX && binaryFeedbackContext && !isMessageSelectorVisible && /* @__PURE__ */ React97.createElement(
|
|
28431
27766
|
BinaryFeedback,
|
|
28432
27767
|
{
|
|
28433
27768
|
m1: binaryFeedbackContext.m1,
|
|
@@ -28445,7 +27780,7 @@ function REPL({
|
|
|
28445
27780
|
unresolvedToolUseIDs
|
|
28446
27781
|
}
|
|
28447
27782
|
),
|
|
28448
|
-
!toolJSX && toolUseConfirm && !isMessageSelectorVisible && !binaryFeedbackContext && /* @__PURE__ */
|
|
27783
|
+
!toolJSX && toolUseConfirm && !isMessageSelectorVisible && !binaryFeedbackContext && /* @__PURE__ */ React97.createElement(
|
|
28449
27784
|
PermissionRequest,
|
|
28450
27785
|
{
|
|
28451
27786
|
toolUseConfirm,
|
|
@@ -28453,7 +27788,7 @@ function REPL({
|
|
|
28453
27788
|
verbose
|
|
28454
27789
|
}
|
|
28455
27790
|
),
|
|
28456
|
-
!toolJSX && !toolUseConfirm && !isMessageSelectorVisible && !binaryFeedbackContext && showingCostDialog && /* @__PURE__ */
|
|
27791
|
+
!toolJSX && !toolUseConfirm && !isMessageSelectorVisible && !binaryFeedbackContext && showingCostDialog && /* @__PURE__ */ React97.createElement(
|
|
28457
27792
|
CostThresholdDialog,
|
|
28458
27793
|
{
|
|
28459
27794
|
onDone: () => {
|
|
@@ -28467,7 +27802,7 @@ function REPL({
|
|
|
28467
27802
|
}
|
|
28468
27803
|
}
|
|
28469
27804
|
),
|
|
28470
|
-
!toolUseConfirm && !toolJSX?.shouldHidePromptInput && shouldShowPromptInput && !isMessageSelectorVisible && !binaryFeedbackContext && !showingCostDialog && /* @__PURE__ */
|
|
27805
|
+
!toolUseConfirm && !toolJSX?.shouldHidePromptInput && shouldShowPromptInput && !isMessageSelectorVisible && !binaryFeedbackContext && !showingCostDialog && /* @__PURE__ */ React97.createElement(React97.Fragment, null, /* @__PURE__ */ React97.createElement(
|
|
28471
27806
|
PromptInput_default,
|
|
28472
27807
|
{
|
|
28473
27808
|
commands,
|
|
@@ -28497,7 +27832,7 @@ function REPL({
|
|
|
28497
27832
|
abortController
|
|
28498
27833
|
}
|
|
28499
27834
|
))
|
|
28500
|
-
), isMessageSelectorVisible && /* @__PURE__ */
|
|
27835
|
+
), isMessageSelectorVisible && /* @__PURE__ */ React97.createElement(
|
|
28501
27836
|
MessageSelector,
|
|
28502
27837
|
{
|
|
28503
27838
|
erroredToolUseIDs,
|
|
@@ -28523,13 +27858,13 @@ function REPL({
|
|
|
28523
27858
|
onEscape: () => setIsMessageSelectorVisible(false),
|
|
28524
27859
|
tools
|
|
28525
27860
|
}
|
|
28526
|
-
), /* @__PURE__ */
|
|
27861
|
+
), /* @__PURE__ */ React97.createElement(Newline4, null))
|
|
28527
27862
|
);
|
|
28528
27863
|
}
|
|
28529
27864
|
|
|
28530
27865
|
// src/ui/components/SessionSelector.tsx
|
|
28531
|
-
import
|
|
28532
|
-
import { Box as
|
|
27866
|
+
import React98 from "react";
|
|
27867
|
+
import { Box as Box73, Text as Text77 } from "ink";
|
|
28533
27868
|
function SessionSelector({
|
|
28534
27869
|
sessions,
|
|
28535
27870
|
onSelect
|
|
@@ -28557,14 +27892,14 @@ function SessionSelector({
|
|
|
28557
27892
|
const truncated = labelTxt.length > columns - 2 ? `${labelTxt.slice(0, columns - 5)}...` : labelTxt;
|
|
28558
27893
|
return { label: truncated, value: String(i) };
|
|
28559
27894
|
});
|
|
28560
|
-
return /* @__PURE__ */
|
|
27895
|
+
return /* @__PURE__ */ React98.createElement(Box73, { flexDirection: "column", height: "100%", width: "100%" }, /* @__PURE__ */ React98.createElement(Box73, { paddingLeft: 9 }, /* @__PURE__ */ React98.createElement(Text77, { bold: true, color: getTheme().text }, "Modified"), /* @__PURE__ */ React98.createElement(Text77, null, " "), /* @__PURE__ */ React98.createElement(Text77, { bold: true, color: getTheme().text }, "Created"), /* @__PURE__ */ React98.createElement(Text77, null, " "), /* @__PURE__ */ React98.createElement(Text77, { bold: true, color: getTheme().text }, "Tag"), /* @__PURE__ */ React98.createElement(Text77, null, " "), /* @__PURE__ */ React98.createElement(Text77, { bold: true, color: getTheme().text }, "Session")), /* @__PURE__ */ React98.createElement(
|
|
28561
27896
|
Select,
|
|
28562
27897
|
{
|
|
28563
27898
|
options,
|
|
28564
27899
|
onChange: (value) => onSelect(parseInt(value, 10)),
|
|
28565
27900
|
visibleOptionCount: visibleCount
|
|
28566
27901
|
}
|
|
28567
|
-
), hiddenCount > 0 && /* @__PURE__ */
|
|
27902
|
+
), hiddenCount > 0 && /* @__PURE__ */ React98.createElement(Box73, { paddingLeft: 2 }, /* @__PURE__ */ React98.createElement(Text77, { color: getTheme().secondaryText }, "and ", hiddenCount, " more\u2026")));
|
|
28568
27903
|
}
|
|
28569
27904
|
|
|
28570
27905
|
// src/ui/screens/ResumeConversation.tsx
|
|
@@ -28600,7 +27935,7 @@ function ResumeConversation({
|
|
|
28600
27935
|
});
|
|
28601
27936
|
const isDefaultModel = await isDefaultSlowAndCapableModel();
|
|
28602
27937
|
render(
|
|
28603
|
-
/* @__PURE__ */
|
|
27938
|
+
/* @__PURE__ */ React99.createElement(
|
|
28604
27939
|
REPL,
|
|
28605
27940
|
{
|
|
28606
27941
|
commands,
|
|
@@ -28628,7 +27963,7 @@ function ResumeConversation({
|
|
|
28628
27963
|
throw e;
|
|
28629
27964
|
}
|
|
28630
27965
|
}
|
|
28631
|
-
return /* @__PURE__ */
|
|
27966
|
+
return /* @__PURE__ */ React99.createElement(SessionSelector, { sessions, onSelect });
|
|
28632
27967
|
}
|
|
28633
27968
|
|
|
28634
27969
|
// src/commands/resume.tsx
|
|
@@ -28651,7 +27986,7 @@ var resume_default = {
|
|
|
28651
27986
|
return null;
|
|
28652
27987
|
}
|
|
28653
27988
|
render2(
|
|
28654
|
-
/* @__PURE__ */
|
|
27989
|
+
/* @__PURE__ */ React100.createElement(
|
|
28655
27990
|
ResumeConversation,
|
|
28656
27991
|
{
|
|
28657
27992
|
cwd,
|
|
@@ -28668,11 +28003,11 @@ var resume_default = {
|
|
|
28668
28003
|
};
|
|
28669
28004
|
|
|
28670
28005
|
// src/commands/agents.tsx
|
|
28671
|
-
import
|
|
28006
|
+
import React102 from "react";
|
|
28672
28007
|
|
|
28673
28008
|
// src/commands/agents/ui.tsx
|
|
28674
|
-
import
|
|
28675
|
-
import { Box as
|
|
28009
|
+
import React101, { useCallback as useCallback17, useEffect as useEffect26, useMemo as useMemo26, useRef as useRef14, useState as useState28 } from "react";
|
|
28010
|
+
import { Box as Box74, Text as Text78, useInput as useInput28 } from "ink";
|
|
28676
28011
|
import figures9 from "figures";
|
|
28677
28012
|
import chalk15 from "chalk";
|
|
28678
28013
|
import { join as join13 } from "path";
|
|
@@ -28734,7 +28069,7 @@ import {
|
|
|
28734
28069
|
mkdirSync as mkdirSync7,
|
|
28735
28070
|
renameSync as renameSync3,
|
|
28736
28071
|
unlinkSync as unlinkSync2,
|
|
28737
|
-
writeFileSync as
|
|
28072
|
+
writeFileSync as writeFileSync6
|
|
28738
28073
|
} from "fs";
|
|
28739
28074
|
import { join as join12 } from "path";
|
|
28740
28075
|
import { homedir as homedir8 } from "os";
|
|
@@ -28742,7 +28077,7 @@ import { homedir as homedir8 } from "os";
|
|
|
28742
28077
|
// src/commands/agents/generation.ts
|
|
28743
28078
|
import { randomUUID as randomUUID6 } from "crypto";
|
|
28744
28079
|
async function generateAgentWithClaude(prompt) {
|
|
28745
|
-
const { queryModel } = await import("./llm-
|
|
28080
|
+
const { queryModel } = await import("./llm-A3S75CLF.js");
|
|
28746
28081
|
const systemPrompt = `You are an expert at creating AI agent configurations. Based on the user's description, generate a specialized agent configuration.
|
|
28747
28082
|
|
|
28748
28083
|
Return your response as a JSON object with exactly these fields:
|
|
@@ -28967,7 +28302,7 @@ async function saveAgent(location, agentType, description3, tools, systemPrompt,
|
|
|
28967
28302
|
color
|
|
28968
28303
|
);
|
|
28969
28304
|
try {
|
|
28970
|
-
|
|
28305
|
+
writeFileSync6(tempFile, content, { encoding: "utf-8", flag: "wx" });
|
|
28971
28306
|
if (throwIfExists && (existsSync15(filePath) || existsSync15(legacyPath))) {
|
|
28972
28307
|
try {
|
|
28973
28308
|
unlinkSync2(tempFile);
|
|
@@ -29008,7 +28343,7 @@ async function updateAgent(agent, description3, tools, systemPrompt, color, mode
|
|
|
29008
28343
|
const legacyPath = getLegacyAgentFilePath(location, agent.agentType);
|
|
29009
28344
|
const filePath = existsSync15(primaryPath) ? primaryPath : existsSync15(legacyPath) ? legacyPath : primaryPath;
|
|
29010
28345
|
ensureDirectoryExists(location);
|
|
29011
|
-
|
|
28346
|
+
writeFileSync6(filePath, content, { encoding: "utf-8", flag: "w" });
|
|
29012
28347
|
}
|
|
29013
28348
|
async function deleteAgent(agent) {
|
|
29014
28349
|
if (agent.location === "built-in" || agent.location === "plugin") {
|
|
@@ -29124,21 +28459,21 @@ function panelBorderColor(kind) {
|
|
|
29124
28459
|
}
|
|
29125
28460
|
function Panel(props) {
|
|
29126
28461
|
const theme = getTheme();
|
|
29127
|
-
return /* @__PURE__ */
|
|
29128
|
-
|
|
28462
|
+
return /* @__PURE__ */ React101.createElement(
|
|
28463
|
+
Box74,
|
|
29129
28464
|
{
|
|
29130
28465
|
borderStyle: "round",
|
|
29131
28466
|
borderColor: props.borderColor ?? theme.suggestion,
|
|
29132
28467
|
flexDirection: "column"
|
|
29133
28468
|
},
|
|
29134
|
-
/* @__PURE__ */
|
|
29135
|
-
/* @__PURE__ */
|
|
28469
|
+
/* @__PURE__ */ React101.createElement(Box74, { flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React101.createElement(Text78, { bold: true, color: props.titleColor ?? theme.text }, props.title), props.subtitle ? /* @__PURE__ */ React101.createElement(Text78, { dimColor: true }, props.subtitle) : null),
|
|
28470
|
+
/* @__PURE__ */ React101.createElement(Box74, { paddingX: 1, flexDirection: "column" }, props.children)
|
|
29136
28471
|
);
|
|
29137
28472
|
}
|
|
29138
28473
|
function Instructions({
|
|
29139
28474
|
instructions = "Press \u2191\u2193 to navigate \xB7 Enter to select \xB7 Esc to go back"
|
|
29140
28475
|
}) {
|
|
29141
|
-
return /* @__PURE__ */
|
|
28476
|
+
return /* @__PURE__ */ React101.createElement(Box74, { marginLeft: 3 }, /* @__PURE__ */ React101.createElement(Text78, { dimColor: true }, instructions));
|
|
29142
28477
|
}
|
|
29143
28478
|
function computeOverrides(args) {
|
|
29144
28479
|
const activeByType = /* @__PURE__ */ new Map();
|
|
@@ -29151,7 +28486,7 @@ function computeOverrides(args) {
|
|
|
29151
28486
|
}
|
|
29152
28487
|
function AgentsListView(props) {
|
|
29153
28488
|
const theme = getTheme();
|
|
29154
|
-
const selectableAgents =
|
|
28489
|
+
const selectableAgents = useMemo26(() => {
|
|
29155
28490
|
const nonBuiltIn = props.agents.filter((a) => a.source !== "built-in");
|
|
29156
28491
|
if (props.source === "all") {
|
|
29157
28492
|
return [
|
|
@@ -29164,11 +28499,11 @@ function AgentsListView(props) {
|
|
|
29164
28499
|
}
|
|
29165
28500
|
return nonBuiltIn;
|
|
29166
28501
|
}, [props.agents, props.source]);
|
|
29167
|
-
const [selectedAgent, setSelectedAgent] =
|
|
28502
|
+
const [selectedAgent, setSelectedAgent] = useState28(
|
|
29168
28503
|
null
|
|
29169
28504
|
);
|
|
29170
|
-
const [onCreateOption, setOnCreateOption] =
|
|
29171
|
-
|
|
28505
|
+
const [onCreateOption, setOnCreateOption] = useState28(true);
|
|
28506
|
+
useEffect26(() => {
|
|
29172
28507
|
if (props.onCreateNew) {
|
|
29173
28508
|
setOnCreateOption(true);
|
|
29174
28509
|
setSelectedAgent(null);
|
|
@@ -29178,7 +28513,7 @@ function AgentsListView(props) {
|
|
|
29178
28513
|
setSelectedAgent(selectableAgents[0] ?? null);
|
|
29179
28514
|
}
|
|
29180
28515
|
}, [props.source]);
|
|
29181
|
-
|
|
28516
|
+
useInput28((_input, key) => {
|
|
29182
28517
|
if (key.escape) {
|
|
29183
28518
|
props.onBack();
|
|
29184
28519
|
return;
|
|
@@ -29217,38 +28552,38 @@ function AgentsListView(props) {
|
|
|
29217
28552
|
setSelectedAgent(nextAgent);
|
|
29218
28553
|
}
|
|
29219
28554
|
});
|
|
29220
|
-
const renderCreateNew = () => /* @__PURE__ */
|
|
28555
|
+
const renderCreateNew = () => /* @__PURE__ */ React101.createElement(Box74, null, /* @__PURE__ */ React101.createElement(Text78, { color: onCreateOption ? theme.suggestion : void 0 }, onCreateOption ? `${figures9.pointer} ` : " "), /* @__PURE__ */ React101.createElement(Text78, { color: onCreateOption ? theme.suggestion : void 0 }, "Create new agent"));
|
|
29221
28556
|
const renderAgentRow = (agent) => {
|
|
29222
28557
|
const isBuiltIn = agent.source === "built-in";
|
|
29223
28558
|
const isSelected = !isBuiltIn && !onCreateOption && selectedAgent?.agentType === agent.agentType && selectedAgent?.source === agent.source;
|
|
29224
28559
|
const dimmed = Boolean(isBuiltIn || agent.overriddenBy);
|
|
29225
28560
|
const rowColor = isSelected ? theme.suggestion : void 0;
|
|
29226
28561
|
const pointer = isBuiltIn ? "" : isSelected ? `${figures9.pointer} ` : " ";
|
|
29227
|
-
return /* @__PURE__ */
|
|
28562
|
+
return /* @__PURE__ */ React101.createElement(Box74, { key: `${agent.agentType}-${agent.source}`, flexDirection: "row" }, /* @__PURE__ */ React101.createElement(Text78, { dimColor: dimmed && !isSelected, color: rowColor }, pointer), /* @__PURE__ */ React101.createElement(Text78, { dimColor: dimmed && !isSelected, color: rowColor }, agent.agentType), /* @__PURE__ */ React101.createElement(Text78, { dimColor: true, color: rowColor }, " \xB7 ", formatModelShort(agent.model)), agent.overriddenBy ? /* @__PURE__ */ React101.createElement(Text78, { dimColor: !isSelected, color: isSelected ? theme.warning : void 0 }, " ", figures9.warning, " overridden by ", agent.overriddenBy) : null);
|
|
29228
28563
|
};
|
|
29229
28564
|
const group = (label, agents) => {
|
|
29230
28565
|
if (agents.length === 0) return null;
|
|
29231
28566
|
const baseDir = agents[0]?.baseDir;
|
|
29232
|
-
return /* @__PURE__ */
|
|
28567
|
+
return /* @__PURE__ */ React101.createElement(Box74, { flexDirection: "column", marginBottom: 1 }, /* @__PURE__ */ React101.createElement(Box74, { paddingLeft: 2 }, /* @__PURE__ */ React101.createElement(Text78, { bold: true, dimColor: true }, label), baseDir ? /* @__PURE__ */ React101.createElement(Text78, { dimColor: true }, " ", "(", baseDir, ")") : null), agents.map(renderAgentRow));
|
|
29233
28568
|
};
|
|
29234
28569
|
const builtInSection = (label = "Built-in (always available):") => {
|
|
29235
28570
|
const builtIn = props.agents.filter((a) => a.source === "built-in");
|
|
29236
28571
|
if (builtIn.length === 0) return null;
|
|
29237
|
-
return /* @__PURE__ */
|
|
28572
|
+
return /* @__PURE__ */ React101.createElement(Box74, { flexDirection: "column", marginBottom: 1, paddingLeft: 2 }, /* @__PURE__ */ React101.createElement(Text78, { bold: true, dimColor: true }, label), builtIn.map(renderAgentRow));
|
|
29238
28573
|
};
|
|
29239
28574
|
const notOverriddenCount = props.agents.filter((a) => !a.overriddenBy).length;
|
|
29240
28575
|
const title = titleForSource(props.source);
|
|
29241
28576
|
if (props.agents.length === 0 || props.source !== "built-in" && !props.agents.some((a) => a.source !== "built-in")) {
|
|
29242
|
-
return /* @__PURE__ */
|
|
28577
|
+
return /* @__PURE__ */ React101.createElement(React101.Fragment, null, /* @__PURE__ */ React101.createElement(Panel, { title, subtitle: "No agents found" }, props.onCreateNew ? /* @__PURE__ */ React101.createElement(Box74, { marginY: 1 }, renderCreateNew()) : null, /* @__PURE__ */ React101.createElement(Text78, { dimColor: true }, "No agents found. Create specialized subagents that Claude can delegate to."), /* @__PURE__ */ React101.createElement(Text78, { dimColor: true }, "Each subagent has its own context window, custom system prompt, and specific tools."), /* @__PURE__ */ React101.createElement(Text78, { dimColor: true }, "Try creating: Code Reviewer, Code Simplifier, Security Reviewer, Tech Lead, or UX Reviewer."), props.source !== "built-in" && props.agents.some((a) => a.source === "built-in") ? /* @__PURE__ */ React101.createElement(React101.Fragment, null, /* @__PURE__ */ React101.createElement(Box74, { marginTop: 1 }, /* @__PURE__ */ React101.createElement(Text78, { dimColor: true }, "\u2500".repeat(40))), builtInSection()) : null), /* @__PURE__ */ React101.createElement(Instructions, null));
|
|
29243
28578
|
}
|
|
29244
|
-
return /* @__PURE__ */
|
|
28579
|
+
return /* @__PURE__ */ React101.createElement(React101.Fragment, null, /* @__PURE__ */ React101.createElement(
|
|
29245
28580
|
Panel,
|
|
29246
28581
|
{
|
|
29247
28582
|
title,
|
|
29248
28583
|
subtitle: `${notOverriddenCount} agents`
|
|
29249
28584
|
},
|
|
29250
|
-
props.changes.length > 0 ? /* @__PURE__ */
|
|
29251
|
-
/* @__PURE__ */
|
|
28585
|
+
props.changes.length > 0 ? /* @__PURE__ */ React101.createElement(Box74, { marginTop: 1 }, /* @__PURE__ */ React101.createElement(Text78, { dimColor: true }, props.changes[props.changes.length - 1])) : null,
|
|
28586
|
+
/* @__PURE__ */ React101.createElement(Box74, { flexDirection: "column", marginTop: 1 }, props.onCreateNew ? /* @__PURE__ */ React101.createElement(Box74, { marginBottom: 1 }, renderCreateNew()) : null, props.source === "all" ? /* @__PURE__ */ React101.createElement(React101.Fragment, null, group(
|
|
29252
28587
|
"User agents",
|
|
29253
28588
|
props.agents.filter((a) => a.source === "userSettings")
|
|
29254
28589
|
), group(
|
|
@@ -29263,8 +28598,8 @@ function AgentsListView(props) {
|
|
|
29263
28598
|
), group(
|
|
29264
28599
|
"CLI arg agents",
|
|
29265
28600
|
props.agents.filter((a) => a.source === "flagSettings")
|
|
29266
|
-
), builtInSection("Built-in agents (always available)")) : props.source === "built-in" ? /* @__PURE__ */
|
|
29267
|
-
), /* @__PURE__ */
|
|
28601
|
+
), builtInSection("Built-in agents (always available)")) : props.source === "built-in" ? /* @__PURE__ */ React101.createElement(React101.Fragment, null, /* @__PURE__ */ React101.createElement(Text78, { dimColor: true, italic: true }, "Built-in agents are provided by default and cannot be modified."), /* @__PURE__ */ React101.createElement(Box74, { marginTop: 1, flexDirection: "column" }, props.agents.map(renderAgentRow))) : /* @__PURE__ */ React101.createElement(Box74, { flexDirection: "column" }, props.agents.filter((a) => a.source !== "built-in").map(renderAgentRow)))
|
|
28602
|
+
), /* @__PURE__ */ React101.createElement(Instructions, null));
|
|
29268
28603
|
}
|
|
29269
28604
|
function wizardLocationToStorageLocation(location) {
|
|
29270
28605
|
return location === "projectSettings" ? "project" : "user";
|
|
@@ -29300,9 +28635,9 @@ function modelOptions() {
|
|
|
29300
28635
|
];
|
|
29301
28636
|
}
|
|
29302
28637
|
function Wizard(props) {
|
|
29303
|
-
const [stepIndex, setStepIndex] =
|
|
29304
|
-
const [data, setData] =
|
|
29305
|
-
const [history, setHistory] =
|
|
28638
|
+
const [stepIndex, setStepIndex] = useState28(0);
|
|
28639
|
+
const [data, setData] = useState28(props.initialData ?? {});
|
|
28640
|
+
const [history, setHistory] = useState28([]);
|
|
29306
28641
|
const goNext = useCallback17(() => {
|
|
29307
28642
|
setHistory((prev) => [...prev, stepIndex]);
|
|
29308
28643
|
setStepIndex((prev) => Math.min(prev + 1, props.steps.length - 1));
|
|
@@ -29331,7 +28666,7 @@ function Wizard(props) {
|
|
|
29331
28666
|
}, []);
|
|
29332
28667
|
const cancel = useCallback17(() => props.onCancel(), [props.onCancel]);
|
|
29333
28668
|
const done = useCallback17(() => props.onDone(data), [props, data]);
|
|
29334
|
-
const ctx =
|
|
28669
|
+
const ctx = useMemo26(
|
|
29335
28670
|
() => ({
|
|
29336
28671
|
stepIndex,
|
|
29337
28672
|
totalSteps: props.steps.length,
|
|
@@ -29355,16 +28690,16 @@ function Wizard(props) {
|
|
|
29355
28690
|
cancel
|
|
29356
28691
|
]
|
|
29357
28692
|
);
|
|
29358
|
-
return /* @__PURE__ */
|
|
28693
|
+
return /* @__PURE__ */ React101.createElement(React101.Fragment, null, props.steps[stepIndex]?.(ctx) ?? null);
|
|
29359
28694
|
}
|
|
29360
28695
|
function WizardPanel(props) {
|
|
29361
|
-
return /* @__PURE__ */
|
|
28696
|
+
return /* @__PURE__ */ React101.createElement(React101.Fragment, null, /* @__PURE__ */ React101.createElement(Panel, { title: "Create new agent", subtitle: props.subtitle }, props.children), /* @__PURE__ */ React101.createElement(Instructions, { instructions: props.footerText }));
|
|
29362
28697
|
}
|
|
29363
28698
|
function StepChooseLocation({ ctx }) {
|
|
29364
|
-
|
|
28699
|
+
useInput28((_input, key) => {
|
|
29365
28700
|
if (key.escape) ctx.cancel();
|
|
29366
28701
|
});
|
|
29367
|
-
return /* @__PURE__ */
|
|
28702
|
+
return /* @__PURE__ */ React101.createElement(WizardPanel, { subtitle: "Choose location", footerText: "Press \u2191\u2193 to navigate \xB7 Enter to select \xB7 Esc to cancel" }, /* @__PURE__ */ React101.createElement(Box74, { marginTop: 1 }, /* @__PURE__ */ React101.createElement(
|
|
29368
28703
|
Select,
|
|
29369
28704
|
{
|
|
29370
28705
|
options: [
|
|
@@ -29380,10 +28715,10 @@ function StepChooseLocation({ ctx }) {
|
|
|
29380
28715
|
)));
|
|
29381
28716
|
}
|
|
29382
28717
|
function StepChooseMethod({ ctx }) {
|
|
29383
|
-
|
|
28718
|
+
useInput28((_input, key) => {
|
|
29384
28719
|
if (key.escape) ctx.goBack();
|
|
29385
28720
|
});
|
|
29386
|
-
return /* @__PURE__ */
|
|
28721
|
+
return /* @__PURE__ */ React101.createElement(WizardPanel, { subtitle: "Creation method" }, /* @__PURE__ */ React101.createElement(Box74, { marginTop: 1 }, /* @__PURE__ */ React101.createElement(
|
|
29387
28722
|
Select,
|
|
29388
28723
|
{
|
|
29389
28724
|
options: [
|
|
@@ -29401,13 +28736,13 @@ function StepChooseMethod({ ctx }) {
|
|
|
29401
28736
|
}
|
|
29402
28737
|
function StepGenerationPrompt(props) {
|
|
29403
28738
|
const { ctx } = props;
|
|
29404
|
-
const [value, setValue] =
|
|
29405
|
-
const [cursorOffset, setCursorOffset] =
|
|
29406
|
-
const [isGenerating, setIsGenerating] =
|
|
29407
|
-
const [error, setError] =
|
|
28739
|
+
const [value, setValue] = useState28(ctx.wizardData.generationPrompt ?? "");
|
|
28740
|
+
const [cursorOffset, setCursorOffset] = useState28(value.length);
|
|
28741
|
+
const [isGenerating, setIsGenerating] = useState28(false);
|
|
28742
|
+
const [error, setError] = useState28(null);
|
|
29408
28743
|
const abortRef = useRef14(null);
|
|
29409
28744
|
const columns = Math.min(80, process.stdout.columns ?? 80);
|
|
29410
|
-
|
|
28745
|
+
useInput28((_input, key) => {
|
|
29411
28746
|
if (!key.escape) return;
|
|
29412
28747
|
if (isGenerating && abortRef.current) {
|
|
29413
28748
|
abortRef.current.abort();
|
|
@@ -29467,7 +28802,7 @@ function StepGenerationPrompt(props) {
|
|
|
29467
28802
|
abortRef.current = null;
|
|
29468
28803
|
}
|
|
29469
28804
|
};
|
|
29470
|
-
return /* @__PURE__ */
|
|
28805
|
+
return /* @__PURE__ */ React101.createElement(WizardPanel, { subtitle: "Describe the agent you want" }, /* @__PURE__ */ React101.createElement(Box74, { flexDirection: "column", marginTop: 1, gap: 1 }, /* @__PURE__ */ React101.createElement(Text78, null, "What should this agent do?"), /* @__PURE__ */ React101.createElement(Text78, { dimColor: true }, "Describe a role like \u201Ccode reviewer\u201D, \u201Csecurity auditor\u201D, or \u201Ctech lead\u201D."), /* @__PURE__ */ React101.createElement(
|
|
29471
28806
|
TextInput,
|
|
29472
28807
|
{
|
|
29473
28808
|
value,
|
|
@@ -29478,7 +28813,7 @@ function StepGenerationPrompt(props) {
|
|
|
29478
28813
|
cursorOffset,
|
|
29479
28814
|
onChangeCursorOffset: setCursorOffset
|
|
29480
28815
|
}
|
|
29481
|
-
), error ? /* @__PURE__ */
|
|
28816
|
+
), error ? /* @__PURE__ */ React101.createElement(Text78, { color: themeColor("error") }, error) : null, isGenerating ? /* @__PURE__ */ React101.createElement(Text78, { dimColor: true }, "Generating\u2026") : null));
|
|
29482
28817
|
}
|
|
29483
28818
|
function themeColor(kind) {
|
|
29484
28819
|
const theme = getTheme();
|
|
@@ -29496,11 +28831,11 @@ function themeColor(kind) {
|
|
|
29496
28831
|
}
|
|
29497
28832
|
function StepAgentType(props) {
|
|
29498
28833
|
const { ctx } = props;
|
|
29499
|
-
const [value, setValue] =
|
|
29500
|
-
const [cursorOffset, setCursorOffset] =
|
|
29501
|
-
const [error, setError] =
|
|
28834
|
+
const [value, setValue] = useState28(ctx.wizardData.agentType ?? "");
|
|
28835
|
+
const [cursorOffset, setCursorOffset] = useState28(value.length);
|
|
28836
|
+
const [error, setError] = useState28(null);
|
|
29502
28837
|
const columns = 60;
|
|
29503
|
-
|
|
28838
|
+
useInput28((_input, key) => {
|
|
29504
28839
|
if (key.escape) ctx.goBack();
|
|
29505
28840
|
});
|
|
29506
28841
|
const onSubmit = (next) => {
|
|
@@ -29514,13 +28849,13 @@ function StepAgentType(props) {
|
|
|
29514
28849
|
ctx.updateWizardData({ agentType: trimmed });
|
|
29515
28850
|
ctx.goNext();
|
|
29516
28851
|
};
|
|
29517
|
-
return /* @__PURE__ */
|
|
28852
|
+
return /* @__PURE__ */ React101.createElement(
|
|
29518
28853
|
WizardPanel,
|
|
29519
28854
|
{
|
|
29520
28855
|
subtitle: "Agent type (identifier)",
|
|
29521
28856
|
footerText: "Press Enter to continue \xB7 Esc to go back"
|
|
29522
28857
|
},
|
|
29523
|
-
/* @__PURE__ */
|
|
28858
|
+
/* @__PURE__ */ React101.createElement(Box74, { flexDirection: "column", marginTop: 1, gap: 1 }, /* @__PURE__ */ React101.createElement(Text78, null, "Enter a unique identifier for your agent:"), /* @__PURE__ */ React101.createElement(
|
|
29524
28859
|
TextInput,
|
|
29525
28860
|
{
|
|
29526
28861
|
value,
|
|
@@ -29530,15 +28865,15 @@ function StepAgentType(props) {
|
|
|
29530
28865
|
cursorOffset,
|
|
29531
28866
|
onChangeCursorOffset: setCursorOffset
|
|
29532
28867
|
}
|
|
29533
|
-
), /* @__PURE__ */
|
|
28868
|
+
), /* @__PURE__ */ React101.createElement(Text78, { dimColor: true }, "e.g., code-reviewer, tech-lead, etc"), error ? /* @__PURE__ */ React101.createElement(Text78, { color: themeColor("error") }, error) : null)
|
|
29534
28869
|
);
|
|
29535
28870
|
}
|
|
29536
28871
|
function StepSystemPrompt({ ctx }) {
|
|
29537
|
-
const [value, setValue] =
|
|
29538
|
-
const [cursorOffset, setCursorOffset] =
|
|
29539
|
-
const [error, setError] =
|
|
28872
|
+
const [value, setValue] = useState28(ctx.wizardData.systemPrompt ?? "");
|
|
28873
|
+
const [cursorOffset, setCursorOffset] = useState28(value.length);
|
|
28874
|
+
const [error, setError] = useState28(null);
|
|
29540
28875
|
const columns = Math.min(80, process.stdout.columns ?? 80);
|
|
29541
|
-
|
|
28876
|
+
useInput28((_input, key) => {
|
|
29542
28877
|
if (key.escape) ctx.goBack();
|
|
29543
28878
|
});
|
|
29544
28879
|
const onSubmit = (next) => {
|
|
@@ -29551,13 +28886,13 @@ function StepSystemPrompt({ ctx }) {
|
|
|
29551
28886
|
ctx.updateWizardData({ systemPrompt: trimmed });
|
|
29552
28887
|
ctx.goNext();
|
|
29553
28888
|
};
|
|
29554
|
-
return /* @__PURE__ */
|
|
28889
|
+
return /* @__PURE__ */ React101.createElement(
|
|
29555
28890
|
WizardPanel,
|
|
29556
28891
|
{
|
|
29557
28892
|
subtitle: "System prompt",
|
|
29558
28893
|
footerText: "Press Enter to continue \xB7 Esc to go back"
|
|
29559
28894
|
},
|
|
29560
|
-
/* @__PURE__ */
|
|
28895
|
+
/* @__PURE__ */ React101.createElement(Box74, { flexDirection: "column", marginTop: 1, gap: 1 }, /* @__PURE__ */ React101.createElement(Text78, null, "Enter the system prompt for your agent:"), /* @__PURE__ */ React101.createElement(Text78, { dimColor: true }, "Be comprehensive for best results"), /* @__PURE__ */ React101.createElement(
|
|
29561
28896
|
TextInput,
|
|
29562
28897
|
{
|
|
29563
28898
|
value,
|
|
@@ -29568,15 +28903,15 @@ function StepSystemPrompt({ ctx }) {
|
|
|
29568
28903
|
cursorOffset,
|
|
29569
28904
|
onChangeCursorOffset: setCursorOffset
|
|
29570
28905
|
}
|
|
29571
|
-
), error ? /* @__PURE__ */
|
|
28906
|
+
), error ? /* @__PURE__ */ React101.createElement(Text78, { color: themeColor("error") }, error) : null)
|
|
29572
28907
|
);
|
|
29573
28908
|
}
|
|
29574
28909
|
function StepDescription({ ctx }) {
|
|
29575
|
-
const [value, setValue] =
|
|
29576
|
-
const [cursorOffset, setCursorOffset] =
|
|
29577
|
-
const [error, setError] =
|
|
28910
|
+
const [value, setValue] = useState28(ctx.wizardData.whenToUse ?? "");
|
|
28911
|
+
const [cursorOffset, setCursorOffset] = useState28(value.length);
|
|
28912
|
+
const [error, setError] = useState28(null);
|
|
29578
28913
|
const columns = Math.min(80, process.stdout.columns ?? 80);
|
|
29579
|
-
|
|
28914
|
+
useInput28((_input, key) => {
|
|
29580
28915
|
if (key.escape) ctx.goBack();
|
|
29581
28916
|
});
|
|
29582
28917
|
const onSubmit = (next) => {
|
|
@@ -29589,13 +28924,13 @@ function StepDescription({ ctx }) {
|
|
|
29589
28924
|
ctx.updateWizardData({ whenToUse: trimmed });
|
|
29590
28925
|
ctx.goNext();
|
|
29591
28926
|
};
|
|
29592
|
-
return /* @__PURE__ */
|
|
28927
|
+
return /* @__PURE__ */ React101.createElement(
|
|
29593
28928
|
WizardPanel,
|
|
29594
28929
|
{
|
|
29595
28930
|
subtitle: "Description (tell Claude when to use this agent)",
|
|
29596
28931
|
footerText: "Press Enter to continue \xB7 Esc to go back"
|
|
29597
28932
|
},
|
|
29598
|
-
/* @__PURE__ */
|
|
28933
|
+
/* @__PURE__ */ React101.createElement(Box74, { flexDirection: "column", marginTop: 1, gap: 1 }, /* @__PURE__ */ React101.createElement(Text78, null, "When should Claude use this agent?"), /* @__PURE__ */ React101.createElement(
|
|
29599
28934
|
TextInput,
|
|
29600
28935
|
{
|
|
29601
28936
|
value,
|
|
@@ -29606,11 +28941,11 @@ function StepDescription({ ctx }) {
|
|
|
29606
28941
|
cursorOffset,
|
|
29607
28942
|
onChangeCursorOffset: setCursorOffset
|
|
29608
28943
|
}
|
|
29609
|
-
), error ? /* @__PURE__ */
|
|
28944
|
+
), error ? /* @__PURE__ */ React101.createElement(Text78, { color: themeColor("error") }, error) : null)
|
|
29610
28945
|
);
|
|
29611
28946
|
}
|
|
29612
28947
|
function ToolPicker(props) {
|
|
29613
|
-
const normalizedTools =
|
|
28948
|
+
const normalizedTools = useMemo26(() => {
|
|
29614
28949
|
const unique = /* @__PURE__ */ new Map();
|
|
29615
28950
|
for (const tool of props.tools) {
|
|
29616
28951
|
if (!tool?.name) continue;
|
|
@@ -29618,20 +28953,20 @@ function ToolPicker(props) {
|
|
|
29618
28953
|
}
|
|
29619
28954
|
return Array.from(unique.values()).sort((a, b) => a.name.localeCompare(b.name));
|
|
29620
28955
|
}, [props.tools]);
|
|
29621
|
-
const allToolNames =
|
|
28956
|
+
const allToolNames = useMemo26(
|
|
29622
28957
|
() => normalizedTools.map((t) => t.name),
|
|
29623
28958
|
[normalizedTools]
|
|
29624
28959
|
);
|
|
29625
|
-
const initialSelectedNames =
|
|
28960
|
+
const initialSelectedNames = useMemo26(() => {
|
|
29626
28961
|
if (!props.initialTools) return allToolNames;
|
|
29627
28962
|
if (props.initialTools.includes("*")) return allToolNames;
|
|
29628
28963
|
const available = new Set(allToolNames);
|
|
29629
28964
|
return props.initialTools.filter((t) => available.has(t));
|
|
29630
28965
|
}, [props.initialTools, allToolNames]);
|
|
29631
|
-
const [selected, setSelected] =
|
|
29632
|
-
const [cursorIndex, setCursorIndex] =
|
|
29633
|
-
const [showAdvanced, setShowAdvanced] =
|
|
29634
|
-
const selectedSet =
|
|
28966
|
+
const [selected, setSelected] = useState28(initialSelectedNames);
|
|
28967
|
+
const [cursorIndex, setCursorIndex] = useState28(0);
|
|
28968
|
+
const [showAdvanced, setShowAdvanced] = useState28(false);
|
|
28969
|
+
const selectedSet = useMemo26(() => new Set(selected), [selected]);
|
|
29635
28970
|
const isAllSelected = selected.length === allToolNames.length && allToolNames.length > 0;
|
|
29636
28971
|
const toggleOne = (name3) => {
|
|
29637
28972
|
setSelected(
|
|
@@ -29651,7 +28986,7 @@ function ToolPicker(props) {
|
|
|
29651
28986
|
const next = selected.length === allToolNames.length && allToolNames.every((n) => selected.includes(n)) ? void 0 : selected;
|
|
29652
28987
|
props.onComplete(next);
|
|
29653
28988
|
};
|
|
29654
|
-
const categorized =
|
|
28989
|
+
const categorized = useMemo26(() => {
|
|
29655
28990
|
const readOnly = /* @__PURE__ */ new Set(["Read", "Glob", "Grep", "LS"]);
|
|
29656
28991
|
const edit = /* @__PURE__ */ new Set(["Edit", "MultiEdit", "Write", "NotebookEdit"]);
|
|
29657
28992
|
const execution = /* @__PURE__ */ new Set(["Bash", "BashOutput", "KillBash"]);
|
|
@@ -29666,7 +29001,7 @@ function ToolPicker(props) {
|
|
|
29666
29001
|
}
|
|
29667
29002
|
return buckets;
|
|
29668
29003
|
}, [normalizedTools]);
|
|
29669
|
-
const mcpServers =
|
|
29004
|
+
const mcpServers = useMemo26(() => {
|
|
29670
29005
|
const byServer = /* @__PURE__ */ new Map();
|
|
29671
29006
|
for (const name3 of categorized.mcp) {
|
|
29672
29007
|
const parsed = parseMcpToolName(name3);
|
|
@@ -29677,7 +29012,7 @@ function ToolPicker(props) {
|
|
|
29677
29012
|
}
|
|
29678
29013
|
return Array.from(byServer.entries()).map(([serverName, toolNames]) => ({ serverName, toolNames })).sort((a, b) => a.serverName.localeCompare(b.serverName));
|
|
29679
29014
|
}, [categorized.mcp]);
|
|
29680
|
-
const items =
|
|
29015
|
+
const items = useMemo26(() => {
|
|
29681
29016
|
const out = [];
|
|
29682
29017
|
out.push({ id: "continue", label: "[ Continue ]", action: complete });
|
|
29683
29018
|
out.push({
|
|
@@ -29742,7 +29077,7 @@ function ToolPicker(props) {
|
|
|
29742
29077
|
selectedSet,
|
|
29743
29078
|
showAdvanced
|
|
29744
29079
|
]);
|
|
29745
|
-
|
|
29080
|
+
useInput28((_input, key) => {
|
|
29746
29081
|
if (key.escape) {
|
|
29747
29082
|
props.onCancel();
|
|
29748
29083
|
return;
|
|
@@ -29765,12 +29100,12 @@ function ToolPicker(props) {
|
|
|
29765
29100
|
return;
|
|
29766
29101
|
}
|
|
29767
29102
|
});
|
|
29768
|
-
return /* @__PURE__ */
|
|
29103
|
+
return /* @__PURE__ */ React101.createElement(Box74, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React101.createElement(Text78, { color: cursorIndex === 0 ? themeColor("suggestion") : void 0, bold: cursorIndex === 0 }, cursorIndex === 0 ? `${figures9.pointer} ` : " ", "[ Continue ]"), /* @__PURE__ */ React101.createElement(Text78, { dimColor: true }, "\u2500".repeat(40)), items.slice(1).map((item, idx) => {
|
|
29769
29104
|
const index = idx + 1;
|
|
29770
29105
|
const focused = index === cursorIndex;
|
|
29771
29106
|
const prefix = item.isHeader ? "" : focused ? `${figures9.pointer} ` : " ";
|
|
29772
|
-
return /* @__PURE__ */
|
|
29773
|
-
|
|
29107
|
+
return /* @__PURE__ */ React101.createElement(React101.Fragment, { key: item.id }, item.isToggle ? /* @__PURE__ */ React101.createElement(Text78, { dimColor: true }, "\u2500".repeat(40)) : null, /* @__PURE__ */ React101.createElement(
|
|
29108
|
+
Text78,
|
|
29774
29109
|
{
|
|
29775
29110
|
dimColor: item.isHeader,
|
|
29776
29111
|
color: !item.isHeader && focused ? themeColor("suggestion") : void 0,
|
|
@@ -29778,12 +29113,12 @@ function ToolPicker(props) {
|
|
|
29778
29113
|
},
|
|
29779
29114
|
item.isToggle ? `${prefix}[ ${item.label} ]` : `${prefix}${item.label}`
|
|
29780
29115
|
));
|
|
29781
|
-
}), /* @__PURE__ */
|
|
29116
|
+
}), /* @__PURE__ */ React101.createElement(Box74, { marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React101.createElement(Text78, { dimColor: true }, isAllSelected ? "All tools selected" : `${selectedSet.size} of ${allToolNames.length} tools selected`)));
|
|
29782
29117
|
}
|
|
29783
29118
|
function StepSelectTools(props) {
|
|
29784
29119
|
const { ctx } = props;
|
|
29785
29120
|
const initialTools = ctx.wizardData.selectedTools;
|
|
29786
|
-
return /* @__PURE__ */
|
|
29121
|
+
return /* @__PURE__ */ React101.createElement(React101.Fragment, null, /* @__PURE__ */ React101.createElement(Panel, { title: "Create new agent", subtitle: "Select tools" }, /* @__PURE__ */ React101.createElement(
|
|
29787
29122
|
ToolPicker,
|
|
29788
29123
|
{
|
|
29789
29124
|
tools: props.tools,
|
|
@@ -29794,15 +29129,15 @@ function StepSelectTools(props) {
|
|
|
29794
29129
|
},
|
|
29795
29130
|
onCancel: ctx.goBack
|
|
29796
29131
|
}
|
|
29797
|
-
)), /* @__PURE__ */
|
|
29132
|
+
)), /* @__PURE__ */ React101.createElement(Instructions, { instructions: "Press Enter to toggle selection \xB7 \u2191\u2193 Navigate \xB7 Esc to go back" }));
|
|
29798
29133
|
}
|
|
29799
29134
|
function StepSelectModel({ ctx }) {
|
|
29800
|
-
|
|
29135
|
+
useInput28((_input, key) => {
|
|
29801
29136
|
if (key.escape) ctx.goBack();
|
|
29802
29137
|
});
|
|
29803
29138
|
const options = modelOptions();
|
|
29804
29139
|
const defaultValue = ctx.wizardData.selectedModel ?? DEFAULT_AGENT_MODEL;
|
|
29805
|
-
return /* @__PURE__ */
|
|
29140
|
+
return /* @__PURE__ */ React101.createElement(WizardPanel, { subtitle: "Select model", footerText: "Press \u2191\u2193 to navigate \xB7 Enter to select \xB7 Esc to go back" }, /* @__PURE__ */ React101.createElement(Box74, { flexDirection: "column", marginTop: 1, gap: 1 }, /* @__PURE__ */ React101.createElement(Text78, { dimColor: true }, "Model determines the agent's reasoning capabilities and speed."), /* @__PURE__ */ React101.createElement(
|
|
29806
29141
|
Select,
|
|
29807
29142
|
{
|
|
29808
29143
|
options,
|
|
@@ -29815,20 +29150,20 @@ function StepSelectModel({ ctx }) {
|
|
|
29815
29150
|
)));
|
|
29816
29151
|
}
|
|
29817
29152
|
function ColorPicker(props) {
|
|
29818
|
-
const [index, setIndex] =
|
|
29153
|
+
const [index, setIndex] = useState28(
|
|
29819
29154
|
Math.max(0, COLOR_OPTIONS.findIndex((c) => c === props.currentColor))
|
|
29820
29155
|
);
|
|
29821
|
-
|
|
29156
|
+
useInput28((_input, key) => {
|
|
29822
29157
|
if (key.upArrow) setIndex((i) => i > 0 ? i - 1 : COLOR_OPTIONS.length - 1);
|
|
29823
29158
|
else if (key.downArrow) setIndex((i) => i < COLOR_OPTIONS.length - 1 ? i + 1 : 0);
|
|
29824
29159
|
else if (key.return) props.onConfirm(COLOR_OPTIONS[index] ?? "automatic");
|
|
29825
29160
|
});
|
|
29826
|
-
return /* @__PURE__ */
|
|
29161
|
+
return /* @__PURE__ */ React101.createElement(Box74, { flexDirection: "column", gap: 1 }, COLOR_OPTIONS.map((color, i) => {
|
|
29827
29162
|
const focused = i === index;
|
|
29828
29163
|
const prefix = focused ? figures9.pointer : " ";
|
|
29829
29164
|
const label = color === "automatic" ? "Automatic color" : color.charAt(0).toUpperCase() + color.slice(1);
|
|
29830
|
-
return /* @__PURE__ */
|
|
29831
|
-
|
|
29165
|
+
return /* @__PURE__ */ React101.createElement(React101.Fragment, { key: color }, /* @__PURE__ */ React101.createElement(
|
|
29166
|
+
Text78,
|
|
29832
29167
|
{
|
|
29833
29168
|
color: focused ? themeColor("suggestion") : void 0,
|
|
29834
29169
|
bold: focused
|
|
@@ -29840,7 +29175,7 @@ function ColorPicker(props) {
|
|
|
29840
29175
|
}));
|
|
29841
29176
|
}
|
|
29842
29177
|
function StepChooseColor({ ctx }) {
|
|
29843
|
-
|
|
29178
|
+
useInput28((_input, key) => {
|
|
29844
29179
|
if (key.escape) ctx.goBack();
|
|
29845
29180
|
});
|
|
29846
29181
|
const agentType = ctx.wizardData.agentType ?? "agent";
|
|
@@ -29861,7 +29196,7 @@ function StepChooseColor({ ctx }) {
|
|
|
29861
29196
|
});
|
|
29862
29197
|
ctx.goNext();
|
|
29863
29198
|
};
|
|
29864
|
-
return /* @__PURE__ */
|
|
29199
|
+
return /* @__PURE__ */ React101.createElement(WizardPanel, { subtitle: "Choose background color", footerText: "Press \u2191\u2193 to navigate \xB7 Enter to select \xB7 Esc to go back" }, /* @__PURE__ */ React101.createElement(Box74, { marginTop: 1 }, /* @__PURE__ */ React101.createElement(ColorPicker, { agentName: agentType, currentColor: "automatic", onConfirm })));
|
|
29865
29200
|
}
|
|
29866
29201
|
function validateFinalAgent(args) {
|
|
29867
29202
|
const errors = [];
|
|
@@ -29888,8 +29223,8 @@ function validateFinalAgent(args) {
|
|
|
29888
29223
|
function StepConfirm(props) {
|
|
29889
29224
|
const { ctx } = props;
|
|
29890
29225
|
const finalAgent = ctx.wizardData.finalAgent;
|
|
29891
|
-
const [error, setError] =
|
|
29892
|
-
|
|
29226
|
+
const [error, setError] = useState28(null);
|
|
29227
|
+
useInput28((input, key) => {
|
|
29893
29228
|
if (key.escape) ctx.goBack();
|
|
29894
29229
|
else if (input === "e") void doSave(true);
|
|
29895
29230
|
else if (input === "s" || key.return) void doSave(false);
|
|
@@ -29926,28 +29261,28 @@ function StepConfirm(props) {
|
|
|
29926
29261
|
});
|
|
29927
29262
|
const locationPath = finalAgent.source === "projectSettings" ? getPrimaryAgentFilePath("project", finalAgent.agentType) : getPrimaryAgentFilePath("user", finalAgent.agentType);
|
|
29928
29263
|
const truncate = (text) => text.length > 240 ? `${text.slice(0, 240)}\u2026` : text;
|
|
29929
|
-
return /* @__PURE__ */
|
|
29264
|
+
return /* @__PURE__ */ React101.createElement(
|
|
29930
29265
|
WizardPanel,
|
|
29931
29266
|
{
|
|
29932
29267
|
subtitle: "Confirm and save",
|
|
29933
29268
|
footerText: "Press s/Enter to save \xB7 e to edit in your editor \xB7 Esc to cancel"
|
|
29934
29269
|
},
|
|
29935
|
-
/* @__PURE__ */
|
|
29270
|
+
/* @__PURE__ */ React101.createElement(Box74, { flexDirection: "column", marginTop: 1, gap: 1 }, /* @__PURE__ */ React101.createElement(Text78, null, /* @__PURE__ */ React101.createElement(Text78, { bold: true }, "Name"), ": ", finalAgent.agentType), /* @__PURE__ */ React101.createElement(Text78, null, /* @__PURE__ */ React101.createElement(Text78, { bold: true }, "Location"), ": ", locationPath), /* @__PURE__ */ React101.createElement(Text78, null, /* @__PURE__ */ React101.createElement(Text78, { bold: true }, "Tools"), ": ", toolSummary(finalAgent.tools)), /* @__PURE__ */ React101.createElement(Text78, null, /* @__PURE__ */ React101.createElement(Text78, { bold: true }, "Model"), ": ", formatModelLong(finalAgent.model)), /* @__PURE__ */ React101.createElement(Box74, { marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React101.createElement(Text78, null, /* @__PURE__ */ React101.createElement(Text78, { bold: true }, "Description"), " (tells Claude when to use this agent):"), /* @__PURE__ */ React101.createElement(Box74, { marginLeft: 2, marginTop: 1 }, /* @__PURE__ */ React101.createElement(Text78, null, truncate(finalAgent.whenToUse)))), /* @__PURE__ */ React101.createElement(Box74, { marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React101.createElement(Text78, null, /* @__PURE__ */ React101.createElement(Text78, { bold: true }, "System prompt"), ":"), /* @__PURE__ */ React101.createElement(Box74, { marginLeft: 2, marginTop: 1 }, /* @__PURE__ */ React101.createElement(Text78, null, truncate(finalAgent.systemPrompt)))), validation.warnings.length > 0 ? /* @__PURE__ */ React101.createElement(Box74, { marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React101.createElement(Text78, { color: themeColor("warning") }, "Warnings:"), validation.warnings.map((w, i) => /* @__PURE__ */ React101.createElement(React101.Fragment, { key: i }, /* @__PURE__ */ React101.createElement(Text78, { dimColor: true }, " ", "\u2022 ", w)))) : null, validation.errors.length > 0 ? /* @__PURE__ */ React101.createElement(Box74, { marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React101.createElement(Text78, { color: themeColor("error") }, "Errors:"), validation.errors.map((e, i) => /* @__PURE__ */ React101.createElement(React101.Fragment, { key: i }, /* @__PURE__ */ React101.createElement(Text78, { color: themeColor("error") }, " ", "\u2022 ", e)))) : null, error ? /* @__PURE__ */ React101.createElement(Box74, { marginTop: 1 }, /* @__PURE__ */ React101.createElement(Text78, { color: themeColor("error") }, error)) : null)
|
|
29936
29271
|
);
|
|
29937
29272
|
}
|
|
29938
29273
|
function CreateAgentWizard(props) {
|
|
29939
|
-
const steps =
|
|
29274
|
+
const steps = useMemo26(() => {
|
|
29940
29275
|
return [
|
|
29941
|
-
(ctx) => /* @__PURE__ */
|
|
29942
|
-
(ctx) => /* @__PURE__ */
|
|
29943
|
-
(ctx) => /* @__PURE__ */
|
|
29944
|
-
(ctx) => /* @__PURE__ */
|
|
29945
|
-
(ctx) => /* @__PURE__ */
|
|
29946
|
-
(ctx) => /* @__PURE__ */
|
|
29947
|
-
(ctx) => /* @__PURE__ */
|
|
29948
|
-
(ctx) => /* @__PURE__ */
|
|
29949
|
-
(ctx) => /* @__PURE__ */
|
|
29950
|
-
(ctx) => /* @__PURE__ */
|
|
29276
|
+
(ctx) => /* @__PURE__ */ React101.createElement(StepChooseLocation, { ctx }),
|
|
29277
|
+
(ctx) => /* @__PURE__ */ React101.createElement(StepChooseMethod, { ctx }),
|
|
29278
|
+
(ctx) => /* @__PURE__ */ React101.createElement(StepGenerationPrompt, { ctx, existingAgents: props.existingAgents }),
|
|
29279
|
+
(ctx) => /* @__PURE__ */ React101.createElement(StepAgentType, { ctx, existingAgents: props.existingAgents }),
|
|
29280
|
+
(ctx) => /* @__PURE__ */ React101.createElement(StepSystemPrompt, { ctx }),
|
|
29281
|
+
(ctx) => /* @__PURE__ */ React101.createElement(StepDescription, { ctx }),
|
|
29282
|
+
(ctx) => /* @__PURE__ */ React101.createElement(StepSelectTools, { ctx, tools: props.tools }),
|
|
29283
|
+
(ctx) => /* @__PURE__ */ React101.createElement(StepSelectModel, { ctx }),
|
|
29284
|
+
(ctx) => /* @__PURE__ */ React101.createElement(StepChooseColor, { ctx }),
|
|
29285
|
+
(ctx) => /* @__PURE__ */ React101.createElement(
|
|
29951
29286
|
StepConfirm,
|
|
29952
29287
|
{
|
|
29953
29288
|
ctx,
|
|
@@ -29980,7 +29315,7 @@ function CreateAgentWizard(props) {
|
|
|
29980
29315
|
)
|
|
29981
29316
|
];
|
|
29982
29317
|
}, [props]);
|
|
29983
|
-
return /* @__PURE__ */
|
|
29318
|
+
return /* @__PURE__ */ React101.createElement(
|
|
29984
29319
|
Wizard,
|
|
29985
29320
|
{
|
|
29986
29321
|
steps,
|
|
@@ -29991,7 +29326,7 @@ function CreateAgentWizard(props) {
|
|
|
29991
29326
|
);
|
|
29992
29327
|
}
|
|
29993
29328
|
function AgentMenu(props) {
|
|
29994
|
-
|
|
29329
|
+
useInput28((_input, key) => {
|
|
29995
29330
|
if (key.escape) props.onCancel();
|
|
29996
29331
|
});
|
|
29997
29332
|
const isBuiltIn = props.agent.source === "built-in";
|
|
@@ -30003,16 +29338,16 @@ function AgentMenu(props) {
|
|
|
30003
29338
|
],
|
|
30004
29339
|
{ label: "Back", value: "back" }
|
|
30005
29340
|
];
|
|
30006
|
-
return /* @__PURE__ */
|
|
29341
|
+
return /* @__PURE__ */ React101.createElement(React101.Fragment, null, /* @__PURE__ */ React101.createElement(Panel, { title: props.agent.agentType }, /* @__PURE__ */ React101.createElement(Box74, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React101.createElement(
|
|
30007
29342
|
Select,
|
|
30008
29343
|
{
|
|
30009
29344
|
options,
|
|
30010
29345
|
onChange: (value) => props.onChoose(value)
|
|
30011
29346
|
}
|
|
30012
|
-
))), /* @__PURE__ */
|
|
29347
|
+
))), /* @__PURE__ */ React101.createElement(Instructions, null));
|
|
30013
29348
|
}
|
|
30014
29349
|
function ViewAgent(props) {
|
|
30015
|
-
|
|
29350
|
+
useInput28((_input, key) => {
|
|
30016
29351
|
if (key.escape || key.return) props.onBack();
|
|
30017
29352
|
});
|
|
30018
29353
|
const toolNames = new Set(props.tools.map((t) => t.name));
|
|
@@ -30045,15 +29380,15 @@ function ViewAgent(props) {
|
|
|
30045
29380
|
const toolsSummary = () => {
|
|
30046
29381
|
if (parsedTools.hasWildcard) return "All tools";
|
|
30047
29382
|
if (!props.agent.tools || props.agent.tools === "*" || props.agent.tools.length === 0) return "None";
|
|
30048
|
-
return /* @__PURE__ */
|
|
29383
|
+
return /* @__PURE__ */ React101.createElement(React101.Fragment, null, parsedTools.valid.length > 0 ? parsedTools.valid.join(", ") : null, parsedTools.invalid.length > 0 ? /* @__PURE__ */ React101.createElement(React101.Fragment, null, /* @__PURE__ */ React101.createElement(Text78, { color: themeColor("warning") }, " ", figures9.warning, " Unrecognized: ", parsedTools.invalid.join(", "))) : null);
|
|
30049
29384
|
};
|
|
30050
|
-
return /* @__PURE__ */
|
|
29385
|
+
return /* @__PURE__ */ React101.createElement(React101.Fragment, null, /* @__PURE__ */ React101.createElement(Panel, { title: props.agent.agentType }, /* @__PURE__ */ React101.createElement(Box74, { flexDirection: "column", gap: 1 }, /* @__PURE__ */ React101.createElement(Text78, { dimColor: true }, sourceLine), /* @__PURE__ */ React101.createElement(Box74, { flexDirection: "column" }, /* @__PURE__ */ React101.createElement(Text78, null, /* @__PURE__ */ React101.createElement(Text78, { bold: true }, "Description"), " (tells Claude when to use this agent):"), /* @__PURE__ */ React101.createElement(Box74, { marginLeft: 2 }, /* @__PURE__ */ React101.createElement(Text78, null, props.agent.whenToUse))), /* @__PURE__ */ React101.createElement(Text78, null, /* @__PURE__ */ React101.createElement(Text78, { bold: true }, "Tools"), ": ", toolsSummary()), /* @__PURE__ */ React101.createElement(Text78, null, /* @__PURE__ */ React101.createElement(Text78, { bold: true }, "Model"), ": ", formatModelLong(props.agent.model)), props.agent.color ? /* @__PURE__ */ React101.createElement(Text78, null, /* @__PURE__ */ React101.createElement(Text78, { bold: true }, "Color"), ": ", props.agent.color) : null, props.agent.systemPrompt ? /* @__PURE__ */ React101.createElement(React101.Fragment, null, /* @__PURE__ */ React101.createElement(Text78, null, /* @__PURE__ */ React101.createElement(Text78, { bold: true }, "System prompt"), ":"), /* @__PURE__ */ React101.createElement(Box74, { marginLeft: 2, marginRight: 2 }, /* @__PURE__ */ React101.createElement(Text78, null, props.agent.systemPrompt))) : null)), /* @__PURE__ */ React101.createElement(Instructions, { instructions: "Press Enter or Esc to go back" }));
|
|
30051
29386
|
}
|
|
30052
29387
|
function EditAgent(props) {
|
|
30053
|
-
const [mode, setMode] =
|
|
30054
|
-
const [selectedIndex, setSelectedIndex] =
|
|
30055
|
-
const [error, setError] =
|
|
30056
|
-
const menuItems =
|
|
29388
|
+
const [mode, setMode] = useState28("menu");
|
|
29389
|
+
const [selectedIndex, setSelectedIndex] = useState28(0);
|
|
29390
|
+
const [error, setError] = useState28(null);
|
|
29391
|
+
const menuItems = useMemo26(
|
|
30057
29392
|
() => [
|
|
30058
29393
|
{ label: "Open in editor", action: "open" },
|
|
30059
29394
|
{ label: "Edit tools", action: "edit-tools" },
|
|
@@ -30090,7 +29425,7 @@ function EditAgent(props) {
|
|
|
30090
29425
|
setError(err instanceof Error ? err.message : String(err));
|
|
30091
29426
|
}
|
|
30092
29427
|
};
|
|
30093
|
-
|
|
29428
|
+
useInput28((_input, key) => {
|
|
30094
29429
|
if (mode === "edit-model") {
|
|
30095
29430
|
if (key.escape) setMode("menu");
|
|
30096
29431
|
return;
|
|
@@ -30112,7 +29447,7 @@ function EditAgent(props) {
|
|
|
30112
29447
|
}
|
|
30113
29448
|
});
|
|
30114
29449
|
if (mode === "edit-tools") {
|
|
30115
|
-
return /* @__PURE__ */
|
|
29450
|
+
return /* @__PURE__ */ React101.createElement(React101.Fragment, null, /* @__PURE__ */ React101.createElement(Panel, { title: `Edit agent: ${props.agent.agentType}` }, /* @__PURE__ */ React101.createElement(
|
|
30116
29451
|
ToolPicker,
|
|
30117
29452
|
{
|
|
30118
29453
|
tools: props.tools,
|
|
@@ -30124,10 +29459,10 @@ function EditAgent(props) {
|
|
|
30124
29459
|
},
|
|
30125
29460
|
onCancel: () => setMode("menu")
|
|
30126
29461
|
}
|
|
30127
|
-
), error ? /* @__PURE__ */
|
|
29462
|
+
), error ? /* @__PURE__ */ React101.createElement(Box74, { marginTop: 1 }, /* @__PURE__ */ React101.createElement(Text78, { color: themeColor("error") }, error)) : null), /* @__PURE__ */ React101.createElement(Instructions, { instructions: "Press Enter to toggle selection \xB7 \u2191\u2193 Navigate \xB7 Esc to go back" }));
|
|
30128
29463
|
}
|
|
30129
29464
|
if (mode === "edit-model") {
|
|
30130
|
-
return /* @__PURE__ */
|
|
29465
|
+
return /* @__PURE__ */ React101.createElement(React101.Fragment, null, /* @__PURE__ */ React101.createElement(Panel, { title: `Edit agent: ${props.agent.agentType}` }, /* @__PURE__ */ React101.createElement(Box74, { flexDirection: "column", gap: 1, marginTop: 1 }, /* @__PURE__ */ React101.createElement(Text78, { dimColor: true }, "Model determines the agent's reasoning capabilities and speed."), /* @__PURE__ */ React101.createElement(
|
|
30131
29466
|
Select,
|
|
30132
29467
|
{
|
|
30133
29468
|
options: modelOptions(),
|
|
@@ -30137,10 +29472,10 @@ function EditAgent(props) {
|
|
|
30137
29472
|
setMode("menu");
|
|
30138
29473
|
}
|
|
30139
29474
|
}
|
|
30140
|
-
)), error ? /* @__PURE__ */
|
|
29475
|
+
)), error ? /* @__PURE__ */ React101.createElement(Box74, { marginTop: 1 }, /* @__PURE__ */ React101.createElement(Text78, { color: themeColor("error") }, error)) : null), /* @__PURE__ */ React101.createElement(Instructions, null));
|
|
30141
29476
|
}
|
|
30142
29477
|
if (mode === "edit-color") {
|
|
30143
|
-
return /* @__PURE__ */
|
|
29478
|
+
return /* @__PURE__ */ React101.createElement(React101.Fragment, null, /* @__PURE__ */ React101.createElement(Panel, { title: `Edit agent: ${props.agent.agentType}` }, /* @__PURE__ */ React101.createElement(Box74, { marginTop: 1 }, /* @__PURE__ */ React101.createElement(
|
|
30144
29479
|
ColorPicker,
|
|
30145
29480
|
{
|
|
30146
29481
|
agentName: props.agent.agentType,
|
|
@@ -30150,29 +29485,29 @@ function EditAgent(props) {
|
|
|
30150
29485
|
setMode("menu");
|
|
30151
29486
|
}
|
|
30152
29487
|
}
|
|
30153
|
-
)), error ? /* @__PURE__ */
|
|
29488
|
+
)), error ? /* @__PURE__ */ React101.createElement(Box74, { marginTop: 1 }, /* @__PURE__ */ React101.createElement(Text78, { color: themeColor("error") }, error)) : null), /* @__PURE__ */ React101.createElement(Instructions, null));
|
|
30154
29489
|
}
|
|
30155
|
-
return /* @__PURE__ */
|
|
30156
|
-
|
|
29490
|
+
return /* @__PURE__ */ React101.createElement(React101.Fragment, null, /* @__PURE__ */ React101.createElement(Panel, { title: `Edit agent: ${props.agent.agentType}` }, /* @__PURE__ */ React101.createElement(Box74, { flexDirection: "column" }, /* @__PURE__ */ React101.createElement(Text78, { dimColor: true }, "Source: ", titleForSource(props.agent.source)), /* @__PURE__ */ React101.createElement(Box74, { marginTop: 1, flexDirection: "column" }, menuItems.map((item, idx) => /* @__PURE__ */ React101.createElement(React101.Fragment, { key: item.label }, /* @__PURE__ */ React101.createElement(
|
|
29491
|
+
Text78,
|
|
30157
29492
|
{
|
|
30158
29493
|
color: idx === selectedIndex ? themeColor("suggestion") : void 0
|
|
30159
29494
|
},
|
|
30160
29495
|
idx === selectedIndex ? `${figures9.pointer} ` : " ",
|
|
30161
29496
|
item.label
|
|
30162
|
-
)))), error ? /* @__PURE__ */
|
|
29497
|
+
)))), error ? /* @__PURE__ */ React101.createElement(Box74, { marginTop: 1 }, /* @__PURE__ */ React101.createElement(Text78, { color: themeColor("error") }, error)) : null)), /* @__PURE__ */ React101.createElement(Instructions, null));
|
|
30163
29498
|
}
|
|
30164
29499
|
function DeleteConfirm(props) {
|
|
30165
|
-
|
|
29500
|
+
useInput28((_input, key) => {
|
|
30166
29501
|
if (key.escape) props.onCancel();
|
|
30167
29502
|
});
|
|
30168
|
-
return /* @__PURE__ */
|
|
29503
|
+
return /* @__PURE__ */ React101.createElement(React101.Fragment, null, /* @__PURE__ */ React101.createElement(
|
|
30169
29504
|
Panel,
|
|
30170
29505
|
{
|
|
30171
29506
|
title: "Delete agent",
|
|
30172
29507
|
borderColor: panelBorderColor("error"),
|
|
30173
29508
|
titleColor: themeColor("error")
|
|
30174
29509
|
},
|
|
30175
|
-
/* @__PURE__ */
|
|
29510
|
+
/* @__PURE__ */ React101.createElement(Box74, { flexDirection: "column", gap: 1 }, /* @__PURE__ */ React101.createElement(Text78, null, "Are you sure you want to delete the agent ", /* @__PURE__ */ React101.createElement(Text78, { bold: true }, props.agent.agentType), "?"), /* @__PURE__ */ React101.createElement(Box74, { marginTop: 1 }, /* @__PURE__ */ React101.createElement(Text78, { dimColor: true }, "Source: ", props.agent.source)), /* @__PURE__ */ React101.createElement(Box74, { marginTop: 1 }, /* @__PURE__ */ React101.createElement(
|
|
30176
29511
|
Select,
|
|
30177
29512
|
{
|
|
30178
29513
|
options: [
|
|
@@ -30185,22 +29520,22 @@ function DeleteConfirm(props) {
|
|
|
30185
29520
|
}
|
|
30186
29521
|
}
|
|
30187
29522
|
)))
|
|
30188
|
-
), /* @__PURE__ */
|
|
29523
|
+
), /* @__PURE__ */ React101.createElement(Instructions, { instructions: "Press \u2191\u2193 to navigate, Enter to select, Esc to cancel" }));
|
|
30189
29524
|
}
|
|
30190
29525
|
function AgentsUI({ onExit }) {
|
|
30191
|
-
const [mode, setMode] =
|
|
30192
|
-
const [loading, setLoading] =
|
|
30193
|
-
const [allAgents, setAllAgents] =
|
|
30194
|
-
const [activeAgents, setActiveAgents] =
|
|
30195
|
-
const [tools, setTools] =
|
|
30196
|
-
const [changes, setChanges] =
|
|
29526
|
+
const [mode, setMode] = useState28({ mode: "list-agents", source: "all" });
|
|
29527
|
+
const [loading, setLoading] = useState28(true);
|
|
29528
|
+
const [allAgents, setAllAgents] = useState28([]);
|
|
29529
|
+
const [activeAgents, setActiveAgents] = useState28([]);
|
|
29530
|
+
const [tools, setTools] = useState28([]);
|
|
29531
|
+
const [changes, setChanges] = useState28([]);
|
|
30197
29532
|
const refresh = useCallback17(async () => {
|
|
30198
29533
|
clearAgentCache();
|
|
30199
29534
|
const [all, active2] = await Promise.all([getAllAgents(), getActiveAgents()]);
|
|
30200
29535
|
setAllAgents(all);
|
|
30201
29536
|
setActiveAgents(active2);
|
|
30202
29537
|
}, []);
|
|
30203
|
-
|
|
29538
|
+
useEffect26(() => {
|
|
30204
29539
|
let mounted = true;
|
|
30205
29540
|
(async () => {
|
|
30206
29541
|
try {
|
|
@@ -30215,11 +29550,11 @@ function AgentsUI({ onExit }) {
|
|
|
30215
29550
|
mounted = false;
|
|
30216
29551
|
};
|
|
30217
29552
|
}, [refresh]);
|
|
30218
|
-
const agentsWithOverride =
|
|
29553
|
+
const agentsWithOverride = useMemo26(
|
|
30219
29554
|
() => computeOverrides({ allAgents, activeAgents }),
|
|
30220
29555
|
[allAgents, activeAgents]
|
|
30221
29556
|
);
|
|
30222
|
-
const listAgentsForSource =
|
|
29557
|
+
const listAgentsForSource = useMemo26(() => {
|
|
30223
29558
|
const bySource = {
|
|
30224
29559
|
"built-in": agentsWithOverride.filter((a) => a.source === "built-in"),
|
|
30225
29560
|
userSettings: agentsWithOverride.filter((a) => a.source === "userSettings"),
|
|
@@ -30256,10 +29591,10 @@ ${changes.join("\n")}`);
|
|
|
30256
29591
|
onExit("Agents dialog dismissed");
|
|
30257
29592
|
}, [changes, onExit]);
|
|
30258
29593
|
if (loading) {
|
|
30259
|
-
return /* @__PURE__ */
|
|
29594
|
+
return /* @__PURE__ */ React101.createElement(React101.Fragment, null, /* @__PURE__ */ React101.createElement(Panel, { title: "Agents", subtitle: "Loading\u2026" }, /* @__PURE__ */ React101.createElement(Text78, { dimColor: true }, "Loading agents\u2026")), /* @__PURE__ */ React101.createElement(Instructions, null));
|
|
30260
29595
|
}
|
|
30261
29596
|
if (mode.mode === "list-agents") {
|
|
30262
|
-
return /* @__PURE__ */
|
|
29597
|
+
return /* @__PURE__ */ React101.createElement(
|
|
30263
29598
|
AgentsListView,
|
|
30264
29599
|
{
|
|
30265
29600
|
source: mode.source,
|
|
@@ -30272,7 +29607,7 @@ ${changes.join("\n")}`);
|
|
|
30272
29607
|
);
|
|
30273
29608
|
}
|
|
30274
29609
|
if (mode.mode === "create-agent") {
|
|
30275
|
-
return /* @__PURE__ */
|
|
29610
|
+
return /* @__PURE__ */ React101.createElement(
|
|
30276
29611
|
CreateAgentWizard,
|
|
30277
29612
|
{
|
|
30278
29613
|
tools,
|
|
@@ -30287,7 +29622,7 @@ ${changes.join("\n")}`);
|
|
|
30287
29622
|
);
|
|
30288
29623
|
}
|
|
30289
29624
|
if (mode.mode === "agent-menu") {
|
|
30290
|
-
return /* @__PURE__ */
|
|
29625
|
+
return /* @__PURE__ */ React101.createElement(
|
|
30291
29626
|
AgentMenu,
|
|
30292
29627
|
{
|
|
30293
29628
|
agent: mode.agent,
|
|
@@ -30302,7 +29637,7 @@ ${changes.join("\n")}`);
|
|
|
30302
29637
|
);
|
|
30303
29638
|
}
|
|
30304
29639
|
if (mode.mode === "view-agent") {
|
|
30305
|
-
return /* @__PURE__ */
|
|
29640
|
+
return /* @__PURE__ */ React101.createElement(
|
|
30306
29641
|
ViewAgent,
|
|
30307
29642
|
{
|
|
30308
29643
|
agent: mode.agent,
|
|
@@ -30312,7 +29647,7 @@ ${changes.join("\n")}`);
|
|
|
30312
29647
|
);
|
|
30313
29648
|
}
|
|
30314
29649
|
if (mode.mode === "edit-agent") {
|
|
30315
|
-
return /* @__PURE__ */
|
|
29650
|
+
return /* @__PURE__ */ React101.createElement(
|
|
30316
29651
|
EditAgent,
|
|
30317
29652
|
{
|
|
30318
29653
|
agent: mode.agent,
|
|
@@ -30327,7 +29662,7 @@ ${changes.join("\n")}`);
|
|
|
30327
29662
|
);
|
|
30328
29663
|
}
|
|
30329
29664
|
if (mode.mode === "delete-confirm") {
|
|
30330
|
-
return /* @__PURE__ */
|
|
29665
|
+
return /* @__PURE__ */ React101.createElement(
|
|
30331
29666
|
DeleteConfirm,
|
|
30332
29667
|
{
|
|
30333
29668
|
agent: mode.agent,
|
|
@@ -30352,7 +29687,7 @@ var agents_default = {
|
|
|
30352
29687
|
isEnabled: true,
|
|
30353
29688
|
isHidden: false,
|
|
30354
29689
|
async call(onExit) {
|
|
30355
|
-
return /* @__PURE__ */
|
|
29690
|
+
return /* @__PURE__ */ React102.createElement(AgentsUI, { onExit });
|
|
30356
29691
|
},
|
|
30357
29692
|
userFacingName() {
|
|
30358
29693
|
return "agents";
|
|
@@ -30424,8 +29759,8 @@ function getCommand(commandName, commands) {
|
|
|
30424
29759
|
var TOOL_NAME_FOR_PROMPT7 = "SlashCommand";
|
|
30425
29760
|
|
|
30426
29761
|
// src/tools/interaction/SlashCommandTool/SlashCommandTool.tsx
|
|
30427
|
-
var
|
|
30428
|
-
command:
|
|
29762
|
+
var inputSchema12 = z11.strictObject({
|
|
29763
|
+
command: z11.string().describe(
|
|
30429
29764
|
'The slash command to execute with its arguments, e.g., "/review-pr 123"'
|
|
30430
29765
|
)
|
|
30431
29766
|
});
|
|
@@ -30450,7 +29785,7 @@ var SlashCommandTool = {
|
|
|
30450
29785
|
userFacingName() {
|
|
30451
29786
|
return "SlashCommand";
|
|
30452
29787
|
},
|
|
30453
|
-
inputSchema:
|
|
29788
|
+
inputSchema: inputSchema12,
|
|
30454
29789
|
isReadOnly() {
|
|
30455
29790
|
return false;
|
|
30456
29791
|
},
|
|
@@ -30513,7 +29848,7 @@ ${availableLines}${truncatedNotice}
|
|
|
30513
29848
|
return command4 || "";
|
|
30514
29849
|
},
|
|
30515
29850
|
renderToolUseRejectedMessage() {
|
|
30516
|
-
return /* @__PURE__ */
|
|
29851
|
+
return /* @__PURE__ */ React103.createElement(FallbackToolUseRejectedMessage, null);
|
|
30517
29852
|
},
|
|
30518
29853
|
renderResultForAssistant(output) {
|
|
30519
29854
|
return `Launching command: /${output.commandName}`;
|
|
@@ -30669,9 +30004,9 @@ function parseMcpToolName2(name3) {
|
|
|
30669
30004
|
}
|
|
30670
30005
|
|
|
30671
30006
|
// src/tools/system/KillShellTool/KillShellTool.tsx
|
|
30672
|
-
import { Box as
|
|
30673
|
-
import
|
|
30674
|
-
import { z as
|
|
30007
|
+
import { Box as Box75, Text as Text79 } from "ink";
|
|
30008
|
+
import React104 from "react";
|
|
30009
|
+
import { z as z12 } from "zod";
|
|
30675
30010
|
|
|
30676
30011
|
// src/tools/system/KillShellTool/prompt.ts
|
|
30677
30012
|
var TOOL_NAME_FOR_PROMPT8 = "KillShell";
|
|
@@ -30685,8 +30020,8 @@ var PROMPT7 = `
|
|
|
30685
30020
|
`;
|
|
30686
30021
|
|
|
30687
30022
|
// src/tools/system/KillShellTool/KillShellTool.tsx
|
|
30688
|
-
var
|
|
30689
|
-
shell_id:
|
|
30023
|
+
var inputSchema13 = z12.strictObject({
|
|
30024
|
+
shell_id: z12.string().describe("The ID of the background shell to kill")
|
|
30690
30025
|
});
|
|
30691
30026
|
var KillShellTool = {
|
|
30692
30027
|
name: TOOL_NAME_FOR_PROMPT8,
|
|
@@ -30696,7 +30031,7 @@ var KillShellTool = {
|
|
|
30696
30031
|
userFacingName() {
|
|
30697
30032
|
return "Kill Shell";
|
|
30698
30033
|
},
|
|
30699
|
-
inputSchema:
|
|
30034
|
+
inputSchema: inputSchema13,
|
|
30700
30035
|
isReadOnly() {
|
|
30701
30036
|
return false;
|
|
30702
30037
|
},
|
|
@@ -30716,10 +30051,10 @@ var KillShellTool = {
|
|
|
30716
30051
|
return `Kill shell: ${shell_id}`;
|
|
30717
30052
|
},
|
|
30718
30053
|
renderToolUseRejectedMessage() {
|
|
30719
|
-
return /* @__PURE__ */
|
|
30054
|
+
return /* @__PURE__ */ React104.createElement(FallbackToolUseRejectedMessage, null);
|
|
30720
30055
|
},
|
|
30721
30056
|
renderToolResultMessage(output) {
|
|
30722
|
-
return /* @__PURE__ */
|
|
30057
|
+
return /* @__PURE__ */ React104.createElement(Box75, { flexDirection: "row" }, /* @__PURE__ */ React104.createElement(Text79, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React104.createElement(Text79, null, "Shell ", output.shell_id, " killed"));
|
|
30723
30058
|
},
|
|
30724
30059
|
renderResultForAssistant(output) {
|
|
30725
30060
|
return JSON.stringify(output);
|
|
@@ -30761,7 +30096,6 @@ var KillShellTool = {
|
|
|
30761
30096
|
|
|
30762
30097
|
// src/core/permissions/rules/planMode.ts
|
|
30763
30098
|
var PLAN_MODE_ALLOWED_NON_READONLY_TOOLS = /* @__PURE__ */ new Set([
|
|
30764
|
-
ExitPlanModeTool.name,
|
|
30765
30099
|
KillShellTool.name
|
|
30766
30100
|
]);
|
|
30767
30101
|
|
|
@@ -31017,7 +30351,7 @@ var hasPermissionsToUseTool = async (tool, input, context, _assistantMessage) =>
|
|
|
31017
30351
|
const permissionResult = await (async () => {
|
|
31018
30352
|
switch (tool) {
|
|
31019
30353
|
case BashTool: {
|
|
31020
|
-
const { command: command4, dangerouslyDisableSandbox } =
|
|
30354
|
+
const { command: command4, dangerouslyDisableSandbox } = inputSchema11.parse(input);
|
|
31021
30355
|
const trimmed = command4.trim();
|
|
31022
30356
|
if (isSafeBashCommand(trimmed)) {
|
|
31023
30357
|
return { result: true };
|
|
@@ -31421,7 +30755,7 @@ function WebFetchPermissionRequest({
|
|
|
31421
30755
|
verbose
|
|
31422
30756
|
}) {
|
|
31423
30757
|
const theme = getTheme();
|
|
31424
|
-
const unaryEvent =
|
|
30758
|
+
const unaryEvent = useMemo27(
|
|
31425
30759
|
() => ({ completion_type: "tool_use_single", language_name: "none" }),
|
|
31426
30760
|
[]
|
|
31427
30761
|
);
|
|
@@ -31441,13 +30775,13 @@ function WebFetchPermissionRequest({
|
|
|
31441
30775
|
toolUseConfirm.onReject();
|
|
31442
30776
|
onDone();
|
|
31443
30777
|
};
|
|
31444
|
-
|
|
30778
|
+
useInput29((_input, key) => {
|
|
31445
30779
|
if (key.escape) {
|
|
31446
30780
|
reject();
|
|
31447
30781
|
}
|
|
31448
30782
|
});
|
|
31449
|
-
return /* @__PURE__ */
|
|
31450
|
-
|
|
30783
|
+
return /* @__PURE__ */ React105.createElement(
|
|
30784
|
+
Box76,
|
|
31451
30785
|
{
|
|
31452
30786
|
flexDirection: "column",
|
|
31453
30787
|
borderStyle: "round",
|
|
@@ -31457,14 +30791,14 @@ function WebFetchPermissionRequest({
|
|
|
31457
30791
|
paddingRight: 1,
|
|
31458
30792
|
paddingBottom: 1
|
|
31459
30793
|
},
|
|
31460
|
-
/* @__PURE__ */
|
|
30794
|
+
/* @__PURE__ */ React105.createElement(
|
|
31461
30795
|
PermissionRequestTitle,
|
|
31462
30796
|
{
|
|
31463
30797
|
title: "Network request outside of sandbox",
|
|
31464
30798
|
riskScore: null
|
|
31465
30799
|
}
|
|
31466
30800
|
),
|
|
31467
|
-
/* @__PURE__ */
|
|
30801
|
+
/* @__PURE__ */ React105.createElement(Box76, { flexDirection: "column", paddingX: 2, paddingY: 1 }, /* @__PURE__ */ React105.createElement(Box76, null, /* @__PURE__ */ React105.createElement(Text80, { dimColor: true }, "Host:"), /* @__PURE__ */ React105.createElement(Text80, null, " ", hostLabel)), /* @__PURE__ */ React105.createElement(Box76, { marginTop: 1 }, /* @__PURE__ */ React105.createElement(Text80, null, "Do you want to allow this connection?")), /* @__PURE__ */ React105.createElement(Box76, { marginTop: 1 }, /* @__PURE__ */ React105.createElement(
|
|
31468
30802
|
Select,
|
|
31469
30803
|
{
|
|
31470
30804
|
options: [
|
|
@@ -31669,13 +31003,13 @@ function countNewlines(text) {
|
|
|
31669
31003
|
}
|
|
31670
31004
|
return count;
|
|
31671
31005
|
}
|
|
31672
|
-
var
|
|
31673
|
-
command:
|
|
31674
|
-
cwd:
|
|
31006
|
+
var inputSchema11 = z13.strictObject({
|
|
31007
|
+
command: z13.string().describe("The command to execute"),
|
|
31008
|
+
cwd: z13.string().optional().describe(
|
|
31675
31009
|
"The directory to execute the command in. Use absolute path or path relative to the project root."
|
|
31676
31010
|
),
|
|
31677
|
-
timeout:
|
|
31678
|
-
description:
|
|
31011
|
+
timeout: z13.number().optional().describe("Optional timeout in milliseconds (max 600000)"),
|
|
31012
|
+
description: z13.string().optional().describe(
|
|
31679
31013
|
`Clear, concise description of what this command does in 5-10 words, in active voice. Examples:
|
|
31680
31014
|
Input: ls
|
|
31681
31015
|
Output: List files in current directory
|
|
@@ -31689,10 +31023,10 @@ Output: Install package dependencies
|
|
|
31689
31023
|
Input: mkdir foo
|
|
31690
31024
|
Output: Create directory 'foo'`
|
|
31691
31025
|
),
|
|
31692
|
-
run_in_background:
|
|
31026
|
+
run_in_background: z13.boolean().optional().describe(
|
|
31693
31027
|
"Set to true to run this command in the background. Use TaskOutput to read the output later."
|
|
31694
31028
|
),
|
|
31695
|
-
dangerouslyDisableSandbox:
|
|
31029
|
+
dangerouslyDisableSandbox: z13.boolean().optional().describe(
|
|
31696
31030
|
"Set this to true to dangerously override sandbox mode and run commands without sandboxing."
|
|
31697
31031
|
)
|
|
31698
31032
|
});
|
|
@@ -31712,7 +31046,7 @@ var BashTool = {
|
|
|
31712
31046
|
isConcurrencySafe(input) {
|
|
31713
31047
|
return this.isReadOnly(input);
|
|
31714
31048
|
},
|
|
31715
|
-
inputSchema:
|
|
31049
|
+
inputSchema: inputSchema11,
|
|
31716
31050
|
userFacingName(input) {
|
|
31717
31051
|
if (!input) return "Bash";
|
|
31718
31052
|
const raw = process.env.PYB_BASH_SANDBOX_SHOW_INDICATOR ?? process.env.KODE_BASH_SANDBOX_SHOW_INDICATOR ?? process.env.CLAUDE_CODE_BASH_SANDBOX_SHOW_INDICATOR;
|
|
@@ -31836,10 +31170,10 @@ var BashTool = {
|
|
|
31836
31170
|
return withDescription(base.trim());
|
|
31837
31171
|
},
|
|
31838
31172
|
renderToolUseRejectedMessage() {
|
|
31839
|
-
return /* @__PURE__ */
|
|
31173
|
+
return /* @__PURE__ */ React106.createElement(FallbackToolUseRejectedMessage, null);
|
|
31840
31174
|
},
|
|
31841
31175
|
renderToolResultMessage(content) {
|
|
31842
|
-
return /* @__PURE__ */
|
|
31176
|
+
return /* @__PURE__ */ React106.createElement(BashToolResultMessage_default, { content, verbose: false });
|
|
31843
31177
|
},
|
|
31844
31178
|
renderResultForAssistant({
|
|
31845
31179
|
interrupted,
|
|
@@ -32080,7 +31414,7 @@ Did you mean "git ${cmdParts.slice(1).join(" ")}"?`;
|
|
|
32080
31414
|
}
|
|
32081
31415
|
};
|
|
32082
31416
|
setToolJSX({
|
|
32083
|
-
jsx: /* @__PURE__ */
|
|
31417
|
+
jsx: /* @__PURE__ */ React106.createElement(
|
|
32084
31418
|
WebFetchPermissionRequest,
|
|
32085
31419
|
{
|
|
32086
31420
|
toolUseConfirm,
|
|
@@ -32276,7 +31610,7 @@ ${footerParts.join(" ")}`;
|
|
|
32276
31610
|
if (!overlayShown && setToolJSX && Date.now() - startedAt >= PROGRESS_INITIAL_DELAY_MS) {
|
|
32277
31611
|
overlayShown = true;
|
|
32278
31612
|
setToolJSX({
|
|
32279
|
-
jsx: /* @__PURE__ */
|
|
31613
|
+
jsx: /* @__PURE__ */ React106.createElement(
|
|
32280
31614
|
BashToolRunInBackgroundOverlay,
|
|
32281
31615
|
{
|
|
32282
31616
|
onBackground: requestBackground
|
|
@@ -32466,7 +31800,7 @@ NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTAN
|
|
|
32466
31800
|
` : ""}
|
|
32467
31801
|
|
|
32468
31802
|
# Tool usage policy
|
|
32469
|
-
- **Code Analysis & Exploration Priority**: When analyzing OR exploring code blocks, codebases (especially complex multi-repo projects) to understand functionality, mechanisms, logic, OR to locate features, modules, patterns, architecture,
|
|
31803
|
+
- **Code Analysis & Exploration Priority**: When analyzing OR exploring code blocks, codebases (especially complex multi-repo projects) to understand functionality, mechanisms, logic, OR to locate features, modules, patterns, architecture, prefer to use the Task tool with Explore subagent for thorough multi-step analysis. This reduces context consumption by delegating exploration to specialized agents. For broad analysis scope, launch multiple Explore agents in parallel with different focus areas to maximize efficiency.
|
|
32470
31804
|
- **File Search Priority**:When doing file search, prefer to use the Task tool for open-ended, multi-step exploration to reduce context usage. For known paths or small scopes, prefer Ls/Lsp/Read/Glob/Grep directly.
|
|
32471
31805
|
- **File System Exploration Priority**:For file system exploration, decide based on intent: if you need global structure/entry points, prefer LS first; if you have keywords or fuzzy paths, prefer Glob first. If results are too broad, use LS to narrow structure or combine with Grep/LSP. Only use Bash for executing scripts or binaries.
|
|
32472
31806
|
- You can call multiple tools in a single response. If you intend to call multiple tools and there are no dependencies between them, make all independent tool calls in parallel. Maximize use of parallel tool calls where possible to increase efficiency. However, if some tool calls depend on previous calls to inform dependent values, do NOT call these tools in parallel and instead call them sequentially. For instance, if one operation must complete before another starts, run these operations sequentially instead. Never use placeholders or guess missing parameters in tool calls.
|
|
@@ -32559,7 +31893,6 @@ export {
|
|
|
32559
31893
|
WebSearchTool,
|
|
32560
31894
|
SlashCommandTool,
|
|
32561
31895
|
SkillTool,
|
|
32562
|
-
ExitPlanModeTool,
|
|
32563
31896
|
KillShellTool,
|
|
32564
31897
|
hasPermissionsToUseTool,
|
|
32565
31898
|
BashTool,
|
|
@@ -32587,7 +31920,6 @@ export {
|
|
|
32587
31920
|
listTasks,
|
|
32588
31921
|
updateTask,
|
|
32589
31922
|
rebuildTaskBlocks,
|
|
32590
|
-
EnterPlanModeTool,
|
|
32591
31923
|
AskUserQuestionTool,
|
|
32592
31924
|
addToHistory,
|
|
32593
31925
|
countTokens,
|