pybao-cli 1.4.80 → 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-PA6S5MGT.js → acp-YXMNP56B.js} +29 -29
- package/dist/{agentsValidate-YM6XVDQL.js → agentsValidate-LQFWOCPZ.js} +7 -9
- package/dist/agentsValidate-LQFWOCPZ.js.map +7 -0
- package/dist/{ask-TKEZYYAI.js → ask-CUR6IJ2W.js} +28 -28
- package/dist/{autoUpdater-AKRMM25L.js → autoUpdater-DEH233RT.js} +3 -3
- package/dist/{chunk-7ZNKXJQ6.js → chunk-2NFKKANF.js} +2 -2
- package/dist/{chunk-FTXFHBBF.js → chunk-37ZXN5M4.js} +1 -1
- package/dist/{chunk-F5LYIQAC.js → chunk-4NNDWUSZ.js} +2 -2
- package/dist/{chunk-3CW5FEOJ.js → chunk-4SWM6FWR.js} +2 -2
- package/dist/{chunk-VHWL7AZC.js → chunk-4VUECEM6.js} +2 -2
- package/dist/{chunk-MIUJHRUY.js → chunk-5KAIY3II.js} +3 -3
- package/dist/{chunk-PXEQDOU3.js → chunk-6XINCIUI.js} +1 -1
- package/dist/{chunk-JD2LVXSN.js → chunk-7ANXEZRS.js} +3 -3
- package/dist/{chunk-3PA2KVRH.js → chunk-AB3F7T5N.js} +3 -3
- package/dist/{chunk-EZ5OXAWM.js → chunk-B3NR3UMC.js} +4 -4
- package/dist/{chunk-3SFRVXA2.js → chunk-BJMVIICS.js} +4 -4
- package/dist/{chunk-I37OY5QI.js → chunk-BX6HNPWQ.js} +3 -3
- package/dist/{chunk-QOJN4AXT.js → chunk-CCF52HVZ.js} +1 -1
- package/dist/{chunk-QOJN4AXT.js.map → chunk-CCF52HVZ.js.map} +1 -1
- package/dist/{chunk-CWZPDQJA.js → chunk-CLGB56HY.js} +4 -4
- package/dist/{chunk-CWZPDQJA.js.map → chunk-CLGB56HY.js.map} +2 -2
- package/dist/{chunk-744K4I7E.js → chunk-EYY3QDKX.js} +2 -2
- package/dist/{chunk-TG7JXSXM.js → chunk-FDGIVQNE.js} +1 -1
- package/dist/{chunk-455FF5IG.js → chunk-GMKASRN7.js} +1 -1
- package/dist/{chunk-JM762ZDE.js → chunk-GS4PRJHV.js} +4 -4
- package/dist/{chunk-AERD7AWQ.js → chunk-H44O47XJ.js} +1 -1
- package/dist/{chunk-2QU7ZSUS.js → chunk-HIZXCXUG.js} +4 -4
- package/dist/{chunk-BWTCQG4X.js → chunk-HNHWG52B.js} +1 -1
- package/dist/{chunk-CP3HV6YN.js → chunk-JVF6KNE3.js} +1 -1
- package/dist/{chunk-WTRPPL2M.js → chunk-KH3U5BR5.js} +3 -3
- package/dist/{chunk-KTATOOLL.js → chunk-MKNRYFQR.js} +2 -2
- package/dist/{chunk-OQA7RUJA.js → chunk-PRRYL2E2.js} +16 -22
- package/dist/chunk-PRRYL2E2.js.map +7 -0
- package/dist/{chunk-XNEBNYWQ.js → chunk-TVUG5GLX.js} +665 -1343
- package/dist/{chunk-XNEBNYWQ.js.map → chunk-TVUG5GLX.js.map} +4 -4
- package/dist/{chunk-LMS74RIF.js → chunk-UUS77RPP.js} +5 -25
- package/dist/chunk-UUS77RPP.js.map +7 -0
- package/dist/{chunk-3WG3WTUV.js → chunk-VW3NZKCP.js} +1 -1
- package/dist/{chunk-42HW6S7R.js → chunk-Z73SPR4B.js} +3 -3
- package/dist/{chunk-LLSY2GBI.js → chunk-ZE75JZFY.js} +3 -3
- package/dist/{cli-6XU5K75R.js → cli-VNT2RTPP.js} +87 -87
- package/dist/commands-LAZD5O4M.js +50 -0
- package/dist/{config-REKPGWPW.js → config-VK55G2IB.js} +4 -4
- package/dist/{context-7V2M3ID6.js → context-QHTEENJ6.js} +6 -6
- package/dist/{customCommands-WLOMXCCK.js → customCommands-HRHE7ZIM.js} +4 -4
- package/dist/{env-35CB7KWZ.js → env-GGYUE5V7.js} +2 -2
- package/dist/{file-TCC75FSO.js → file-KHYC624L.js} +4 -4
- package/dist/index.js +3 -3
- package/dist/{llm-C6QFJQ42.js → llm-A3S75CLF.js} +29 -29
- package/dist/{llmLazy-7GZ6NMOQ.js → llmLazy-USVVGSVL.js} +1 -1
- package/dist/{loader-X6LBDHGF.js → loader-JPKYTFFC.js} +4 -4
- package/dist/{lsp-SWPSA5Q7.js → lsp-B7QJVI2U.js} +6 -6
- package/dist/{lspAnchor-7DFVRBS2.js → lspAnchor-JJJ2WKI7.js} +6 -6
- package/dist/{mcp-PHB7FETI.js → mcp-YOR7UMEZ.js} +7 -7
- package/dist/{mentionProcessor-V26NXWYI.js → mentionProcessor-5CYA4NR4.js} +5 -5
- package/dist/{messages-WHTP6PI3.js → messages-ICKAWGUW.js} +1 -1
- package/dist/{model-5DT4TF4B.js → model-P33QONA2.js} +5 -5
- package/dist/{openai-737OOCXA.js → openai-POLCH476.js} +5 -5
- package/dist/{outputStyles-EPSYXOCH.js → outputStyles-EZGCOEE2.js} +4 -4
- package/dist/{pluginRuntime-NUMYY7SH.js → pluginRuntime-KJ3YFO2O.js} +6 -6
- package/dist/{pluginValidation-27NUUYNZ.js → pluginValidation-MR5GV7PL.js} +6 -6
- package/dist/prompts-P4JU57HZ.js +52 -0
- package/dist/{pybAgentSessionLoad-QMQTSGQ7.js → pybAgentSessionLoad-TRSWA62U.js} +4 -4
- package/dist/{pybAgentSessionResume-RX3URXYK.js → pybAgentSessionResume-3IRNTCVI.js} +4 -4
- package/dist/{pybAgentStreamJsonSession-V2QVHE7Y.js → pybAgentStreamJsonSession-5IBYEXS5.js} +1 -1
- package/dist/{pybHooks-WR66ZII4.js → pybHooks-HFAKEYDS.js} +4 -4
- package/dist/query-NHQFKSCC.js +54 -0
- package/dist/{registry-3Z3F4SUL.js → registry-LOKL3JBE.js} +5 -5
- package/dist/{ripgrep-5FHFS5OM.js → ripgrep-X4LOQHA7.js} +3 -3
- package/dist/{skillMarketplace-HC5HJ4MG.js → skillMarketplace-UITGQNZD.js} +3 -3
- package/dist/{state-LXTRD5P4.js → state-I7LIGIFJ.js} +2 -2
- package/dist/{theme-XFUQOISY.js → theme-RVIXXPSQ.js} +5 -5
- package/dist/{toolPermissionSettings-Z2IVN6T2.js → toolPermissionSettings-TALALPH3.js} +6 -6
- package/dist/tools-HVGZBEHZ.js +51 -0
- package/dist/{userInput-CVQ4TYJZ.js → userInput-WFPUGJ4L.js} +30 -30
- package/package.json +1 -1
- package/dist/REPL-4JXH3XRO.js +0 -46
- package/dist/agentsValidate-YM6XVDQL.js.map +0 -7
- package/dist/chunk-LMS74RIF.js.map +0 -7
- package/dist/chunk-OQA7RUJA.js.map +0 -7
- package/dist/commands-LBQTQ6YP.js +0 -50
- package/dist/prompts-HHTQ43AP.js +0 -52
- package/dist/query-LQZ7XTT3.js +0 -54
- package/dist/tools-A3ZAFFOB.js +0 -51
- /package/dist/{REPL-4JXH3XRO.js.map → REPL-WXPYXBW2.js.map} +0 -0
- /package/dist/{acp-PA6S5MGT.js.map → acp-YXMNP56B.js.map} +0 -0
- /package/dist/{ask-TKEZYYAI.js.map → ask-CUR6IJ2W.js.map} +0 -0
- /package/dist/{autoUpdater-AKRMM25L.js.map → autoUpdater-DEH233RT.js.map} +0 -0
- /package/dist/{chunk-7ZNKXJQ6.js.map → chunk-2NFKKANF.js.map} +0 -0
- /package/dist/{chunk-FTXFHBBF.js.map → chunk-37ZXN5M4.js.map} +0 -0
- /package/dist/{chunk-F5LYIQAC.js.map → chunk-4NNDWUSZ.js.map} +0 -0
- /package/dist/{chunk-3CW5FEOJ.js.map → chunk-4SWM6FWR.js.map} +0 -0
- /package/dist/{chunk-VHWL7AZC.js.map → chunk-4VUECEM6.js.map} +0 -0
- /package/dist/{chunk-MIUJHRUY.js.map → chunk-5KAIY3II.js.map} +0 -0
- /package/dist/{chunk-PXEQDOU3.js.map → chunk-6XINCIUI.js.map} +0 -0
- /package/dist/{chunk-JD2LVXSN.js.map → chunk-7ANXEZRS.js.map} +0 -0
- /package/dist/{chunk-3PA2KVRH.js.map → chunk-AB3F7T5N.js.map} +0 -0
- /package/dist/{chunk-EZ5OXAWM.js.map → chunk-B3NR3UMC.js.map} +0 -0
- /package/dist/{chunk-3SFRVXA2.js.map → chunk-BJMVIICS.js.map} +0 -0
- /package/dist/{chunk-I37OY5QI.js.map → chunk-BX6HNPWQ.js.map} +0 -0
- /package/dist/{chunk-744K4I7E.js.map → chunk-EYY3QDKX.js.map} +0 -0
- /package/dist/{chunk-TG7JXSXM.js.map → chunk-FDGIVQNE.js.map} +0 -0
- /package/dist/{chunk-455FF5IG.js.map → chunk-GMKASRN7.js.map} +0 -0
- /package/dist/{chunk-JM762ZDE.js.map → chunk-GS4PRJHV.js.map} +0 -0
- /package/dist/{chunk-AERD7AWQ.js.map → chunk-H44O47XJ.js.map} +0 -0
- /package/dist/{chunk-2QU7ZSUS.js.map → chunk-HIZXCXUG.js.map} +0 -0
- /package/dist/{chunk-BWTCQG4X.js.map → chunk-HNHWG52B.js.map} +0 -0
- /package/dist/{chunk-CP3HV6YN.js.map → chunk-JVF6KNE3.js.map} +0 -0
- /package/dist/{chunk-WTRPPL2M.js.map → chunk-KH3U5BR5.js.map} +0 -0
- /package/dist/{chunk-KTATOOLL.js.map → chunk-MKNRYFQR.js.map} +0 -0
- /package/dist/{chunk-3WG3WTUV.js.map → chunk-VW3NZKCP.js.map} +0 -0
- /package/dist/{chunk-42HW6S7R.js.map → chunk-Z73SPR4B.js.map} +0 -0
- /package/dist/{chunk-LLSY2GBI.js.map → chunk-ZE75JZFY.js.map} +0 -0
- /package/dist/{cli-6XU5K75R.js.map → cli-VNT2RTPP.js.map} +0 -0
- /package/dist/{commands-LBQTQ6YP.js.map → commands-LAZD5O4M.js.map} +0 -0
- /package/dist/{config-REKPGWPW.js.map → config-VK55G2IB.js.map} +0 -0
- /package/dist/{context-7V2M3ID6.js.map → context-QHTEENJ6.js.map} +0 -0
- /package/dist/{customCommands-WLOMXCCK.js.map → customCommands-HRHE7ZIM.js.map} +0 -0
- /package/dist/{env-35CB7KWZ.js.map → env-GGYUE5V7.js.map} +0 -0
- /package/dist/{file-TCC75FSO.js.map → file-KHYC624L.js.map} +0 -0
- /package/dist/{llm-C6QFJQ42.js.map → llm-A3S75CLF.js.map} +0 -0
- /package/dist/{llmLazy-7GZ6NMOQ.js.map → llmLazy-USVVGSVL.js.map} +0 -0
- /package/dist/{loader-X6LBDHGF.js.map → loader-JPKYTFFC.js.map} +0 -0
- /package/dist/{lsp-SWPSA5Q7.js.map → lsp-B7QJVI2U.js.map} +0 -0
- /package/dist/{lspAnchor-7DFVRBS2.js.map → lspAnchor-JJJ2WKI7.js.map} +0 -0
- /package/dist/{mcp-PHB7FETI.js.map → mcp-YOR7UMEZ.js.map} +0 -0
- /package/dist/{mentionProcessor-V26NXWYI.js.map → mentionProcessor-5CYA4NR4.js.map} +0 -0
- /package/dist/{messages-WHTP6PI3.js.map → messages-ICKAWGUW.js.map} +0 -0
- /package/dist/{model-5DT4TF4B.js.map → model-P33QONA2.js.map} +0 -0
- /package/dist/{openai-737OOCXA.js.map → openai-POLCH476.js.map} +0 -0
- /package/dist/{outputStyles-EPSYXOCH.js.map → outputStyles-EZGCOEE2.js.map} +0 -0
- /package/dist/{pluginRuntime-NUMYY7SH.js.map → pluginRuntime-KJ3YFO2O.js.map} +0 -0
- /package/dist/{pluginValidation-27NUUYNZ.js.map → pluginValidation-MR5GV7PL.js.map} +0 -0
- /package/dist/{prompts-HHTQ43AP.js.map → prompts-P4JU57HZ.js.map} +0 -0
- /package/dist/{pybAgentSessionLoad-QMQTSGQ7.js.map → pybAgentSessionLoad-TRSWA62U.js.map} +0 -0
- /package/dist/{pybAgentSessionResume-RX3URXYK.js.map → pybAgentSessionResume-3IRNTCVI.js.map} +0 -0
- /package/dist/{pybAgentStreamJsonSession-V2QVHE7Y.js.map → pybAgentStreamJsonSession-5IBYEXS5.js.map} +0 -0
- /package/dist/{pybHooks-WR66ZII4.js.map → pybHooks-HFAKEYDS.js.map} +0 -0
- /package/dist/{query-LQZ7XTT3.js.map → query-NHQFKSCC.js.map} +0 -0
- /package/dist/{registry-3Z3F4SUL.js.map → registry-LOKL3JBE.js.map} +0 -0
- /package/dist/{ripgrep-5FHFS5OM.js.map → ripgrep-X4LOQHA7.js.map} +0 -0
- /package/dist/{skillMarketplace-HC5HJ4MG.js.map → skillMarketplace-UITGQNZD.js.map} +0 -0
- /package/dist/{state-LXTRD5P4.js.map → state-I7LIGIFJ.js.map} +0 -0
- /package/dist/{theme-XFUQOISY.js.map → theme-RVIXXPSQ.js.map} +0 -0
- /package/dist/{toolPermissionSettings-Z2IVN6T2.js.map → toolPermissionSettings-TALALPH3.js.map} +0 -0
- /package/dist/{tools-A3ZAFFOB.js.map → tools-HVGZBEHZ.js.map} +0 -0
- /package/dist/{userInput-CVQ4TYJZ.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,117 +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 MUST now IMMEDIATELY start implementing the plan.
|
|
21849
|
-
|
|
21850
|
-
**IMPORTANT: Do NOT just respond with text. You MUST take action by calling tools to implement the plan.**
|
|
21851
|
-
|
|
21852
|
-
**Your next required actions:**
|
|
21853
|
-
1. If your plan has multiple steps, create tasks using TaskCreate tool to track progress
|
|
21854
|
-
2. Read the first file mentioned in your plan to understand the current state
|
|
21855
|
-
3. Use Edit or Write tools to make the necessary code changes
|
|
21856
|
-
4. Continue implementing each step until the plan is complete
|
|
21857
|
-
|
|
21858
|
-
Your plan has been saved to: ${output.filePath}
|
|
21859
|
-
You can refer back to it if needed during implementation.
|
|
21860
|
-
|
|
21861
|
-
## Approved Plan:
|
|
21862
|
-
${output.plan}
|
|
21863
|
-
|
|
21864
|
-
**Start implementing NOW by calling your first tool.**`;
|
|
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.`;
|
|
21865
21626
|
},
|
|
21866
|
-
async *call(
|
|
21867
|
-
const
|
|
21868
|
-
const planFilePath = getPlanFilePath(context?.agentId, conversationKey);
|
|
21869
|
-
const { content, exists } = readPlanFile(context?.agentId, conversationKey);
|
|
21870
|
-
if (!exists) {
|
|
21871
|
-
throw new Error(
|
|
21872
|
-
`No plan file found at ${planFilePath}. Please write your plan to this file before calling ExitPlanMode.`
|
|
21873
|
-
);
|
|
21874
|
-
}
|
|
21875
|
-
const isAgent = !!context?.agentId;
|
|
21876
|
-
const output = {
|
|
21877
|
-
plan: content,
|
|
21878
|
-
isAgent,
|
|
21879
|
-
filePath: planFilePath,
|
|
21880
|
-
launchSwarm: input.launchSwarm,
|
|
21881
|
-
teammateCount: input.teammateCount
|
|
21882
|
-
};
|
|
21627
|
+
async *call({ questions, answers: prefilled }) {
|
|
21628
|
+
const output = { questions, answers: prefilled ?? {} };
|
|
21883
21629
|
yield {
|
|
21884
21630
|
type: "result",
|
|
21885
21631
|
data: output,
|
|
@@ -21888,613 +21634,59 @@ ${output.plan}
|
|
|
21888
21634
|
}
|
|
21889
21635
|
};
|
|
21890
21636
|
|
|
21891
|
-
// src/ui/components/permissions/
|
|
21892
|
-
import {
|
|
21893
|
-
import
|
|
21894
|
-
|
|
21895
|
-
|
|
21896
|
-
|
|
21897
|
-
|
|
21898
|
-
|
|
21899
|
-
const
|
|
21900
|
-
|
|
21901
|
-
if (
|
|
21902
|
-
|
|
21903
|
-
|
|
21904
|
-
|
|
21905
|
-
});
|
|
21906
|
-
return /* @__PURE__ */ React88.createElement(
|
|
21907
|
-
Box67,
|
|
21908
|
-
{
|
|
21909
|
-
flexDirection: "column",
|
|
21910
|
-
borderStyle: "round",
|
|
21911
|
-
borderColor: theme.permission,
|
|
21912
|
-
marginTop: 1,
|
|
21913
|
-
paddingLeft: 1,
|
|
21914
|
-
paddingRight: 1,
|
|
21915
|
-
paddingBottom: 1
|
|
21916
|
-
},
|
|
21917
|
-
/* @__PURE__ */ React88.createElement(PermissionRequestTitle, { title: "Enter plan mode?", riskScore: null }),
|
|
21918
|
-
/* @__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.")),
|
|
21919
|
-
/* @__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")),
|
|
21920
|
-
/* @__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.")),
|
|
21921
|
-
/* @__PURE__ */ React88.createElement(Box67, { flexDirection: "column" }, /* @__PURE__ */ React88.createElement(Text72, null, "Would you like to proceed?"), /* @__PURE__ */ React88.createElement(
|
|
21922
|
-
Select,
|
|
21923
|
-
{
|
|
21924
|
-
options: [
|
|
21925
|
-
{ label: "Yes, enter plan mode", value: "yes" },
|
|
21926
|
-
{ label: "No, start implementing now", value: "no" }
|
|
21927
|
-
],
|
|
21928
|
-
onChange: (value) => {
|
|
21929
|
-
if (value === "yes") {
|
|
21930
|
-
setMode("plan");
|
|
21931
|
-
toolUseConfirm.onAllow("temporary");
|
|
21932
|
-
onDone();
|
|
21933
|
-
return;
|
|
21934
|
-
}
|
|
21935
|
-
toolUseConfirm.onReject();
|
|
21936
|
-
onDone();
|
|
21937
|
-
}
|
|
21938
|
-
}
|
|
21939
|
-
))
|
|
21940
|
-
);
|
|
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;
|
|
21941
21651
|
}
|
|
21942
|
-
|
|
21943
|
-
|
|
21944
|
-
|
|
21945
|
-
|
|
21946
|
-
|
|
21947
|
-
// src/utils/system/externalEditor.ts
|
|
21948
|
-
import { spawn, spawnSync } from "child_process";
|
|
21949
|
-
import { mkdtempSync, readFileSync as readFileSync9, rmSync as rmSync2, writeFileSync as writeFileSync4 } from "fs";
|
|
21950
|
-
import { tmpdir } from "os";
|
|
21951
|
-
import { join as join8 } from "path";
|
|
21952
|
-
var isWindows = process.platform === "win32";
|
|
21953
|
-
function isCommandAvailable(command4) {
|
|
21954
|
-
const checker = isWindows ? "where" : "which";
|
|
21955
|
-
const result = spawnSync(checker, [command4], { stdio: "ignore" });
|
|
21956
|
-
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;
|
|
21957
21657
|
}
|
|
21958
|
-
function
|
|
21959
|
-
const
|
|
21960
|
-
|
|
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) {
|
|
21961
21678
|
return {
|
|
21962
|
-
|
|
21963
|
-
|
|
21964
|
-
displayName: envEditor.trim(),
|
|
21965
|
-
shell: true
|
|
21679
|
+
...state,
|
|
21680
|
+
focusedOptionIndex: Math.max(0, state.focusedOptionIndex - 1)
|
|
21966
21681
|
};
|
|
21967
21682
|
}
|
|
21968
|
-
|
|
21969
|
-
|
|
21970
|
-
|
|
21971
|
-
|
|
21972
|
-
|
|
21973
|
-
|
|
21974
|
-
|
|
21975
|
-
}
|
|
21976
|
-
if (!isWindows) {
|
|
21977
|
-
if (isCommandAvailable("nano")) {
|
|
21978
|
-
candidates.push({
|
|
21979
|
-
command: "nano",
|
|
21980
|
-
args: [],
|
|
21981
|
-
displayName: "nano"
|
|
21982
|
-
});
|
|
21983
|
-
}
|
|
21984
|
-
if (isCommandAvailable("vim")) {
|
|
21985
|
-
candidates.push({
|
|
21986
|
-
command: "vim",
|
|
21987
|
-
args: [],
|
|
21988
|
-
displayName: "vim"
|
|
21989
|
-
});
|
|
21990
|
-
}
|
|
21991
|
-
if (isCommandAvailable("open")) {
|
|
21992
|
-
candidates.push({
|
|
21993
|
-
command: "open",
|
|
21994
|
-
args: ["-W", "-t"],
|
|
21995
|
-
displayName: "open -W -t"
|
|
21996
|
-
});
|
|
21997
|
-
}
|
|
21998
|
-
} else {
|
|
21999
|
-
candidates.push({
|
|
22000
|
-
command: "notepad",
|
|
22001
|
-
args: [],
|
|
22002
|
-
displayName: "notepad"
|
|
22003
|
-
});
|
|
22004
|
-
}
|
|
22005
|
-
return candidates.find((candidate) => isCommandAvailable(candidate.command)) ?? null;
|
|
22006
|
-
}
|
|
22007
|
-
function restoreStdinState(previouslyRaw) {
|
|
22008
|
-
if (!process.stdin.isTTY) return;
|
|
22009
|
-
process.stdin.resume();
|
|
22010
|
-
if (previouslyRaw && process.stdin.setRawMode) {
|
|
22011
|
-
process.stdin.setRawMode(true);
|
|
22012
|
-
}
|
|
22013
|
-
}
|
|
22014
|
-
function normalizeNewlines(text) {
|
|
22015
|
-
return text.replace(/\r\n/g, "\n");
|
|
22016
|
-
}
|
|
22017
|
-
async function launchExternalEditor(initialText) {
|
|
22018
|
-
const editorCommand = resolveEditorCommand();
|
|
22019
|
-
if (!editorCommand) {
|
|
22020
|
-
return {
|
|
22021
|
-
text: null,
|
|
22022
|
-
error: new Error(
|
|
22023
|
-
"No editor found. Set $VISUAL or $EDITOR, or install code, nano, vim, or notepad."
|
|
22024
|
-
)
|
|
22025
|
-
};
|
|
22026
|
-
}
|
|
22027
|
-
const dir = mkdtempSync(join8(tmpdir(), "pyb-edit-"));
|
|
22028
|
-
const filePath = join8(dir, "message.txt");
|
|
22029
|
-
writeFileSync4(filePath, initialText, "utf-8");
|
|
22030
|
-
const wasRaw = Boolean(process.stdin.isTTY && process.stdin.isRaw);
|
|
22031
|
-
if (process.stdin.isTTY) {
|
|
22032
|
-
process.stdin.pause();
|
|
22033
|
-
if (process.stdin.setRawMode) {
|
|
22034
|
-
process.stdin.setRawMode(false);
|
|
22035
|
-
}
|
|
22036
|
-
}
|
|
22037
|
-
try {
|
|
22038
|
-
await new Promise((resolve11, reject) => {
|
|
22039
|
-
const child = spawn(
|
|
22040
|
-
editorCommand.command,
|
|
22041
|
-
[...editorCommand.args, filePath],
|
|
22042
|
-
{
|
|
22043
|
-
stdio: "inherit",
|
|
22044
|
-
shell: editorCommand.shell ?? false
|
|
22045
|
-
}
|
|
22046
|
-
);
|
|
22047
|
-
child.on("error", reject);
|
|
22048
|
-
child.on("exit", (code, signal) => {
|
|
22049
|
-
if (code === 0 || code === null) {
|
|
22050
|
-
resolve11();
|
|
22051
|
-
} else {
|
|
22052
|
-
reject(
|
|
22053
|
-
new Error(
|
|
22054
|
-
`Editor exited with code ${code}${signal ? ` (signal ${signal})` : ""}`
|
|
22055
|
-
)
|
|
22056
|
-
);
|
|
22057
|
-
}
|
|
22058
|
-
});
|
|
22059
|
-
});
|
|
22060
|
-
} catch (error) {
|
|
22061
|
-
restoreStdinState(wasRaw);
|
|
22062
|
-
rmSync2(dir, { recursive: true, force: true });
|
|
22063
|
-
return {
|
|
22064
|
-
text: null,
|
|
22065
|
-
editorLabel: editorCommand.displayName,
|
|
22066
|
-
error
|
|
22067
|
-
};
|
|
22068
|
-
}
|
|
22069
|
-
restoreStdinState(wasRaw);
|
|
22070
|
-
try {
|
|
22071
|
-
const edited = normalizeNewlines(readFileSync9(filePath, "utf-8"));
|
|
22072
|
-
rmSync2(dir, { recursive: true, force: true });
|
|
22073
|
-
return { text: edited, editorLabel: editorCommand.displayName };
|
|
22074
|
-
} catch (error) {
|
|
22075
|
-
rmSync2(dir, { recursive: true, force: true });
|
|
22076
|
-
return {
|
|
22077
|
-
text: null,
|
|
22078
|
-
editorLabel: editorCommand.displayName,
|
|
22079
|
-
error
|
|
22080
|
-
};
|
|
22081
|
-
}
|
|
22082
|
-
}
|
|
22083
|
-
async function launchExternalEditorForFilePath(filePath) {
|
|
22084
|
-
const editorCommand = resolveEditorCommand();
|
|
22085
|
-
if (!editorCommand) {
|
|
22086
|
-
return {
|
|
22087
|
-
ok: false,
|
|
22088
|
-
error: new Error(
|
|
22089
|
-
"No editor found. Set $VISUAL or $EDITOR, or install code, nano, vim, or notepad."
|
|
22090
|
-
)
|
|
22091
|
-
};
|
|
22092
|
-
}
|
|
22093
|
-
const wasRaw = Boolean(process.stdin.isTTY && process.stdin.isRaw);
|
|
22094
|
-
if (process.stdin.isTTY) {
|
|
22095
|
-
process.stdin.pause();
|
|
22096
|
-
if (process.stdin.setRawMode) {
|
|
22097
|
-
process.stdin.setRawMode(false);
|
|
22098
|
-
}
|
|
22099
|
-
}
|
|
22100
|
-
try {
|
|
22101
|
-
await new Promise((resolve11, reject) => {
|
|
22102
|
-
const child = spawn(
|
|
22103
|
-
editorCommand.command,
|
|
22104
|
-
[...editorCommand.args, filePath],
|
|
22105
|
-
{
|
|
22106
|
-
stdio: "inherit",
|
|
22107
|
-
shell: editorCommand.shell ?? false
|
|
22108
|
-
}
|
|
22109
|
-
);
|
|
22110
|
-
child.on("error", reject);
|
|
22111
|
-
child.on("exit", (code, signal) => {
|
|
22112
|
-
if (code === 0 || code === null) {
|
|
22113
|
-
resolve11();
|
|
22114
|
-
} else {
|
|
22115
|
-
reject(
|
|
22116
|
-
new Error(
|
|
22117
|
-
`Editor exited with code ${code}${signal ? ` (signal ${signal})` : ""}`
|
|
22118
|
-
)
|
|
22119
|
-
);
|
|
22120
|
-
}
|
|
22121
|
-
});
|
|
22122
|
-
});
|
|
22123
|
-
} catch (error) {
|
|
22124
|
-
restoreStdinState(wasRaw);
|
|
22125
|
-
return {
|
|
22126
|
-
ok: false,
|
|
22127
|
-
editorLabel: editorCommand.displayName,
|
|
22128
|
-
error
|
|
22129
|
-
};
|
|
22130
|
-
}
|
|
22131
|
-
restoreStdinState(wasRaw);
|
|
22132
|
-
return { ok: true, editorLabel: editorCommand.displayName };
|
|
22133
|
-
}
|
|
22134
|
-
|
|
22135
|
-
// src/ui/components/permissions/plan-mode-permission-request/ExitPlanModePermissionRequest.tsx
|
|
22136
|
-
import { writeFileSync as writeFileSync5 } from "fs";
|
|
22137
|
-
function getExitPlanModeOptions(args) {
|
|
22138
|
-
const options = [];
|
|
22139
|
-
options.push(
|
|
22140
|
-
args.bypassAvailable ? { label: "Yes, and bypass permissions", value: "yes-bypass" } : { label: "Yes, and auto-accept edits", value: "yes-accept" }
|
|
22141
|
-
);
|
|
22142
|
-
if (args.launchSwarmAvailable) {
|
|
22143
|
-
options.push({
|
|
22144
|
-
label: `Yes, and launch swarm (${args.teammateCount} teammates)`,
|
|
22145
|
-
value: "yes-launch-swarm"
|
|
22146
|
-
});
|
|
22147
|
-
}
|
|
22148
|
-
options.push({
|
|
22149
|
-
label: "Yes, and manually approve edits",
|
|
22150
|
-
value: "yes-default"
|
|
22151
|
-
});
|
|
22152
|
-
options.push({ label: "No, keep planning", value: "no" });
|
|
22153
|
-
return options;
|
|
22154
|
-
}
|
|
22155
|
-
function planPlaceholder() {
|
|
22156
|
-
return "No plan found. Please write your plan to the plan file first.";
|
|
22157
|
-
}
|
|
22158
|
-
function ExitPlanModePermissionRequest({
|
|
22159
|
-
toolUseConfirm,
|
|
22160
|
-
onDone
|
|
22161
|
-
}) {
|
|
22162
|
-
const theme = getTheme();
|
|
22163
|
-
const { setMode } = usePermissionContext();
|
|
22164
|
-
const conversationKey = getPlanConversationKey(toolUseConfirm.toolUseContext);
|
|
22165
|
-
const planFilePath = useMemo23(
|
|
22166
|
-
() => getPlanFilePath(void 0, conversationKey),
|
|
22167
|
-
[conversationKey]
|
|
22168
|
-
);
|
|
22169
|
-
const planFromInput = typeof toolUseConfirm.input?.plan === "string" && String(toolUseConfirm.input.plan).trim().length > 0 ? String(toolUseConfirm.input.plan) : null;
|
|
22170
|
-
const planSource = planFromInput ? "input" : "file";
|
|
22171
|
-
const [planText, setPlanText] = useState21(() => {
|
|
22172
|
-
if (planSource === "input") {
|
|
22173
|
-
return planFromInput;
|
|
22174
|
-
}
|
|
22175
|
-
const { content, exists } = readPlanFile(void 0, conversationKey);
|
|
22176
|
-
return exists ? content : planPlaceholder();
|
|
22177
|
-
});
|
|
22178
|
-
const [planExists, setPlanExists] = useState21(() => {
|
|
22179
|
-
if (planSource === "input") return false;
|
|
22180
|
-
const { exists } = readPlanFile(void 0, conversationKey);
|
|
22181
|
-
return exists;
|
|
22182
|
-
});
|
|
22183
|
-
const [planSaved, setPlanSaved] = useState21(false);
|
|
22184
|
-
const [showRejectInput, setShowRejectInput] = useState21(false);
|
|
22185
|
-
const [rejectFeedback, setRejectFeedback] = useState21("");
|
|
22186
|
-
const [rejectError, setRejectError] = useState21(null);
|
|
22187
|
-
const [rejectCursorOffset, setRejectCursorOffset] = useState21(0);
|
|
22188
|
-
const [focusedOption, setFocusedOption] = useState21(null);
|
|
22189
|
-
const [teammateCount, setTeammateCount] = useState21(3);
|
|
22190
|
-
useEffect20(() => {
|
|
22191
|
-
if (!planSaved) return;
|
|
22192
|
-
const timeout = setTimeout(() => setPlanSaved(false), 5e3);
|
|
22193
|
-
return () => clearTimeout(timeout);
|
|
22194
|
-
}, [planSaved]);
|
|
22195
|
-
useInput23((input, key) => {
|
|
22196
|
-
if (key.escape && !showRejectInput) {
|
|
22197
|
-
toolUseConfirm.onReject();
|
|
22198
|
-
onDone();
|
|
22199
|
-
return;
|
|
22200
|
-
}
|
|
22201
|
-
if (key.tab && focusedOption === "yes-launch-swarm") {
|
|
22202
|
-
setTeammateCount((prev) => {
|
|
22203
|
-
const allowed = [2, 3, 4, 6, 8];
|
|
22204
|
-
const idx = Math.max(0, allowed.indexOf(prev));
|
|
22205
|
-
return allowed[(idx + 1) % allowed.length];
|
|
22206
|
-
});
|
|
22207
|
-
return;
|
|
22208
|
-
}
|
|
22209
|
-
if (!(key.ctrl && input.toLowerCase() === "g")) return;
|
|
22210
|
-
void (async () => {
|
|
22211
|
-
if (planSource === "input") {
|
|
22212
|
-
const edited = await launchExternalEditor(planText);
|
|
22213
|
-
if (edited.text !== null) {
|
|
22214
|
-
setPlanText(edited.text);
|
|
22215
|
-
setPlanSaved(true);
|
|
22216
|
-
}
|
|
22217
|
-
return;
|
|
22218
|
-
}
|
|
22219
|
-
if (!planExists) {
|
|
22220
|
-
const initial = planText === planPlaceholder() ? "# Plan\n" : planText;
|
|
22221
|
-
try {
|
|
22222
|
-
writeFileSync5(planFilePath, initial, "utf-8");
|
|
22223
|
-
} catch {
|
|
22224
|
-
const edited = await launchExternalEditor(initial);
|
|
22225
|
-
if (edited.text !== null) {
|
|
22226
|
-
setPlanText(edited.text);
|
|
22227
|
-
setPlanSaved(true);
|
|
22228
|
-
}
|
|
22229
|
-
return;
|
|
22230
|
-
}
|
|
22231
|
-
}
|
|
22232
|
-
const opened = await launchExternalEditorForFilePath(planFilePath);
|
|
22233
|
-
if (opened.ok) {
|
|
22234
|
-
const next = readPlanFile(void 0, conversationKey);
|
|
22235
|
-
setPlanExists(next.exists);
|
|
22236
|
-
setPlanText(next.exists ? next.content : planPlaceholder());
|
|
22237
|
-
setPlanSaved(true);
|
|
22238
|
-
}
|
|
22239
|
-
})();
|
|
22240
|
-
});
|
|
22241
|
-
const bypassAvailable = toolUseConfirm.toolUseContext.options?.safeMode !== true;
|
|
22242
|
-
const launchSwarmAvailable = false;
|
|
22243
|
-
const options = useMemo23(
|
|
22244
|
-
() => getExitPlanModeOptions({
|
|
22245
|
-
bypassAvailable,
|
|
22246
|
-
launchSwarmAvailable,
|
|
22247
|
-
teammateCount
|
|
22248
|
-
}),
|
|
22249
|
-
[bypassAvailable, launchSwarmAvailable, teammateCount]
|
|
22250
|
-
);
|
|
22251
|
-
if (showRejectInput) {
|
|
22252
|
-
return /* @__PURE__ */ React89.createElement(
|
|
22253
|
-
Box68,
|
|
22254
|
-
{
|
|
22255
|
-
flexDirection: "column",
|
|
22256
|
-
borderStyle: "round",
|
|
22257
|
-
borderColor: theme.permission,
|
|
22258
|
-
marginTop: 1,
|
|
22259
|
-
paddingLeft: 1,
|
|
22260
|
-
paddingRight: 1,
|
|
22261
|
-
paddingBottom: 1
|
|
22262
|
-
},
|
|
22263
|
-
/* @__PURE__ */ React89.createElement(PermissionRequestTitle, { title: "No, keep planning", riskScore: null }),
|
|
22264
|
-
/* @__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(
|
|
22265
|
-
TextInput,
|
|
22266
|
-
{
|
|
22267
|
-
value: rejectFeedback,
|
|
22268
|
-
onChange: (value) => {
|
|
22269
|
-
setRejectFeedback(value);
|
|
22270
|
-
setRejectError(null);
|
|
22271
|
-
},
|
|
22272
|
-
onSubmit: () => {
|
|
22273
|
-
const trimmed = rejectFeedback.trim();
|
|
22274
|
-
if (!trimmed) {
|
|
22275
|
-
setRejectError("Please enter what you want changed.");
|
|
22276
|
-
return;
|
|
22277
|
-
}
|
|
22278
|
-
toolUseConfirm.onReject(trimmed);
|
|
22279
|
-
onDone();
|
|
22280
|
-
},
|
|
22281
|
-
onExit: () => {
|
|
22282
|
-
setShowRejectInput(false);
|
|
22283
|
-
setRejectFeedback("");
|
|
22284
|
-
setRejectError(null);
|
|
22285
|
-
},
|
|
22286
|
-
columns: 80,
|
|
22287
|
-
cursorOffset: rejectCursorOffset,
|
|
22288
|
-
onChangeCursorOffset: setRejectCursorOffset
|
|
22289
|
-
}
|
|
22290
|
-
))
|
|
22291
|
-
);
|
|
22292
|
-
}
|
|
22293
|
-
return /* @__PURE__ */ React89.createElement(
|
|
22294
|
-
Box68,
|
|
22295
|
-
{
|
|
22296
|
-
flexDirection: "column",
|
|
22297
|
-
borderStyle: "round",
|
|
22298
|
-
borderColor: theme.permission,
|
|
22299
|
-
marginTop: 1,
|
|
22300
|
-
paddingLeft: 1,
|
|
22301
|
-
paddingRight: 1,
|
|
22302
|
-
paddingBottom: 1
|
|
22303
|
-
},
|
|
22304
|
-
/* @__PURE__ */ React89.createElement(PermissionRequestTitle, { title: "Ready to code?", riskScore: null }),
|
|
22305
|
-
/* @__PURE__ */ React89.createElement(Box68, { flexDirection: "column", paddingX: 2, paddingY: 1 }, /* @__PURE__ */ React89.createElement(Text73, null, "Here is Pyb Agent's plan:"), /* @__PURE__ */ React89.createElement(
|
|
22306
|
-
Box68,
|
|
22307
|
-
{
|
|
22308
|
-
borderStyle: "dashed",
|
|
22309
|
-
borderColor: theme.secondaryBorder,
|
|
22310
|
-
borderDimColor: true,
|
|
22311
|
-
borderLeft: false,
|
|
22312
|
-
borderRight: false,
|
|
22313
|
-
paddingX: 1,
|
|
22314
|
-
paddingY: 0,
|
|
22315
|
-
marginBottom: 1,
|
|
22316
|
-
flexDirection: "column"
|
|
22317
|
-
},
|
|
22318
|
-
/* @__PURE__ */ React89.createElement(Text73, null, planText)
|
|
22319
|
-
)),
|
|
22320
|
-
/* @__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!" : "")),
|
|
22321
|
-
/* @__PURE__ */ React89.createElement(Box68, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React89.createElement(Text73, { dimColor: true }, "Would you like to proceed?"), /* @__PURE__ */ React89.createElement(
|
|
22322
|
-
Select,
|
|
22323
|
-
{
|
|
22324
|
-
options,
|
|
22325
|
-
onFocus: (value) => setFocusedOption(value),
|
|
22326
|
-
onChange: (value) => {
|
|
22327
|
-
if (value === "no") {
|
|
22328
|
-
setShowRejectInput(true);
|
|
22329
|
-
return;
|
|
22330
|
-
}
|
|
22331
|
-
const nextMode = value === "yes-bypass" ? "bypassPermissions" : value === "yes-accept" ? "acceptEdits" : value === "yes-launch-swarm" ? "bypassPermissions" : "default";
|
|
22332
|
-
setMode(nextMode);
|
|
22333
|
-
if (value === "yes-launch-swarm") {
|
|
22334
|
-
;
|
|
22335
|
-
toolUseConfirm.input.launchSwarm = true;
|
|
22336
|
-
toolUseConfirm.input.teammateCount = teammateCount;
|
|
22337
|
-
}
|
|
22338
|
-
toolUseConfirm.onAllow("temporary");
|
|
22339
|
-
onDone();
|
|
22340
|
-
}
|
|
22341
|
-
}
|
|
22342
|
-
))
|
|
22343
|
-
);
|
|
22344
|
-
}
|
|
22345
|
-
|
|
22346
|
-
// src/tools/interaction/AskUserQuestionTool/AskUserQuestionTool.tsx
|
|
22347
|
-
import { Box as Box69, Text as Text74 } from "ink";
|
|
22348
|
-
import React90 from "react";
|
|
22349
|
-
import { z as z12 } from "zod";
|
|
22350
|
-
|
|
22351
|
-
// src/tools/interaction/AskUserQuestionTool/prompt.ts
|
|
22352
|
-
var TOOL_NAME_FOR_PROMPT6 = "AskUserQuestion";
|
|
22353
|
-
var DESCRIPTION6 = "Asks the user multiple choice questions to gather information, clarify ambiguity, understand preferences, make decisions or offer them choices.";
|
|
22354
|
-
var PROMPT6 = `Use this tool when you need to ask the user questions during execution. This allows you to:
|
|
22355
|
-
1. Gather user preferences or requirements
|
|
22356
|
-
2. Clarify ambiguous instructions
|
|
22357
|
-
3. Get decisions on implementation choices as you work
|
|
22358
|
-
4. Offer choices to the user about what direction to take.
|
|
22359
|
-
|
|
22360
|
-
Usage notes:
|
|
22361
|
-
- Users will always be able to select "Other" to provide custom text input
|
|
22362
|
-
- Use multiSelect: true to allow multiple answers to be selected for a question
|
|
22363
|
-
- If you recommend a specific option, make that the first option in the list and add "(Recommended)" at the end of the label`;
|
|
22364
|
-
|
|
22365
|
-
// src/tools/interaction/AskUserQuestionTool/AskUserQuestionTool.tsx
|
|
22366
|
-
var optionSchema = z12.object({
|
|
22367
|
-
label: z12.string(),
|
|
22368
|
-
description: z12.string()
|
|
22369
|
-
});
|
|
22370
|
-
var questionSchema = z12.object({
|
|
22371
|
-
question: z12.string(),
|
|
22372
|
-
header: z12.string(),
|
|
22373
|
-
options: z12.array(optionSchema).min(2).max(4),
|
|
22374
|
-
multiSelect: z12.boolean()
|
|
22375
|
-
});
|
|
22376
|
-
var inputSchema12 = z12.strictObject({
|
|
22377
|
-
questions: z12.array(questionSchema).min(1).max(4),
|
|
22378
|
-
answers: z12.record(z12.string(), z12.string()).optional()
|
|
22379
|
-
}).refine(
|
|
22380
|
-
(input) => {
|
|
22381
|
-
const questionTexts = input.questions.map((q) => q.question);
|
|
22382
|
-
if (questionTexts.length !== new Set(questionTexts).size) return false;
|
|
22383
|
-
for (const question of input.questions) {
|
|
22384
|
-
const optionLabels = question.options.map((option) => option.label);
|
|
22385
|
-
if (optionLabels.length !== new Set(optionLabels).size) return false;
|
|
22386
|
-
}
|
|
22387
|
-
return true;
|
|
22388
|
-
},
|
|
22389
|
-
{
|
|
22390
|
-
message: "Question texts must be unique, option labels must be unique within each question"
|
|
22391
|
-
}
|
|
22392
|
-
);
|
|
22393
|
-
var AskUserQuestionTool = {
|
|
22394
|
-
name: TOOL_NAME_FOR_PROMPT6,
|
|
22395
|
-
async description() {
|
|
22396
|
-
return DESCRIPTION6;
|
|
22397
|
-
},
|
|
22398
|
-
userFacingName() {
|
|
22399
|
-
return "";
|
|
22400
|
-
},
|
|
22401
|
-
inputSchema: inputSchema12,
|
|
22402
|
-
isReadOnly() {
|
|
22403
|
-
return true;
|
|
22404
|
-
},
|
|
22405
|
-
isConcurrencySafe() {
|
|
22406
|
-
return true;
|
|
22407
|
-
},
|
|
22408
|
-
async isEnabled() {
|
|
22409
|
-
return true;
|
|
22410
|
-
},
|
|
22411
|
-
needsPermissions() {
|
|
22412
|
-
return true;
|
|
22413
|
-
},
|
|
22414
|
-
requiresUserInteraction() {
|
|
22415
|
-
return true;
|
|
22416
|
-
},
|
|
22417
|
-
async prompt() {
|
|
22418
|
-
return PROMPT6;
|
|
22419
|
-
},
|
|
22420
|
-
renderToolUseMessage() {
|
|
22421
|
-
return null;
|
|
22422
|
-
},
|
|
22423
|
-
renderToolUseRejectedMessage() {
|
|
22424
|
-
const theme = getTheme();
|
|
22425
|
-
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"));
|
|
22426
|
-
},
|
|
22427
|
-
renderToolResultMessage(output, _options) {
|
|
22428
|
-
const theme = getTheme();
|
|
22429
|
-
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)))));
|
|
22430
|
-
},
|
|
22431
|
-
renderResultForAssistant(output) {
|
|
22432
|
-
const formatted = Object.entries(output.answers).map(([question, answer]) => `"${question}"="${answer}"`).join(", ");
|
|
22433
|
-
return `User has answered your questions: ${formatted}. You can now continue with the user's answers in mind.`;
|
|
22434
|
-
},
|
|
22435
|
-
async *call({ questions, answers: prefilled }) {
|
|
22436
|
-
const output = { questions, answers: prefilled ?? {} };
|
|
22437
|
-
yield {
|
|
22438
|
-
type: "result",
|
|
22439
|
-
data: output,
|
|
22440
|
-
resultForAssistant: this.renderResultForAssistant(output)
|
|
22441
|
-
};
|
|
22442
|
-
}
|
|
22443
|
-
};
|
|
22444
|
-
|
|
22445
|
-
// src/ui/components/permissions/ask-user-question-permission-request/AskUserQuestionPermissionRequest.tsx
|
|
22446
|
-
import React91, { useCallback as useCallback11, useMemo as useMemo24, useState as useState22 } from "react";
|
|
22447
|
-
import { Box as Box70, Text as Text75, useInput as useInput24 } from "ink";
|
|
22448
|
-
import figures8 from "figures";
|
|
22449
|
-
import stringWidth from "string-width";
|
|
22450
|
-
function isTextInputChar(input, key) {
|
|
22451
|
-
if (key.ctrl || key.meta || key.tab) return false;
|
|
22452
|
-
if (typeof input !== "string" || input.length === 0) return false;
|
|
22453
|
-
for (const char of input) {
|
|
22454
|
-
const code = char.codePointAt(0);
|
|
22455
|
-
if (code === void 0) return false;
|
|
22456
|
-
if (code < 32 || code === 127) return false;
|
|
22457
|
-
}
|
|
22458
|
-
return true;
|
|
22459
|
-
}
|
|
22460
|
-
function applySingleSelectNav(args) {
|
|
22461
|
-
const { focusedOptionIndex, key, optionCount } = args;
|
|
22462
|
-
if (key.downArrow) return Math.min(optionCount - 1, focusedOptionIndex + 1);
|
|
22463
|
-
if (key.upArrow) return Math.max(0, focusedOptionIndex - 1);
|
|
22464
|
-
return focusedOptionIndex;
|
|
22465
|
-
}
|
|
22466
|
-
function applyMultiSelectNav(args) {
|
|
22467
|
-
const { state, key, optionCount } = args;
|
|
22468
|
-
const nextKey = key.downArrow || key.tab && !key.shift;
|
|
22469
|
-
const prevKey = key.upArrow || key.tab && key.shift;
|
|
22470
|
-
if (state.isSubmitFocused) {
|
|
22471
|
-
if (prevKey) {
|
|
22472
|
-
return {
|
|
22473
|
-
focusedOptionIndex: Math.max(0, optionCount - 1),
|
|
22474
|
-
isSubmitFocused: false
|
|
22475
|
-
};
|
|
22476
|
-
}
|
|
22477
|
-
return state;
|
|
22478
|
-
}
|
|
22479
|
-
if (nextKey) {
|
|
22480
|
-
if (state.focusedOptionIndex >= optionCount - 1) {
|
|
22481
|
-
return { ...state, isSubmitFocused: true };
|
|
22482
|
-
}
|
|
22483
|
-
return { ...state, focusedOptionIndex: state.focusedOptionIndex + 1 };
|
|
22484
|
-
}
|
|
22485
|
-
if (prevKey) {
|
|
22486
|
-
return {
|
|
22487
|
-
...state,
|
|
22488
|
-
focusedOptionIndex: Math.max(0, state.focusedOptionIndex - 1)
|
|
22489
|
-
};
|
|
22490
|
-
}
|
|
22491
|
-
return state;
|
|
22492
|
-
}
|
|
22493
|
-
function truncateWithEllipsis(label, maxWidth) {
|
|
22494
|
-
if (stringWidth(label) <= maxWidth) return label;
|
|
22495
|
-
let candidate = label;
|
|
22496
|
-
while (candidate.length > 1 && stringWidth(candidate + "\u2026") > maxWidth) {
|
|
22497
|
-
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);
|
|
22498
21690
|
}
|
|
22499
21691
|
return candidate.length ? candidate + "\u2026" : "\u2026";
|
|
22500
21692
|
}
|
|
@@ -22551,7 +21743,7 @@ function AskUserQuestionPermissionRequest({
|
|
|
22551
21743
|
}) {
|
|
22552
21744
|
const theme = getTheme();
|
|
22553
21745
|
const { columns } = useTerminalSize();
|
|
22554
|
-
const parsed =
|
|
21746
|
+
const parsed = useMemo23(() => {
|
|
22555
21747
|
const result = AskUserQuestionTool.inputSchema.safeParse(
|
|
22556
21748
|
toolUseConfirm.input
|
|
22557
21749
|
);
|
|
@@ -22566,18 +21758,18 @@ function AskUserQuestionPermissionRequest({
|
|
|
22566
21758
|
};
|
|
22567
21759
|
}, [toolUseConfirm.input]);
|
|
22568
21760
|
const questions = parsed.questions;
|
|
22569
|
-
const [currentQuestionIndex, setCurrentQuestionIndex] =
|
|
22570
|
-
const [focusedOptionIndex, setFocusedOptionIndex] =
|
|
22571
|
-
const [isMultiSelectSubmitFocused, setIsMultiSelectSubmitFocused] =
|
|
22572
|
-
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(
|
|
22573
21765
|
parsed.initialAnswers
|
|
22574
21766
|
);
|
|
22575
|
-
const [questionStates, setQuestionStates] =
|
|
21767
|
+
const [questionStates, setQuestionStates] = useState21({});
|
|
22576
21768
|
const currentQuestion = questions[currentQuestionIndex];
|
|
22577
21769
|
const isSubmitTab = currentQuestionIndex === questions.length;
|
|
22578
21770
|
const hideSubmitTab = questions.length === 1 && !questions[0]?.multiSelect;
|
|
22579
21771
|
const maxTabIndex = hideSubmitTab ? Math.max(0, questions.length - 1) : questions.length;
|
|
22580
|
-
const tabHeaders =
|
|
21772
|
+
const tabHeaders = useMemo23(
|
|
22581
21773
|
() => getTabHeaders({
|
|
22582
21774
|
questions,
|
|
22583
21775
|
currentQuestionIndex,
|
|
@@ -22623,7 +21815,7 @@ function AskUserQuestionPermissionRequest({
|
|
|
22623
21815
|
},
|
|
22624
21816
|
[]
|
|
22625
21817
|
);
|
|
22626
|
-
|
|
21818
|
+
useInput22((input, key) => {
|
|
22627
21819
|
if (key.escape) {
|
|
22628
21820
|
cancel();
|
|
22629
21821
|
return;
|
|
@@ -22798,18 +21990,18 @@ function AskUserQuestionPermissionRequest({
|
|
|
22798
21990
|
const rightArrowInactive = currentQuestionIndex === maxTabIndex;
|
|
22799
21991
|
const allQuestionsAnswered = questions.every((q) => q?.question && Boolean(answers[q.question])) ?? false;
|
|
22800
21992
|
if (questions.length === 0) {
|
|
22801
|
-
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."));
|
|
22802
21994
|
}
|
|
22803
|
-
return /* @__PURE__ */
|
|
22804
|
-
|
|
21995
|
+
return /* @__PURE__ */ React87.createElement(Box66, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React87.createElement(
|
|
21996
|
+
Box66,
|
|
22805
21997
|
{
|
|
22806
21998
|
borderTop: true,
|
|
22807
21999
|
borderColor: theme.secondaryText,
|
|
22808
22000
|
flexDirection: "column",
|
|
22809
22001
|
paddingTop: 0
|
|
22810
22002
|
},
|
|
22811
|
-
/* @__PURE__ */
|
|
22812
|
-
|
|
22003
|
+
/* @__PURE__ */ React87.createElement(Box66, { flexDirection: "row", marginBottom: 1 }, showArrows && /* @__PURE__ */ React87.createElement(
|
|
22004
|
+
Text71,
|
|
22813
22005
|
{
|
|
22814
22006
|
color: currentQuestionIndex === 0 ? theme.secondaryText : void 0
|
|
22815
22007
|
},
|
|
@@ -22820,16 +22012,16 @@ function AskUserQuestionPermissionRequest({
|
|
|
22820
22012
|
const checkbox = question.question && answers[question.question] ? figures8.checkboxOn : figures8.checkboxOff;
|
|
22821
22013
|
const headerText = tabHeaders[index] ?? question.header ?? `Q${index + 1}`;
|
|
22822
22014
|
const tabText = ` ${checkbox} ${headerText} `;
|
|
22823
|
-
return /* @__PURE__ */
|
|
22824
|
-
|
|
22015
|
+
return /* @__PURE__ */ React87.createElement(React87.Fragment, { key: question.question || `question-${index}` }, /* @__PURE__ */ React87.createElement(
|
|
22016
|
+
Text71,
|
|
22825
22017
|
{
|
|
22826
22018
|
backgroundColor: isSelected ? theme.permission : void 0,
|
|
22827
22019
|
color: isSelected ? inverseText : void 0
|
|
22828
22020
|
},
|
|
22829
22021
|
tabText
|
|
22830
22022
|
));
|
|
22831
|
-
}), !hideSubmitTab && /* @__PURE__ */
|
|
22832
|
-
|
|
22023
|
+
}), !hideSubmitTab && /* @__PURE__ */ React87.createElement(
|
|
22024
|
+
Text71,
|
|
22833
22025
|
{
|
|
22834
22026
|
backgroundColor: isSubmitTab ? theme.permission : void 0,
|
|
22835
22027
|
color: isSubmitTab ? inverseText : void 0
|
|
@@ -22838,23 +22030,23 @@ function AskUserQuestionPermissionRequest({
|
|
|
22838
22030
|
figures8.tick,
|
|
22839
22031
|
" Submit",
|
|
22840
22032
|
" "
|
|
22841
|
-
), showArrows && /* @__PURE__ */
|
|
22842
|
-
!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 }, (() => {
|
|
22843
22035
|
const rawSelected = activeQuestionState?.selectedValue;
|
|
22844
22036
|
const selectedValues = Array.isArray(rawSelected) ? rawSelected : [];
|
|
22845
22037
|
const otherSelected = currentQuestion.multiSelect ? selectedValues.includes("__other__") : rawSelected === "__other__";
|
|
22846
22038
|
const otherText = questionStates[currentQuestion.question]?.textInputValue ?? "";
|
|
22847
22039
|
const otherPlaceholder = currentQuestion.multiSelect ? "Type something" : "Type something.";
|
|
22848
22040
|
const otherLine = otherText.length > 0 ? otherText : isOtherFocused || otherSelected ? otherPlaceholder : "";
|
|
22849
|
-
return /* @__PURE__ */
|
|
22041
|
+
return /* @__PURE__ */ React87.createElement(React87.Fragment, null, currentQuestion.options.map((option, index) => {
|
|
22850
22042
|
const isFocused = !isMultiSelectSubmitFocused && index === focusedOptionIndex;
|
|
22851
22043
|
const isSelected = currentQuestion.multiSelect ? selectedValues.includes(option.label) : rawSelected === option.label;
|
|
22852
22044
|
const pointer = isFocused ? figures8.pointer : " ";
|
|
22853
22045
|
const color = isFocused ? theme.pyb : theme.text;
|
|
22854
22046
|
const indicator = currentQuestion.multiSelect ? isSelected ? figures8.checkboxOn : figures8.checkboxOff : isSelected ? figures8.tick : " ";
|
|
22855
|
-
return /* @__PURE__ */
|
|
22856
|
-
}), /* @__PURE__ */
|
|
22857
|
-
|
|
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,
|
|
22858
22050
|
{
|
|
22859
22051
|
color: isMultiSelectSubmitFocused ? theme.pyb : theme.text,
|
|
22860
22052
|
bold: isMultiSelectSubmitFocused
|
|
@@ -22862,9 +22054,9 @@ function AskUserQuestionPermissionRequest({
|
|
|
22862
22054
|
isMultiSelectSubmitFocused ? figures8.pointer : " ",
|
|
22863
22055
|
" ",
|
|
22864
22056
|
currentQuestionIndex === questions.length - 1 ? "Submit" : "Next"
|
|
22865
|
-
)), /* @__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")));
|
|
22866
22058
|
})())),
|
|
22867
|
-
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(
|
|
22868
22060
|
Select,
|
|
22869
22061
|
{
|
|
22870
22062
|
options: [
|
|
@@ -22905,10 +22097,6 @@ function permissionComponentForTool(tool) {
|
|
|
22905
22097
|
return SkillPermissionRequest;
|
|
22906
22098
|
case WebFetchTool:
|
|
22907
22099
|
return WebFetchPermissionRequest;
|
|
22908
|
-
case EnterPlanModeTool:
|
|
22909
|
-
return EnterPlanModePermissionRequest;
|
|
22910
|
-
case ExitPlanModeTool:
|
|
22911
|
-
return ExitPlanModePermissionRequest;
|
|
22912
22100
|
case AskUserQuestionTool:
|
|
22913
22101
|
return AskUserQuestionPermissionRequest;
|
|
22914
22102
|
default:
|
|
@@ -22923,7 +22111,7 @@ function PermissionRequest({
|
|
|
22923
22111
|
onDone,
|
|
22924
22112
|
verbose
|
|
22925
22113
|
}) {
|
|
22926
|
-
|
|
22114
|
+
useInput23((input, key) => {
|
|
22927
22115
|
if (key.ctrl && input === "c") {
|
|
22928
22116
|
onDone();
|
|
22929
22117
|
toolUseConfirm.onReject();
|
|
@@ -22934,7 +22122,7 @@ function PermissionRequest({
|
|
|
22934
22122
|
`${PRODUCT_NAME} needs your permission to use ${toolName}`
|
|
22935
22123
|
);
|
|
22936
22124
|
const PermissionComponent = permissionComponentForTool(toolUseConfirm.tool);
|
|
22937
|
-
return /* @__PURE__ */
|
|
22125
|
+
return /* @__PURE__ */ React88.createElement(
|
|
22938
22126
|
PermissionComponent,
|
|
22939
22127
|
{
|
|
22940
22128
|
toolUseConfirm,
|
|
@@ -22945,11 +22133,11 @@ function PermissionRequest({
|
|
|
22945
22133
|
}
|
|
22946
22134
|
|
|
22947
22135
|
// src/ui/components/PromptInput.tsx
|
|
22948
|
-
import { Box as
|
|
22949
|
-
import * as
|
|
22136
|
+
import { Box as Box69, Text as Text74, useInput as useInput25 } from "ink";
|
|
22137
|
+
import * as React92 from "react";
|
|
22950
22138
|
|
|
22951
22139
|
// src/ui/hooks/useArrowKeyHistory.ts
|
|
22952
|
-
import { useState as
|
|
22140
|
+
import { useState as useState22 } from "react";
|
|
22953
22141
|
|
|
22954
22142
|
// src/app/history.ts
|
|
22955
22143
|
var MAX_HISTORY_ITEMS = 100;
|
|
@@ -22971,8 +22159,8 @@ function addToHistory(command4) {
|
|
|
22971
22159
|
|
|
22972
22160
|
// src/ui/hooks/useArrowKeyHistory.ts
|
|
22973
22161
|
function useArrowKeyHistory(onSetInput, currentInput) {
|
|
22974
|
-
const [historyIndex, setHistoryIndex] =
|
|
22975
|
-
const [lastTypedInput, setLastTypedInput] =
|
|
22162
|
+
const [historyIndex, setHistoryIndex] = useState22(0);
|
|
22163
|
+
const [lastTypedInput, setLastTypedInput] = useState22("");
|
|
22976
22164
|
const updateInput = (input) => {
|
|
22977
22165
|
if (input !== void 0) {
|
|
22978
22166
|
const mode = input.startsWith("!") ? "bash" : "prompt";
|
|
@@ -23016,8 +22204,8 @@ function useArrowKeyHistory(onSetInput, currentInput) {
|
|
|
23016
22204
|
}
|
|
23017
22205
|
|
|
23018
22206
|
// src/ui/hooks/useUnifiedCompletion.ts
|
|
23019
|
-
import { useState as
|
|
23020
|
-
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";
|
|
23021
22209
|
|
|
23022
22210
|
// src/utils/completion/context.ts
|
|
23023
22211
|
function getCompletionContext(args) {
|
|
@@ -23088,7 +22276,7 @@ function getCompletionContext(args) {
|
|
|
23088
22276
|
|
|
23089
22277
|
// src/utils/completion/fileSuggestions.ts
|
|
23090
22278
|
import { existsSync as existsSync13, readdirSync as readdirSync3, statSync as statSync11 } from "fs";
|
|
23091
|
-
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";
|
|
23092
22280
|
function generateFileSuggestions(args) {
|
|
23093
22281
|
const { prefix, cwd } = args;
|
|
23094
22282
|
try {
|
|
@@ -23122,8 +22310,8 @@ function generateFileSuggestions(args) {
|
|
|
23122
22310
|
return false;
|
|
23123
22311
|
return true;
|
|
23124
22312
|
}).sort((a, b) => {
|
|
23125
|
-
const aPath =
|
|
23126
|
-
const bPath =
|
|
22313
|
+
const aPath = join8(searchDir, a);
|
|
22314
|
+
const bPath = join8(searchDir, b);
|
|
23127
22315
|
const aIsDir = statSync11(aPath).isDirectory();
|
|
23128
22316
|
const bIsDir = statSync11(bPath).isDirectory();
|
|
23129
22317
|
if (aIsDir && !bIsDir) return -1;
|
|
@@ -23131,7 +22319,7 @@ function generateFileSuggestions(args) {
|
|
|
23131
22319
|
return a.toLowerCase().localeCompare(b.toLowerCase());
|
|
23132
22320
|
}).slice(0, 25);
|
|
23133
22321
|
return entries.map((entry) => {
|
|
23134
|
-
const entryPath =
|
|
22322
|
+
const entryPath = join8(searchDir, entry);
|
|
23135
22323
|
const isDir = statSync11(entryPath).isDirectory();
|
|
23136
22324
|
const icon = isDir ? "\u{1F4C1}" : "\u{1F4C4}";
|
|
23137
22325
|
let value;
|
|
@@ -24423,7 +23611,7 @@ function useUnifiedCompletion({
|
|
|
24423
23611
|
disableSlashCommands = false,
|
|
24424
23612
|
onSubmit
|
|
24425
23613
|
}) {
|
|
24426
|
-
const [state, setState] =
|
|
23614
|
+
const [state, setState] = useState23(INITIAL_STATE);
|
|
24427
23615
|
const updateState = useCallback12((updates) => {
|
|
24428
23616
|
setState((prev) => ({ ...prev, ...updates }));
|
|
24429
23617
|
}, []);
|
|
@@ -24459,8 +23647,8 @@ function useUnifiedCompletion({
|
|
|
24459
23647
|
disableSlashCommands
|
|
24460
23648
|
});
|
|
24461
23649
|
}, [input, cursorOffset, disableSlashCommands]);
|
|
24462
|
-
const [systemCommands, setSystemCommands] =
|
|
24463
|
-
const [isLoadingCommands, setIsLoadingCommands] =
|
|
23650
|
+
const [systemCommands, setSystemCommands] = useState23([]);
|
|
23651
|
+
const [isLoadingCommands, setIsLoadingCommands] = useState23(false);
|
|
24464
23652
|
const loadSystemCommands = useCallback12(async () => {
|
|
24465
23653
|
if (systemCommands.length > 0 || isLoadingCommands) return;
|
|
24466
23654
|
setIsLoadingCommands(true);
|
|
@@ -24500,16 +23688,16 @@ function useUnifiedCompletion({
|
|
|
24500
23688
|
setIsLoadingCommands(false);
|
|
24501
23689
|
}
|
|
24502
23690
|
}, [systemCommands.length, isLoadingCommands]);
|
|
24503
|
-
|
|
23691
|
+
useEffect20(() => {
|
|
24504
23692
|
loadSystemCommands();
|
|
24505
23693
|
}, [loadSystemCommands]);
|
|
24506
|
-
const [agentSuggestions, setAgentSuggestions] =
|
|
23694
|
+
const [agentSuggestions, setAgentSuggestions] = useState23(
|
|
24507
23695
|
[]
|
|
24508
23696
|
);
|
|
24509
|
-
const [modelSuggestions, setModelSuggestions] =
|
|
23697
|
+
const [modelSuggestions, setModelSuggestions] = useState23(
|
|
24510
23698
|
[]
|
|
24511
23699
|
);
|
|
24512
|
-
|
|
23700
|
+
useEffect20(() => {
|
|
24513
23701
|
try {
|
|
24514
23702
|
const modelManager = getModelManager();
|
|
24515
23703
|
const allModels = modelManager.getAllAvailableModelNames();
|
|
@@ -24531,7 +23719,7 @@ function useUnifiedCompletion({
|
|
|
24531
23719
|
setModelSuggestions([]);
|
|
24532
23720
|
}
|
|
24533
23721
|
}, []);
|
|
24534
|
-
|
|
23722
|
+
useEffect20(() => {
|
|
24535
23723
|
getActiveAgents().then((agents) => {
|
|
24536
23724
|
const suggestions2 = agents.map((config2) => {
|
|
24537
23725
|
let shortDesc = config2.whenToUse;
|
|
@@ -24665,7 +23853,7 @@ function useUnifiedCompletion({
|
|
|
24665
23853
|
},
|
|
24666
23854
|
[input, onInputChange, setCursorOffset]
|
|
24667
23855
|
);
|
|
24668
|
-
|
|
23856
|
+
useInput24((input_str, key) => {
|
|
24669
23857
|
if (!__shouldHandleUnifiedCompletionTabKeyForTests(key)) return false;
|
|
24670
23858
|
const context = getWordAtCursor();
|
|
24671
23859
|
if (!context) return false;
|
|
@@ -24738,7 +23926,7 @@ function useUnifiedCompletion({
|
|
|
24738
23926
|
return true;
|
|
24739
23927
|
}
|
|
24740
23928
|
});
|
|
24741
|
-
|
|
23929
|
+
useInput24((inputChar, key) => {
|
|
24742
23930
|
if (key.return && !key.shift && !key.meta && state.isActive && state.suggestions.length > 0) {
|
|
24743
23931
|
const selectedSuggestion = state.suggestions[state.selectedIndex];
|
|
24744
23932
|
if (selectedSuggestion && state.context) {
|
|
@@ -24855,7 +24043,7 @@ function useUnifiedCompletion({
|
|
|
24855
24043
|
}
|
|
24856
24044
|
return false;
|
|
24857
24045
|
});
|
|
24858
|
-
|
|
24046
|
+
useInput24((input_str, key) => {
|
|
24859
24047
|
if (key.backspace || key.delete) {
|
|
24860
24048
|
if (state.isActive) {
|
|
24861
24049
|
resetCompletion();
|
|
@@ -24869,7 +24057,7 @@ function useUnifiedCompletion({
|
|
|
24869
24057
|
return false;
|
|
24870
24058
|
});
|
|
24871
24059
|
const lastInputRef = useRef9("");
|
|
24872
|
-
|
|
24060
|
+
useEffect20(() => {
|
|
24873
24061
|
if (lastInputRef.current === input) return;
|
|
24874
24062
|
const inputLengthChange = Math.abs(
|
|
24875
24063
|
input.length - lastInputRef.current.length
|
|
@@ -24963,7 +24151,7 @@ function __shouldHandleUnifiedCompletionTabKeyForTests(key) {
|
|
|
24963
24151
|
}
|
|
24964
24152
|
|
|
24965
24153
|
// src/ui/components/PromptInput.tsx
|
|
24966
|
-
import { memo, useCallback as useCallback13, useEffect as
|
|
24154
|
+
import { memo, useCallback as useCallback13, useEffect as useEffect22, useMemo as useMemo24, useState as useState25 } from "react";
|
|
24967
24155
|
|
|
24968
24156
|
// src/utils/model/tokens.ts
|
|
24969
24157
|
function countTokens(messages) {
|
|
@@ -24980,8 +24168,8 @@ function countTokens(messages) {
|
|
|
24980
24168
|
}
|
|
24981
24169
|
|
|
24982
24170
|
// src/ui/components/SentryErrorBoundary.ts
|
|
24983
|
-
import * as
|
|
24984
|
-
var SentryErrorBoundary = class extends
|
|
24171
|
+
import * as React89 from "react";
|
|
24172
|
+
var SentryErrorBoundary = class extends React89.Component {
|
|
24985
24173
|
constructor(props) {
|
|
24986
24174
|
super(props);
|
|
24987
24175
|
this.state = { hasError: false };
|
|
@@ -25004,8 +24192,8 @@ var SentryErrorBoundary = class extends React93.Component {
|
|
|
25004
24192
|
};
|
|
25005
24193
|
|
|
25006
24194
|
// src/ui/components/TokenWarning.tsx
|
|
25007
|
-
import { Box as
|
|
25008
|
-
import * as
|
|
24195
|
+
import { Box as Box67, Text as Text72 } from "ink";
|
|
24196
|
+
import * as React90 from "react";
|
|
25009
24197
|
var MAX_TOKENS = 19e4;
|
|
25010
24198
|
var WARNING_THRESHOLD = MAX_TOKENS * 0.6;
|
|
25011
24199
|
var ERROR_THRESHOLD = MAX_TOKENS * 0.8;
|
|
@@ -25015,12 +24203,149 @@ function TokenWarning({ tokenUsage }) {
|
|
|
25015
24203
|
return null;
|
|
25016
24204
|
}
|
|
25017
24205
|
const isError = tokenUsage >= ERROR_THRESHOLD;
|
|
25018
|
-
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
|
+
}
|
|
25019
24344
|
}
|
|
25020
24345
|
|
|
25021
24346
|
// src/utils/commands/hashCommand.ts
|
|
25022
24347
|
import { join as join10 } from "path";
|
|
25023
|
-
import { readFileSync as readFileSync10, writeFileSync as
|
|
24348
|
+
import { readFileSync as readFileSync10, writeFileSync as writeFileSync5 } from "fs";
|
|
25024
24349
|
function handleHashCommand(interpreted) {
|
|
25025
24350
|
try {
|
|
25026
24351
|
const cwd = process.cwd();
|
|
@@ -25049,7 +24374,7 @@ _Added on ${now.toLocaleString()} ${timezone}_`;
|
|
|
25049
24374
|
}
|
|
25050
24375
|
const separator = existingContent ? "\n\n" : "";
|
|
25051
24376
|
const newContent = `${existingContent}${separator}${interpreted}${timestamp}`;
|
|
25052
|
-
|
|
24377
|
+
writeFileSync5(file.path, newContent, "utf-8");
|
|
25053
24378
|
updatedFiles.push(file.name);
|
|
25054
24379
|
} catch (error) {
|
|
25055
24380
|
logError(error);
|
|
@@ -25061,8 +24386,8 @@ _Added on ${now.toLocaleString()} ${timezone}_`;
|
|
|
25061
24386
|
}
|
|
25062
24387
|
|
|
25063
24388
|
// src/ui/components/ModeIndicator.tsx
|
|
25064
|
-
import
|
|
25065
|
-
import { Box as
|
|
24389
|
+
import React91 from "react";
|
|
24390
|
+
import { Box as Box68, Text as Text73 } from "ink";
|
|
25066
24391
|
function __getModeIndicatorDisplayForTests(args) {
|
|
25067
24392
|
if (args.mode === "default") {
|
|
25068
24393
|
return {
|
|
@@ -25133,7 +24458,7 @@ function CompactModeIndicator() {
|
|
|
25133
24458
|
shortcutDisplayText: shortcut.displayText,
|
|
25134
24459
|
theme
|
|
25135
24460
|
});
|
|
25136
|
-
return /* @__PURE__ */
|
|
24461
|
+
return /* @__PURE__ */ React91.createElement(Text73, { color: indicator.color }, indicator.mainText, /* @__PURE__ */ React91.createElement(Text73, { dimColor: true }, indicator.shortcutHintText));
|
|
25137
24462
|
}
|
|
25138
24463
|
|
|
25139
24464
|
// src/utils/terminal/promptInputSpecialKey.ts
|
|
@@ -25170,7 +24495,7 @@ function logStartupProfile(event) {
|
|
|
25170
24495
|
}
|
|
25171
24496
|
|
|
25172
24497
|
// src/ui/hooks/useStatusLine.ts
|
|
25173
|
-
import { useEffect as
|
|
24498
|
+
import { useEffect as useEffect21, useRef as useRef10, useState as useState24 } from "react";
|
|
25174
24499
|
|
|
25175
24500
|
// src/services/ui/statusline.ts
|
|
25176
24501
|
import { join as join11 } from "path";
|
|
@@ -25212,12 +24537,12 @@ function normalizeStatusLineText(value) {
|
|
|
25212
24537
|
return singleLine.length > 300 ? `${singleLine.slice(0, 300)}\u2026` : singleLine;
|
|
25213
24538
|
}
|
|
25214
24539
|
function useStatusLine() {
|
|
25215
|
-
const [text, setText] =
|
|
24540
|
+
const [text, setText] = useState24(null);
|
|
25216
24541
|
const lastCommandRef = useRef10(null);
|
|
25217
24542
|
const abortRef = useRef10(null);
|
|
25218
24543
|
const configDir = process.env.PYB_CONFIG_DIR ?? process.env.CLAUDE_CONFIG_DIR;
|
|
25219
24544
|
const homeDir = typeof process.env.HOME === "string" ? process.env.HOME : typeof process.env.USERPROFILE === "string" ? process.env.USERPROFILE : void 0;
|
|
25220
|
-
|
|
24545
|
+
useEffect21(() => {
|
|
25221
24546
|
const enabled = process.env.PYB_STATUSLINE_ENABLED === "1" || process.env.NODE_ENV !== "test";
|
|
25222
24547
|
if (!enabled) return;
|
|
25223
24548
|
const shell = BunShell.getInstance();
|
|
@@ -25260,7 +24585,7 @@ function useStatusLine() {
|
|
|
25260
24585
|
// src/ui/components/PromptInput.tsx
|
|
25261
24586
|
async function interpretHashCommand(input) {
|
|
25262
24587
|
try {
|
|
25263
|
-
const { queryQuick: queryQuick2 } = await import("./llm-
|
|
24588
|
+
const { queryQuick: queryQuick2 } = await import("./llm-A3S75CLF.js");
|
|
25264
24589
|
const systemPrompt = [
|
|
25265
24590
|
"You're helping the user structure notes that will be added to their PYB.md file.",
|
|
25266
24591
|
"Format the user's input into a well-structured note that will be useful for later reference.",
|
|
@@ -25313,36 +24638,36 @@ function PromptInput({
|
|
|
25313
24638
|
readFileTimestamps,
|
|
25314
24639
|
onModelChange
|
|
25315
24640
|
}) {
|
|
25316
|
-
|
|
24641
|
+
useEffect22(() => {
|
|
25317
24642
|
if (!isDisabled && !isLoading) {
|
|
25318
24643
|
logStartupProfile("prompt_ready");
|
|
25319
24644
|
}
|
|
25320
24645
|
}, [isDisabled, isLoading]);
|
|
25321
|
-
const [exitMessage, setExitMessage] =
|
|
25322
|
-
const [rewindMessagePending, setRewindMessagePending] =
|
|
25323
|
-
const [message, setMessage] =
|
|
24646
|
+
const [exitMessage, setExitMessage] = useState25({ show: false });
|
|
24647
|
+
const [rewindMessagePending, setRewindMessagePending] = useState25(false);
|
|
24648
|
+
const [message, setMessage] = useState25({
|
|
25324
24649
|
show: false
|
|
25325
24650
|
});
|
|
25326
|
-
const [modelSwitchMessage, setModelSwitchMessage] =
|
|
24651
|
+
const [modelSwitchMessage, setModelSwitchMessage] = useState25({
|
|
25327
24652
|
show: false
|
|
25328
24653
|
});
|
|
25329
|
-
const [placeholder, setPlaceholder] =
|
|
25330
|
-
const [cursorOffset, setCursorOffset] =
|
|
25331
|
-
const [pastedTexts, setPastedTexts] =
|
|
25332
|
-
const [pastedImages, setPastedImages] =
|
|
25333
|
-
const [isEditingExternally, setIsEditingExternally] =
|
|
25334
|
-
const [currentPwd, setCurrentPwd] =
|
|
25335
|
-
const pastedTextCounter =
|
|
25336
|
-
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);
|
|
25337
24662
|
const { cycleMode, currentMode, toolPermissionContext } = usePermissionContext();
|
|
25338
|
-
const modeCycleShortcut =
|
|
24663
|
+
const modeCycleShortcut = useMemo24(() => getPermissionModeCycleShortcut(), []);
|
|
25339
24664
|
const showQuickModelSwitchShortcut = modeCycleShortcut.displayText !== "alt+m";
|
|
25340
24665
|
const handleRewindConversation = useDoublePress(
|
|
25341
24666
|
setRewindMessagePending,
|
|
25342
24667
|
() => onShowMessageSelector()
|
|
25343
24668
|
);
|
|
25344
24669
|
const { columns, rows } = useTerminalSize();
|
|
25345
|
-
const commandWidth =
|
|
24670
|
+
const commandWidth = useMemo24(
|
|
25346
24671
|
() => Math.max(...commands.map((cmd) => cmd.userFacingName().length)) + 5,
|
|
25347
24672
|
[commands]
|
|
25348
24673
|
);
|
|
@@ -25362,19 +24687,19 @@ function PromptInput({
|
|
|
25362
24687
|
});
|
|
25363
24688
|
const theme = getTheme();
|
|
25364
24689
|
const statusLine = useStatusLine();
|
|
25365
|
-
const renderedSuggestions =
|
|
24690
|
+
const renderedSuggestions = useMemo24(() => {
|
|
25366
24691
|
if (suggestions.length === 0) return null;
|
|
25367
24692
|
return suggestions.map((suggestion, index) => {
|
|
25368
24693
|
const isSelected = index === selectedIndex;
|
|
25369
24694
|
const isAgent = suggestion.type === "agent";
|
|
25370
24695
|
const displayColor = isSelected ? theme.suggestion : isAgent && suggestion.metadata?.color ? suggestion.metadata.color : void 0;
|
|
25371
|
-
return /* @__PURE__ */
|
|
25372
|
-
|
|
24696
|
+
return /* @__PURE__ */ React92.createElement(
|
|
24697
|
+
Box69,
|
|
25373
24698
|
{
|
|
25374
24699
|
key: `${suggestion.type}-${suggestion.value}-${index}`,
|
|
25375
24700
|
flexDirection: "row"
|
|
25376
24701
|
},
|
|
25377
|
-
/* @__PURE__ */
|
|
24702
|
+
/* @__PURE__ */ React92.createElement(Text74, { color: displayColor, dimColor: !isSelected && !displayColor }, isSelected ? "\u25C6 " : " ", suggestion.displayValue)
|
|
25378
24703
|
);
|
|
25379
24704
|
});
|
|
25380
24705
|
}, [suggestions, selectedIndex, theme.suggestion]);
|
|
@@ -25573,7 +24898,7 @@ function PromptInput({
|
|
|
25573
24898
|
if (messages2.length) {
|
|
25574
24899
|
if (mode === "bash") {
|
|
25575
24900
|
onQuery(messages2, newAbortController).then(async () => {
|
|
25576
|
-
const { getCwd: getCwd2 } = await import("./state-
|
|
24901
|
+
const { getCwd: getCwd2 } = await import("./state-I7LIGIFJ.js");
|
|
25577
24902
|
setCurrentPwd(getCwd2());
|
|
25578
24903
|
});
|
|
25579
24904
|
} else {
|
|
@@ -25619,11 +24944,11 @@ function PromptInput({
|
|
|
25619
24944
|
setCursorOffset(cursorOffset + pastedPrompt.length);
|
|
25620
24945
|
setPastedTexts((prev) => [...prev, { placeholder: pastedPrompt, text }]);
|
|
25621
24946
|
}
|
|
25622
|
-
|
|
24947
|
+
useEffect22(() => {
|
|
25623
24948
|
setPastedTexts((prev) => prev.filter((p) => input.includes(p.placeholder)));
|
|
25624
24949
|
setPastedImages((prev) => prev.filter((p) => input.includes(p.placeholder)));
|
|
25625
24950
|
}, [input]);
|
|
25626
|
-
|
|
24951
|
+
useInput25(
|
|
25627
24952
|
(inputChar, key) => {
|
|
25628
24953
|
if (mode === "bash" && (key.backspace || key.delete)) {
|
|
25629
24954
|
if (input === "") {
|
|
@@ -25712,10 +25037,10 @@ function PromptInput({
|
|
|
25712
25037
|
]
|
|
25713
25038
|
);
|
|
25714
25039
|
const textInputColumns = columns - 6;
|
|
25715
|
-
const tokenUsage =
|
|
25040
|
+
const tokenUsage = useMemo24(() => countTokens(messages), [messages]);
|
|
25716
25041
|
const modelManager = getModelManager();
|
|
25717
25042
|
const currentModelId = modelManager.getModel("main")?.id || null;
|
|
25718
|
-
const modelInfo =
|
|
25043
|
+
const modelInfo = useMemo24(() => {
|
|
25719
25044
|
const freshModelManager = getModelManager();
|
|
25720
25045
|
const currentModel = freshModelManager.getModel("main");
|
|
25721
25046
|
if (!currentModel) {
|
|
@@ -25729,17 +25054,17 @@ function PromptInput({
|
|
|
25729
25054
|
currentTokens: tokenUsage
|
|
25730
25055
|
};
|
|
25731
25056
|
}, [tokenUsage, modelSwitchMessage.show, submitCount, currentModelId]);
|
|
25732
|
-
return /* @__PURE__ */
|
|
25733
|
-
|
|
25057
|
+
return /* @__PURE__ */ React92.createElement(Box69, { flexDirection: "column" }, (mode === "bash" || modelInfo) && /* @__PURE__ */ React92.createElement(
|
|
25058
|
+
Box69,
|
|
25734
25059
|
{
|
|
25735
25060
|
justifyContent: "space-between",
|
|
25736
25061
|
marginBottom: 1,
|
|
25737
25062
|
flexDirection: "row"
|
|
25738
25063
|
},
|
|
25739
|
-
mode === "bash" ? /* @__PURE__ */
|
|
25740
|
-
modelInfo && /* @__PURE__ */
|
|
25741
|
-
), /* @__PURE__ */
|
|
25742
|
-
|
|
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,
|
|
25743
25068
|
{
|
|
25744
25069
|
alignItems: "flex-start",
|
|
25745
25070
|
justifyContent: "flex-start",
|
|
@@ -25753,8 +25078,8 @@ function PromptInput({
|
|
|
25753
25078
|
marginTop: 1,
|
|
25754
25079
|
width: "100%"
|
|
25755
25080
|
},
|
|
25756
|
-
/* @__PURE__ */
|
|
25757
|
-
|
|
25081
|
+
/* @__PURE__ */ React92.createElement(
|
|
25082
|
+
Box69,
|
|
25758
25083
|
{
|
|
25759
25084
|
alignItems: "flex-start",
|
|
25760
25085
|
alignSelf: "flex-start",
|
|
@@ -25762,9 +25087,9 @@ function PromptInput({
|
|
|
25762
25087
|
justifyContent: "flex-start",
|
|
25763
25088
|
width: 3
|
|
25764
25089
|
},
|
|
25765
|
-
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")
|
|
25766
25091
|
),
|
|
25767
|
-
/* @__PURE__ */
|
|
25092
|
+
/* @__PURE__ */ React92.createElement(Box69, { paddingRight: 1 }, /* @__PURE__ */ React92.createElement(
|
|
25768
25093
|
TextInput,
|
|
25769
25094
|
{
|
|
25770
25095
|
multiline: true,
|
|
@@ -25789,44 +25114,44 @@ function PromptInput({
|
|
|
25789
25114
|
onSpecialKey: handleSpecialKey
|
|
25790
25115
|
}
|
|
25791
25116
|
))
|
|
25792
|
-
), !completionActive && suggestions.length === 0 && /* @__PURE__ */
|
|
25793
|
-
|
|
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,
|
|
25794
25119
|
{
|
|
25795
25120
|
color: mode === "bash" ? theme.bashBorder : void 0,
|
|
25796
25121
|
dimColor: mode !== "bash"
|
|
25797
25122
|
},
|
|
25798
25123
|
"! run some shell command"
|
|
25799
|
-
), /* @__PURE__ */
|
|
25800
|
-
|
|
25124
|
+
), /* @__PURE__ */ React92.createElement(Text74, { dimColor: true }, " \xB7 / for commands"), /* @__PURE__ */ React92.createElement(
|
|
25125
|
+
Text74,
|
|
25801
25126
|
{
|
|
25802
25127
|
color: mode === "pyb" ? theme.noting : void 0,
|
|
25803
25128
|
dimColor: mode !== "pyb"
|
|
25804
25129
|
},
|
|
25805
25130
|
" ",
|
|
25806
25131
|
"\xB7 # tell agent something to remember forever"
|
|
25807
|
-
))), /* @__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(
|
|
25808
25133
|
SentryErrorBoundary,
|
|
25809
25134
|
{
|
|
25810
|
-
children: /* @__PURE__ */
|
|
25135
|
+
children: /* @__PURE__ */ React92.createElement(Box69, { justifyContent: "flex-end", gap: 1 }, /* @__PURE__ */ React92.createElement(TokenWarning, { tokenUsage }))
|
|
25811
25136
|
}
|
|
25812
|
-
))), suggestions.length > 0 && /* @__PURE__ */
|
|
25813
|
-
|
|
25137
|
+
))), suggestions.length > 0 && /* @__PURE__ */ React92.createElement(
|
|
25138
|
+
Box69,
|
|
25814
25139
|
{
|
|
25815
25140
|
flexDirection: "row",
|
|
25816
25141
|
justifyContent: "space-between",
|
|
25817
25142
|
paddingX: 2,
|
|
25818
25143
|
paddingY: 0
|
|
25819
25144
|
},
|
|
25820
|
-
/* @__PURE__ */
|
|
25821
|
-
|
|
25145
|
+
/* @__PURE__ */ React92.createElement(Box69, { flexDirection: "column" }, renderedSuggestions, /* @__PURE__ */ React92.createElement(
|
|
25146
|
+
Box69,
|
|
25822
25147
|
{
|
|
25823
25148
|
marginTop: 1,
|
|
25824
25149
|
paddingX: 3,
|
|
25825
25150
|
borderStyle: "round",
|
|
25826
25151
|
borderColor: "gray"
|
|
25827
25152
|
},
|
|
25828
|
-
/* @__PURE__ */
|
|
25829
|
-
|
|
25153
|
+
/* @__PURE__ */ React92.createElement(
|
|
25154
|
+
Text74,
|
|
25830
25155
|
{
|
|
25831
25156
|
dimColor: !emptyDirMessage,
|
|
25832
25157
|
color: emptyDirMessage ? "yellow" : void 0
|
|
@@ -25846,10 +25171,10 @@ function PromptInput({
|
|
|
25846
25171
|
})()
|
|
25847
25172
|
)
|
|
25848
25173
|
)),
|
|
25849
|
-
/* @__PURE__ */
|
|
25174
|
+
/* @__PURE__ */ React92.createElement(
|
|
25850
25175
|
SentryErrorBoundary,
|
|
25851
25176
|
{
|
|
25852
|
-
children: /* @__PURE__ */
|
|
25177
|
+
children: /* @__PURE__ */ React92.createElement(Box69, { justifyContent: "flex-end", gap: 1 }, /* @__PURE__ */ React92.createElement(TokenWarning, { tokenUsage: countTokens(messages) }))
|
|
25853
25178
|
}
|
|
25854
25179
|
)
|
|
25855
25180
|
));
|
|
@@ -25861,9 +25186,9 @@ function exit() {
|
|
|
25861
25186
|
}
|
|
25862
25187
|
|
|
25863
25188
|
// src/ui/hooks/useCostSummary.ts
|
|
25864
|
-
import { useEffect as
|
|
25189
|
+
import { useEffect as useEffect23 } from "react";
|
|
25865
25190
|
function useCostSummary() {
|
|
25866
|
-
|
|
25191
|
+
useEffect23(() => {
|
|
25867
25192
|
const onExit = () => {
|
|
25868
25193
|
process.stdout.write("\n" + formatTotalCost() + "\n");
|
|
25869
25194
|
const projectConfig = getCurrentProjectConfig();
|
|
@@ -25903,9 +25228,9 @@ function useApiKeyVerification() {
|
|
|
25903
25228
|
}
|
|
25904
25229
|
|
|
25905
25230
|
// src/ui/hooks/useCancelRequest.ts
|
|
25906
|
-
import { useInput as
|
|
25231
|
+
import { useInput as useInput26 } from "ink";
|
|
25907
25232
|
function useCancelRequest(setToolJSX, setToolUseConfirm, setBinaryFeedbackContext, onCancel, isLoading, isMessageSelectorVisible, abortSignal) {
|
|
25908
|
-
|
|
25233
|
+
useInput26((_, key) => {
|
|
25909
25234
|
if (!key.escape) {
|
|
25910
25235
|
return;
|
|
25911
25236
|
}
|
|
@@ -25966,7 +25291,7 @@ function useCanUseTool(setToolUseConfirm) {
|
|
|
25966
25291
|
const [description3, commandPrefix] = await Promise.all([
|
|
25967
25292
|
typeof tool.description === "function" ? tool.description(input) : Promise.resolve(tool.description ?? `Tool: ${tool.name}`),
|
|
25968
25293
|
tool === BashTool ? getCommandSubcommandPrefix(
|
|
25969
|
-
|
|
25294
|
+
inputSchema11.parse(input).command,
|
|
25970
25295
|
toolUseContext.abortController.signal
|
|
25971
25296
|
) : Promise.resolve(null)
|
|
25972
25297
|
]);
|
|
@@ -26014,9 +25339,9 @@ function useCanUseTool(setToolUseConfirm) {
|
|
|
26014
25339
|
var useCanUseTool_default = useCanUseTool;
|
|
26015
25340
|
|
|
26016
25341
|
// src/ui/hooks/useLogMessages.ts
|
|
26017
|
-
import { useEffect as
|
|
25342
|
+
import { useEffect as useEffect24 } from "react";
|
|
26018
25343
|
function useLogMessages(messages, messageLogName, forkNumber) {
|
|
26019
|
-
|
|
25344
|
+
useEffect24(() => {
|
|
26020
25345
|
overwriteLog(
|
|
26021
25346
|
getMessagesPath(messageLogName, forkNumber, 0),
|
|
26022
25347
|
messages.filter((_) => _.type !== "progress"),
|
|
@@ -27651,17 +26976,17 @@ function createErrorToolResultBlock(args) {
|
|
|
27651
26976
|
}
|
|
27652
26977
|
|
|
27653
26978
|
// src/ui/components/binary-feedback/BinaryFeedback.tsx
|
|
27654
|
-
import { default as
|
|
26979
|
+
import { default as React96, useCallback as useCallback15 } from "react";
|
|
27655
26980
|
|
|
27656
26981
|
// src/ui/components/binary-feedback/BinaryFeedbackView.tsx
|
|
27657
26982
|
import chalk14 from "chalk";
|
|
27658
|
-
import { Box as
|
|
26983
|
+
import { Box as Box71, Text as Text75, useInput as useInput27 } from "ink";
|
|
27659
26984
|
import Link2 from "ink-link";
|
|
27660
|
-
import
|
|
26985
|
+
import React95, { useState as useState26 } from "react";
|
|
27661
26986
|
|
|
27662
26987
|
// src/ui/components/binary-feedback/BinaryFeedbackOption.tsx
|
|
27663
|
-
import * as
|
|
27664
|
-
import { Box as
|
|
26988
|
+
import * as React94 from "react";
|
|
26989
|
+
import { Box as Box70 } from "ink";
|
|
27665
26990
|
function BinaryFeedbackOption({
|
|
27666
26991
|
debug: debug2,
|
|
27667
26992
|
erroredToolUseIDs,
|
|
@@ -27673,7 +26998,7 @@ function BinaryFeedbackOption({
|
|
|
27673
26998
|
verbose
|
|
27674
26999
|
}) {
|
|
27675
27000
|
const { columns } = useTerminalSize();
|
|
27676
|
-
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(
|
|
27677
27002
|
Message,
|
|
27678
27003
|
{
|
|
27679
27004
|
addMargin: false,
|
|
@@ -27689,7 +27014,7 @@ function BinaryFeedbackOption({
|
|
|
27689
27014
|
verbose,
|
|
27690
27015
|
width: columns / 2 - 6
|
|
27691
27016
|
}
|
|
27692
|
-
), /* @__PURE__ */
|
|
27017
|
+
), /* @__PURE__ */ React94.createElement(AdditionalContext, { message: _, verbose })));
|
|
27693
27018
|
}
|
|
27694
27019
|
function AdditionalContext({
|
|
27695
27020
|
message,
|
|
@@ -27721,7 +27046,7 @@ function AdditionalContext({
|
|
|
27721
27046
|
} catch {
|
|
27722
27047
|
return null;
|
|
27723
27048
|
}
|
|
27724
|
-
return /* @__PURE__ */
|
|
27049
|
+
return /* @__PURE__ */ React94.createElement(
|
|
27725
27050
|
FileEditToolDiff,
|
|
27726
27051
|
{
|
|
27727
27052
|
file_path: input.data.file_path,
|
|
@@ -27737,7 +27062,7 @@ function AdditionalContext({
|
|
|
27737
27062
|
if (!input.success) {
|
|
27738
27063
|
return null;
|
|
27739
27064
|
}
|
|
27740
|
-
return /* @__PURE__ */
|
|
27065
|
+
return /* @__PURE__ */ React94.createElement(
|
|
27741
27066
|
FileWriteToolDiff,
|
|
27742
27067
|
{
|
|
27743
27068
|
file_path: input.data.file_path,
|
|
@@ -27790,10 +27115,10 @@ function BinaryFeedbackView({
|
|
|
27790
27115
|
verbose
|
|
27791
27116
|
}) {
|
|
27792
27117
|
const theme = getTheme();
|
|
27793
|
-
const [focused, setFocus] =
|
|
27794
|
-
const [focusValue, setFocusValue] =
|
|
27118
|
+
const [focused, setFocus] = useState26("no-preference");
|
|
27119
|
+
const [focusValue, setFocusValue] = useState26(void 0);
|
|
27795
27120
|
const exitState = useExitOnCtrlCD(() => process.exit(1));
|
|
27796
|
-
|
|
27121
|
+
useInput27((_input, key) => {
|
|
27797
27122
|
if (key.leftArrow) {
|
|
27798
27123
|
setFocusValue("prefer-left");
|
|
27799
27124
|
} else if (key.rightArrow) {
|
|
@@ -27802,8 +27127,8 @@ function BinaryFeedbackView({
|
|
|
27802
27127
|
onChoose?.("neither");
|
|
27803
27128
|
}
|
|
27804
27129
|
});
|
|
27805
|
-
return /* @__PURE__ */
|
|
27806
|
-
|
|
27130
|
+
return /* @__PURE__ */ React95.createElement(React95.Fragment, null, /* @__PURE__ */ React95.createElement(
|
|
27131
|
+
Box71,
|
|
27807
27132
|
{
|
|
27808
27133
|
flexDirection: "column",
|
|
27809
27134
|
height: "100%",
|
|
@@ -27811,9 +27136,9 @@ function BinaryFeedbackView({
|
|
|
27811
27136
|
borderStyle: "round",
|
|
27812
27137
|
borderColor: theme.permission
|
|
27813
27138
|
},
|
|
27814
|
-
/* @__PURE__ */
|
|
27815
|
-
/* @__PURE__ */
|
|
27816
|
-
|
|
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,
|
|
27817
27142
|
{
|
|
27818
27143
|
flexDirection: "column",
|
|
27819
27144
|
flexGrow: 1,
|
|
@@ -27824,7 +27149,7 @@ function BinaryFeedbackView({
|
|
|
27824
27149
|
marginRight: 1,
|
|
27825
27150
|
padding: 1
|
|
27826
27151
|
},
|
|
27827
|
-
/* @__PURE__ */
|
|
27152
|
+
/* @__PURE__ */ React95.createElement(
|
|
27828
27153
|
BinaryFeedbackOption,
|
|
27829
27154
|
{
|
|
27830
27155
|
erroredToolUseIDs,
|
|
@@ -27837,8 +27162,8 @@ function BinaryFeedbackView({
|
|
|
27837
27162
|
verbose
|
|
27838
27163
|
}
|
|
27839
27164
|
)
|
|
27840
|
-
), /* @__PURE__ */
|
|
27841
|
-
|
|
27165
|
+
), /* @__PURE__ */ React95.createElement(
|
|
27166
|
+
Box71,
|
|
27842
27167
|
{
|
|
27843
27168
|
flexDirection: "column",
|
|
27844
27169
|
flexGrow: 1,
|
|
@@ -27849,7 +27174,7 @@ function BinaryFeedbackView({
|
|
|
27849
27174
|
marginLeft: 1,
|
|
27850
27175
|
padding: 1
|
|
27851
27176
|
},
|
|
27852
|
-
/* @__PURE__ */
|
|
27177
|
+
/* @__PURE__ */ React95.createElement(
|
|
27853
27178
|
BinaryFeedbackOption,
|
|
27854
27179
|
{
|
|
27855
27180
|
erroredToolUseIDs,
|
|
@@ -27863,7 +27188,7 @@ function BinaryFeedbackView({
|
|
|
27863
27188
|
}
|
|
27864
27189
|
)
|
|
27865
27190
|
)),
|
|
27866
|
-
/* @__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(
|
|
27867
27192
|
Select,
|
|
27868
27193
|
{
|
|
27869
27194
|
options: getOptions2(),
|
|
@@ -27872,7 +27197,7 @@ function BinaryFeedbackView({
|
|
|
27872
27197
|
onChange: onChoose
|
|
27873
27198
|
}
|
|
27874
27199
|
))
|
|
27875
|
-
), 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, " "));
|
|
27876
27201
|
}
|
|
27877
27202
|
|
|
27878
27203
|
// src/ui/components/binary-feedback/BinaryFeedback.tsx
|
|
@@ -27898,7 +27223,7 @@ function BinaryFeedback({
|
|
|
27898
27223
|
useNotifyAfterTimeout(
|
|
27899
27224
|
`${PRODUCT_NAME} needs your input on a response comparison`
|
|
27900
27225
|
);
|
|
27901
|
-
return /* @__PURE__ */
|
|
27226
|
+
return /* @__PURE__ */ React96.createElement(
|
|
27902
27227
|
BinaryFeedbackView,
|
|
27903
27228
|
{
|
|
27904
27229
|
debug: debug2,
|
|
@@ -27987,36 +27312,36 @@ function REPL({
|
|
|
27987
27312
|
initialUpdateCommands,
|
|
27988
27313
|
autoExit
|
|
27989
27314
|
}) {
|
|
27990
|
-
const [verboseConfig] =
|
|
27315
|
+
const [verboseConfig] = useState27(
|
|
27991
27316
|
() => verboseFromCLI ?? getGlobalConfig().verbose
|
|
27992
27317
|
);
|
|
27993
27318
|
const verbose = verboseConfig;
|
|
27994
|
-
const [forkNumber, setForkNumber] =
|
|
27319
|
+
const [forkNumber, setForkNumber] = useState27(
|
|
27995
27320
|
getNextAvailableLogForkNumber(messageLogName, initialForkNumber, 0)
|
|
27996
27321
|
);
|
|
27997
|
-
const [uiRefreshCounter, setUiRefreshCounter] =
|
|
27322
|
+
const [uiRefreshCounter, setUiRefreshCounter] = useState27(0);
|
|
27998
27323
|
const [
|
|
27999
27324
|
forkConvoWithMessagesOnTheNextRender,
|
|
28000
27325
|
setForkConvoWithMessagesOnTheNextRender
|
|
28001
|
-
] =
|
|
28002
|
-
const [abortController, setAbortController] =
|
|
28003
|
-
const [isLoading, setIsLoading] =
|
|
28004
|
-
const [toolJSX, setToolJSX] =
|
|
28005
|
-
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(
|
|
28006
27331
|
null
|
|
28007
27332
|
);
|
|
28008
|
-
const [messages, setMessages2] =
|
|
28009
|
-
const [inputValue, setInputValue] =
|
|
28010
|
-
const [inputMode, setInputMode] =
|
|
27333
|
+
const [messages, setMessages2] = useState27(initialMessages ?? []);
|
|
27334
|
+
const [inputValue, setInputValue] = useState27("");
|
|
27335
|
+
const [inputMode, setInputMode] = useState27(
|
|
28011
27336
|
"prompt"
|
|
28012
27337
|
);
|
|
28013
|
-
const [submitCount, setSubmitCount] =
|
|
28014
|
-
const [isMessageSelectorVisible, setIsMessageSelectorVisible] =
|
|
28015
|
-
const [showCostDialog, setShowCostDialog] =
|
|
28016
|
-
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(
|
|
28017
27342
|
getGlobalConfig().hasAcknowledgedCostThreshold
|
|
28018
27343
|
);
|
|
28019
|
-
const [binaryFeedbackContext, setBinaryFeedbackContext] =
|
|
27344
|
+
const [binaryFeedbackContext, setBinaryFeedbackContext] = useState27(null);
|
|
28020
27345
|
const updateAvailableVersion = initialUpdateVersion ?? null;
|
|
28021
27346
|
const updateCommands = initialUpdateCommands ?? null;
|
|
28022
27347
|
const getBinaryFeedbackResponse = useCallback16(
|
|
@@ -28053,20 +27378,20 @@ function REPL({
|
|
|
28053
27378
|
isMessageSelectorVisible,
|
|
28054
27379
|
abortController?.signal
|
|
28055
27380
|
);
|
|
28056
|
-
|
|
27381
|
+
useEffect25(() => {
|
|
28057
27382
|
if (forkConvoWithMessagesOnTheNextRender) {
|
|
28058
27383
|
setForkNumber((_) => _ + 1);
|
|
28059
27384
|
setForkConvoWithMessagesOnTheNextRender(null);
|
|
28060
27385
|
setMessages2(forkConvoWithMessagesOnTheNextRender);
|
|
28061
27386
|
}
|
|
28062
27387
|
}, [forkConvoWithMessagesOnTheNextRender]);
|
|
28063
|
-
|
|
27388
|
+
useEffect25(() => {
|
|
28064
27389
|
const totalCost = getTotalCost();
|
|
28065
27390
|
if (totalCost >= 5 && !showCostDialog && !haveShownCostDialog) {
|
|
28066
27391
|
setShowCostDialog(true);
|
|
28067
27392
|
}
|
|
28068
27393
|
}, [messages, showCostDialog, haveShownCostDialog]);
|
|
28069
|
-
|
|
27394
|
+
useEffect25(() => {
|
|
28070
27395
|
if (autoExit && !isLoading) {
|
|
28071
27396
|
const tasks = listTasks({});
|
|
28072
27397
|
const hasTasks = tasks.length > 0;
|
|
@@ -28244,41 +27569,41 @@ function REPL({
|
|
|
28244
27569
|
setIsLoading(false);
|
|
28245
27570
|
}
|
|
28246
27571
|
useCostSummary();
|
|
28247
|
-
|
|
27572
|
+
useEffect25(() => {
|
|
28248
27573
|
const getMessages2 = () => messages;
|
|
28249
27574
|
setMessagesGetter(getMessages2);
|
|
28250
27575
|
setMessagesSetter(setMessages2);
|
|
28251
27576
|
}, [messages]);
|
|
28252
|
-
|
|
27577
|
+
useEffect25(() => {
|
|
28253
27578
|
setModelConfigChangeHandler(() => {
|
|
28254
27579
|
setUiRefreshCounter((prev) => prev + 1);
|
|
28255
27580
|
});
|
|
28256
27581
|
}, []);
|
|
28257
27582
|
useLogMessages(messages, messageLogName, forkNumber);
|
|
28258
27583
|
useLogStartupTime();
|
|
28259
|
-
|
|
27584
|
+
useEffect25(() => {
|
|
28260
27585
|
onInit();
|
|
28261
27586
|
}, []);
|
|
28262
|
-
const normalizedMessages =
|
|
27587
|
+
const normalizedMessages = useMemo25(
|
|
28263
27588
|
() => normalizeMessages(messages).filter(isNotEmptyMessage),
|
|
28264
27589
|
[messages]
|
|
28265
27590
|
);
|
|
28266
|
-
const displayMessages =
|
|
27591
|
+
const displayMessages = useMemo25(
|
|
28267
27592
|
() => filterProgressMessagesForTools(
|
|
28268
27593
|
normalizedMessages,
|
|
28269
27594
|
/* @__PURE__ */ new Set(["TaskCreate", "TaskUpdate", "TaskList", "TaskGet"])
|
|
28270
27595
|
),
|
|
28271
27596
|
[normalizedMessages]
|
|
28272
27597
|
);
|
|
28273
|
-
const unresolvedToolUseIDs =
|
|
27598
|
+
const unresolvedToolUseIDs = useMemo25(
|
|
28274
27599
|
() => getUnresolvedToolUseIDs(displayMessages),
|
|
28275
27600
|
[displayMessages]
|
|
28276
27601
|
);
|
|
28277
|
-
const inProgressToolUseIDs =
|
|
27602
|
+
const inProgressToolUseIDs = useMemo25(
|
|
28278
27603
|
() => getInProgressToolUseIDs(displayMessages),
|
|
28279
27604
|
[displayMessages]
|
|
28280
27605
|
);
|
|
28281
|
-
const erroredToolUseIDs =
|
|
27606
|
+
const erroredToolUseIDs = useMemo25(
|
|
28282
27607
|
() => new Set(
|
|
28283
27608
|
getErroredToolUseMessages(displayMessages).map(
|
|
28284
27609
|
(_) => _.message.content[0].id
|
|
@@ -28286,11 +27611,11 @@ function REPL({
|
|
|
28286
27611
|
),
|
|
28287
27612
|
[displayMessages]
|
|
28288
27613
|
);
|
|
28289
|
-
const orderedMessages =
|
|
27614
|
+
const orderedMessages = useMemo25(
|
|
28290
27615
|
() => reorderMessages(displayMessages),
|
|
28291
27616
|
[displayMessages]
|
|
28292
27617
|
);
|
|
28293
|
-
const replStaticPrefixLength =
|
|
27618
|
+
const replStaticPrefixLength = useMemo25(
|
|
28294
27619
|
() => getReplStaticPrefixLength(
|
|
28295
27620
|
orderedMessages,
|
|
28296
27621
|
normalizedMessages,
|
|
@@ -28298,10 +27623,10 @@ function REPL({
|
|
|
28298
27623
|
),
|
|
28299
27624
|
[orderedMessages, normalizedMessages, unresolvedToolUseIDs]
|
|
28300
27625
|
);
|
|
28301
|
-
const messagesJSX =
|
|
27626
|
+
const messagesJSX = useMemo25(() => {
|
|
28302
27627
|
return orderedMessages.map((_, index) => {
|
|
28303
27628
|
const toolUseID = getToolUseID(_);
|
|
28304
|
-
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(
|
|
28305
27630
|
Message,
|
|
28306
27631
|
{
|
|
28307
27632
|
message: _.content,
|
|
@@ -28316,10 +27641,10 @@ function REPL({
|
|
|
28316
27641
|
shouldAnimate: false,
|
|
28317
27642
|
shouldShowDot: false
|
|
28318
27643
|
}
|
|
28319
|
-
) : /* @__PURE__ */
|
|
27644
|
+
) : /* @__PURE__ */ React97.createElement(
|
|
28320
27645
|
MessageResponse,
|
|
28321
27646
|
{
|
|
28322
|
-
children: /* @__PURE__ */
|
|
27647
|
+
children: /* @__PURE__ */ React97.createElement(
|
|
28323
27648
|
Message,
|
|
28324
27649
|
{
|
|
28325
27650
|
message: _.content,
|
|
@@ -28338,7 +27663,7 @@ function REPL({
|
|
|
28338
27663
|
}
|
|
28339
27664
|
)
|
|
28340
27665
|
}
|
|
28341
|
-
) : /* @__PURE__ */
|
|
27666
|
+
) : /* @__PURE__ */ React97.createElement(
|
|
28342
27667
|
Message,
|
|
28343
27668
|
{
|
|
28344
27669
|
message: _,
|
|
@@ -28357,8 +27682,8 @@ function REPL({
|
|
|
28357
27682
|
const isInStaticPrefix = index < replStaticPrefixLength;
|
|
28358
27683
|
if (debug2) {
|
|
28359
27684
|
return {
|
|
28360
|
-
jsx: /* @__PURE__ */
|
|
28361
|
-
|
|
27685
|
+
jsx: /* @__PURE__ */ React97.createElement(
|
|
27686
|
+
Box72,
|
|
28362
27687
|
{
|
|
28363
27688
|
borderStyle: "single",
|
|
28364
27689
|
borderColor: isInStaticPrefix ? "green" : "red",
|
|
@@ -28370,7 +27695,7 @@ function REPL({
|
|
|
28370
27695
|
};
|
|
28371
27696
|
}
|
|
28372
27697
|
return {
|
|
28373
|
-
jsx: /* @__PURE__ */
|
|
27698
|
+
jsx: /* @__PURE__ */ React97.createElement(Box72, { key: _.uuid, width: "100%" }, message)
|
|
28374
27699
|
};
|
|
28375
27700
|
});
|
|
28376
27701
|
}, [
|
|
@@ -28390,10 +27715,10 @@ function REPL({
|
|
|
28390
27715
|
isDefaultModel,
|
|
28391
27716
|
replStaticPrefixLength
|
|
28392
27717
|
]);
|
|
28393
|
-
const staticItems =
|
|
27718
|
+
const staticItems = useMemo25(
|
|
28394
27719
|
() => [
|
|
28395
27720
|
{
|
|
28396
|
-
jsx: /* @__PURE__ */
|
|
27721
|
+
jsx: /* @__PURE__ */ React97.createElement(Box72, { flexDirection: "column", key: `logo${forkNumber}` }, /* @__PURE__ */ React97.createElement(
|
|
28397
27722
|
Logo,
|
|
28398
27723
|
{
|
|
28399
27724
|
mcpClients,
|
|
@@ -28401,7 +27726,7 @@ function REPL({
|
|
|
28401
27726
|
updateBannerVersion: updateAvailableVersion,
|
|
28402
27727
|
updateBannerCommands: updateCommands
|
|
28403
27728
|
}
|
|
28404
|
-
), /* @__PURE__ */
|
|
27729
|
+
), /* @__PURE__ */ React97.createElement(ProjectOnboarding, { workspaceDir: getOriginalCwd() }))
|
|
28405
27730
|
},
|
|
28406
27731
|
...messagesJSX.slice(0, replStaticPrefixLength)
|
|
28407
27732
|
],
|
|
@@ -28415,29 +27740,29 @@ function REPL({
|
|
|
28415
27740
|
updateCommands
|
|
28416
27741
|
]
|
|
28417
27742
|
);
|
|
28418
|
-
const transientItems =
|
|
27743
|
+
const transientItems = useMemo25(
|
|
28419
27744
|
() => messagesJSX.slice(replStaticPrefixLength),
|
|
28420
27745
|
[messagesJSX, replStaticPrefixLength]
|
|
28421
27746
|
);
|
|
28422
27747
|
const showingCostDialog = !isLoading && showCostDialog;
|
|
28423
27748
|
const conversationKey = `${messageLogName}:${forkNumber}`;
|
|
28424
|
-
return /* @__PURE__ */
|
|
27749
|
+
return /* @__PURE__ */ React97.createElement(
|
|
28425
27750
|
PermissionProvider,
|
|
28426
27751
|
{
|
|
28427
27752
|
conversationKey,
|
|
28428
27753
|
isBypassPermissionsModeAvailable: !safeMode
|
|
28429
27754
|
},
|
|
28430
|
-
/* @__PURE__ */
|
|
28431
|
-
|
|
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,
|
|
28432
27757
|
{
|
|
28433
27758
|
borderColor: "red",
|
|
28434
27759
|
borderStyle: debug2 ? "single" : void 0,
|
|
28435
27760
|
flexDirection: "column",
|
|
28436
27761
|
width: "100%"
|
|
28437
27762
|
},
|
|
28438
|
-
!toolJSX && !toolUseConfirm && !binaryFeedbackContext && isLoading && /* @__PURE__ */
|
|
27763
|
+
!toolJSX && !toolUseConfirm && !binaryFeedbackContext && isLoading && /* @__PURE__ */ React97.createElement(RequestStatusIndicator, null),
|
|
28439
27764
|
toolJSX ? toolJSX.jsx : null,
|
|
28440
|
-
!toolJSX && binaryFeedbackContext && !isMessageSelectorVisible && /* @__PURE__ */
|
|
27765
|
+
!toolJSX && binaryFeedbackContext && !isMessageSelectorVisible && /* @__PURE__ */ React97.createElement(
|
|
28441
27766
|
BinaryFeedback,
|
|
28442
27767
|
{
|
|
28443
27768
|
m1: binaryFeedbackContext.m1,
|
|
@@ -28455,7 +27780,7 @@ function REPL({
|
|
|
28455
27780
|
unresolvedToolUseIDs
|
|
28456
27781
|
}
|
|
28457
27782
|
),
|
|
28458
|
-
!toolJSX && toolUseConfirm && !isMessageSelectorVisible && !binaryFeedbackContext && /* @__PURE__ */
|
|
27783
|
+
!toolJSX && toolUseConfirm && !isMessageSelectorVisible && !binaryFeedbackContext && /* @__PURE__ */ React97.createElement(
|
|
28459
27784
|
PermissionRequest,
|
|
28460
27785
|
{
|
|
28461
27786
|
toolUseConfirm,
|
|
@@ -28463,7 +27788,7 @@ function REPL({
|
|
|
28463
27788
|
verbose
|
|
28464
27789
|
}
|
|
28465
27790
|
),
|
|
28466
|
-
!toolJSX && !toolUseConfirm && !isMessageSelectorVisible && !binaryFeedbackContext && showingCostDialog && /* @__PURE__ */
|
|
27791
|
+
!toolJSX && !toolUseConfirm && !isMessageSelectorVisible && !binaryFeedbackContext && showingCostDialog && /* @__PURE__ */ React97.createElement(
|
|
28467
27792
|
CostThresholdDialog,
|
|
28468
27793
|
{
|
|
28469
27794
|
onDone: () => {
|
|
@@ -28477,7 +27802,7 @@ function REPL({
|
|
|
28477
27802
|
}
|
|
28478
27803
|
}
|
|
28479
27804
|
),
|
|
28480
|
-
!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(
|
|
28481
27806
|
PromptInput_default,
|
|
28482
27807
|
{
|
|
28483
27808
|
commands,
|
|
@@ -28507,7 +27832,7 @@ function REPL({
|
|
|
28507
27832
|
abortController
|
|
28508
27833
|
}
|
|
28509
27834
|
))
|
|
28510
|
-
), isMessageSelectorVisible && /* @__PURE__ */
|
|
27835
|
+
), isMessageSelectorVisible && /* @__PURE__ */ React97.createElement(
|
|
28511
27836
|
MessageSelector,
|
|
28512
27837
|
{
|
|
28513
27838
|
erroredToolUseIDs,
|
|
@@ -28533,13 +27858,13 @@ function REPL({
|
|
|
28533
27858
|
onEscape: () => setIsMessageSelectorVisible(false),
|
|
28534
27859
|
tools
|
|
28535
27860
|
}
|
|
28536
|
-
), /* @__PURE__ */
|
|
27861
|
+
), /* @__PURE__ */ React97.createElement(Newline4, null))
|
|
28537
27862
|
);
|
|
28538
27863
|
}
|
|
28539
27864
|
|
|
28540
27865
|
// src/ui/components/SessionSelector.tsx
|
|
28541
|
-
import
|
|
28542
|
-
import { Box as
|
|
27866
|
+
import React98 from "react";
|
|
27867
|
+
import { Box as Box73, Text as Text77 } from "ink";
|
|
28543
27868
|
function SessionSelector({
|
|
28544
27869
|
sessions,
|
|
28545
27870
|
onSelect
|
|
@@ -28567,14 +27892,14 @@ function SessionSelector({
|
|
|
28567
27892
|
const truncated = labelTxt.length > columns - 2 ? `${labelTxt.slice(0, columns - 5)}...` : labelTxt;
|
|
28568
27893
|
return { label: truncated, value: String(i) };
|
|
28569
27894
|
});
|
|
28570
|
-
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(
|
|
28571
27896
|
Select,
|
|
28572
27897
|
{
|
|
28573
27898
|
options,
|
|
28574
27899
|
onChange: (value) => onSelect(parseInt(value, 10)),
|
|
28575
27900
|
visibleOptionCount: visibleCount
|
|
28576
27901
|
}
|
|
28577
|
-
), hiddenCount > 0 && /* @__PURE__ */
|
|
27902
|
+
), hiddenCount > 0 && /* @__PURE__ */ React98.createElement(Box73, { paddingLeft: 2 }, /* @__PURE__ */ React98.createElement(Text77, { color: getTheme().secondaryText }, "and ", hiddenCount, " more\u2026")));
|
|
28578
27903
|
}
|
|
28579
27904
|
|
|
28580
27905
|
// src/ui/screens/ResumeConversation.tsx
|
|
@@ -28610,7 +27935,7 @@ function ResumeConversation({
|
|
|
28610
27935
|
});
|
|
28611
27936
|
const isDefaultModel = await isDefaultSlowAndCapableModel();
|
|
28612
27937
|
render(
|
|
28613
|
-
/* @__PURE__ */
|
|
27938
|
+
/* @__PURE__ */ React99.createElement(
|
|
28614
27939
|
REPL,
|
|
28615
27940
|
{
|
|
28616
27941
|
commands,
|
|
@@ -28638,7 +27963,7 @@ function ResumeConversation({
|
|
|
28638
27963
|
throw e;
|
|
28639
27964
|
}
|
|
28640
27965
|
}
|
|
28641
|
-
return /* @__PURE__ */
|
|
27966
|
+
return /* @__PURE__ */ React99.createElement(SessionSelector, { sessions, onSelect });
|
|
28642
27967
|
}
|
|
28643
27968
|
|
|
28644
27969
|
// src/commands/resume.tsx
|
|
@@ -28661,7 +27986,7 @@ var resume_default = {
|
|
|
28661
27986
|
return null;
|
|
28662
27987
|
}
|
|
28663
27988
|
render2(
|
|
28664
|
-
/* @__PURE__ */
|
|
27989
|
+
/* @__PURE__ */ React100.createElement(
|
|
28665
27990
|
ResumeConversation,
|
|
28666
27991
|
{
|
|
28667
27992
|
cwd,
|
|
@@ -28678,11 +28003,11 @@ var resume_default = {
|
|
|
28678
28003
|
};
|
|
28679
28004
|
|
|
28680
28005
|
// src/commands/agents.tsx
|
|
28681
|
-
import
|
|
28006
|
+
import React102 from "react";
|
|
28682
28007
|
|
|
28683
28008
|
// src/commands/agents/ui.tsx
|
|
28684
|
-
import
|
|
28685
|
-
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";
|
|
28686
28011
|
import figures9 from "figures";
|
|
28687
28012
|
import chalk15 from "chalk";
|
|
28688
28013
|
import { join as join13 } from "path";
|
|
@@ -28744,7 +28069,7 @@ import {
|
|
|
28744
28069
|
mkdirSync as mkdirSync7,
|
|
28745
28070
|
renameSync as renameSync3,
|
|
28746
28071
|
unlinkSync as unlinkSync2,
|
|
28747
|
-
writeFileSync as
|
|
28072
|
+
writeFileSync as writeFileSync6
|
|
28748
28073
|
} from "fs";
|
|
28749
28074
|
import { join as join12 } from "path";
|
|
28750
28075
|
import { homedir as homedir8 } from "os";
|
|
@@ -28752,7 +28077,7 @@ import { homedir as homedir8 } from "os";
|
|
|
28752
28077
|
// src/commands/agents/generation.ts
|
|
28753
28078
|
import { randomUUID as randomUUID6 } from "crypto";
|
|
28754
28079
|
async function generateAgentWithClaude(prompt) {
|
|
28755
|
-
const { queryModel } = await import("./llm-
|
|
28080
|
+
const { queryModel } = await import("./llm-A3S75CLF.js");
|
|
28756
28081
|
const systemPrompt = `You are an expert at creating AI agent configurations. Based on the user's description, generate a specialized agent configuration.
|
|
28757
28082
|
|
|
28758
28083
|
Return your response as a JSON object with exactly these fields:
|
|
@@ -28977,7 +28302,7 @@ async function saveAgent(location, agentType, description3, tools, systemPrompt,
|
|
|
28977
28302
|
color
|
|
28978
28303
|
);
|
|
28979
28304
|
try {
|
|
28980
|
-
|
|
28305
|
+
writeFileSync6(tempFile, content, { encoding: "utf-8", flag: "wx" });
|
|
28981
28306
|
if (throwIfExists && (existsSync15(filePath) || existsSync15(legacyPath))) {
|
|
28982
28307
|
try {
|
|
28983
28308
|
unlinkSync2(tempFile);
|
|
@@ -29018,7 +28343,7 @@ async function updateAgent(agent, description3, tools, systemPrompt, color, mode
|
|
|
29018
28343
|
const legacyPath = getLegacyAgentFilePath(location, agent.agentType);
|
|
29019
28344
|
const filePath = existsSync15(primaryPath) ? primaryPath : existsSync15(legacyPath) ? legacyPath : primaryPath;
|
|
29020
28345
|
ensureDirectoryExists(location);
|
|
29021
|
-
|
|
28346
|
+
writeFileSync6(filePath, content, { encoding: "utf-8", flag: "w" });
|
|
29022
28347
|
}
|
|
29023
28348
|
async function deleteAgent(agent) {
|
|
29024
28349
|
if (agent.location === "built-in" || agent.location === "plugin") {
|
|
@@ -29134,21 +28459,21 @@ function panelBorderColor(kind) {
|
|
|
29134
28459
|
}
|
|
29135
28460
|
function Panel(props) {
|
|
29136
28461
|
const theme = getTheme();
|
|
29137
|
-
return /* @__PURE__ */
|
|
29138
|
-
|
|
28462
|
+
return /* @__PURE__ */ React101.createElement(
|
|
28463
|
+
Box74,
|
|
29139
28464
|
{
|
|
29140
28465
|
borderStyle: "round",
|
|
29141
28466
|
borderColor: props.borderColor ?? theme.suggestion,
|
|
29142
28467
|
flexDirection: "column"
|
|
29143
28468
|
},
|
|
29144
|
-
/* @__PURE__ */
|
|
29145
|
-
/* @__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)
|
|
29146
28471
|
);
|
|
29147
28472
|
}
|
|
29148
28473
|
function Instructions({
|
|
29149
28474
|
instructions = "Press \u2191\u2193 to navigate \xB7 Enter to select \xB7 Esc to go back"
|
|
29150
28475
|
}) {
|
|
29151
|
-
return /* @__PURE__ */
|
|
28476
|
+
return /* @__PURE__ */ React101.createElement(Box74, { marginLeft: 3 }, /* @__PURE__ */ React101.createElement(Text78, { dimColor: true }, instructions));
|
|
29152
28477
|
}
|
|
29153
28478
|
function computeOverrides(args) {
|
|
29154
28479
|
const activeByType = /* @__PURE__ */ new Map();
|
|
@@ -29161,7 +28486,7 @@ function computeOverrides(args) {
|
|
|
29161
28486
|
}
|
|
29162
28487
|
function AgentsListView(props) {
|
|
29163
28488
|
const theme = getTheme();
|
|
29164
|
-
const selectableAgents =
|
|
28489
|
+
const selectableAgents = useMemo26(() => {
|
|
29165
28490
|
const nonBuiltIn = props.agents.filter((a) => a.source !== "built-in");
|
|
29166
28491
|
if (props.source === "all") {
|
|
29167
28492
|
return [
|
|
@@ -29174,11 +28499,11 @@ function AgentsListView(props) {
|
|
|
29174
28499
|
}
|
|
29175
28500
|
return nonBuiltIn;
|
|
29176
28501
|
}, [props.agents, props.source]);
|
|
29177
|
-
const [selectedAgent, setSelectedAgent] =
|
|
28502
|
+
const [selectedAgent, setSelectedAgent] = useState28(
|
|
29178
28503
|
null
|
|
29179
28504
|
);
|
|
29180
|
-
const [onCreateOption, setOnCreateOption] =
|
|
29181
|
-
|
|
28505
|
+
const [onCreateOption, setOnCreateOption] = useState28(true);
|
|
28506
|
+
useEffect26(() => {
|
|
29182
28507
|
if (props.onCreateNew) {
|
|
29183
28508
|
setOnCreateOption(true);
|
|
29184
28509
|
setSelectedAgent(null);
|
|
@@ -29188,7 +28513,7 @@ function AgentsListView(props) {
|
|
|
29188
28513
|
setSelectedAgent(selectableAgents[0] ?? null);
|
|
29189
28514
|
}
|
|
29190
28515
|
}, [props.source]);
|
|
29191
|
-
|
|
28516
|
+
useInput28((_input, key) => {
|
|
29192
28517
|
if (key.escape) {
|
|
29193
28518
|
props.onBack();
|
|
29194
28519
|
return;
|
|
@@ -29227,38 +28552,38 @@ function AgentsListView(props) {
|
|
|
29227
28552
|
setSelectedAgent(nextAgent);
|
|
29228
28553
|
}
|
|
29229
28554
|
});
|
|
29230
|
-
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"));
|
|
29231
28556
|
const renderAgentRow = (agent) => {
|
|
29232
28557
|
const isBuiltIn = agent.source === "built-in";
|
|
29233
28558
|
const isSelected = !isBuiltIn && !onCreateOption && selectedAgent?.agentType === agent.agentType && selectedAgent?.source === agent.source;
|
|
29234
28559
|
const dimmed = Boolean(isBuiltIn || agent.overriddenBy);
|
|
29235
28560
|
const rowColor = isSelected ? theme.suggestion : void 0;
|
|
29236
28561
|
const pointer = isBuiltIn ? "" : isSelected ? `${figures9.pointer} ` : " ";
|
|
29237
|
-
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);
|
|
29238
28563
|
};
|
|
29239
28564
|
const group = (label, agents) => {
|
|
29240
28565
|
if (agents.length === 0) return null;
|
|
29241
28566
|
const baseDir = agents[0]?.baseDir;
|
|
29242
|
-
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));
|
|
29243
28568
|
};
|
|
29244
28569
|
const builtInSection = (label = "Built-in (always available):") => {
|
|
29245
28570
|
const builtIn = props.agents.filter((a) => a.source === "built-in");
|
|
29246
28571
|
if (builtIn.length === 0) return null;
|
|
29247
|
-
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));
|
|
29248
28573
|
};
|
|
29249
28574
|
const notOverriddenCount = props.agents.filter((a) => !a.overriddenBy).length;
|
|
29250
28575
|
const title = titleForSource(props.source);
|
|
29251
28576
|
if (props.agents.length === 0 || props.source !== "built-in" && !props.agents.some((a) => a.source !== "built-in")) {
|
|
29252
|
-
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));
|
|
29253
28578
|
}
|
|
29254
|
-
return /* @__PURE__ */
|
|
28579
|
+
return /* @__PURE__ */ React101.createElement(React101.Fragment, null, /* @__PURE__ */ React101.createElement(
|
|
29255
28580
|
Panel,
|
|
29256
28581
|
{
|
|
29257
28582
|
title,
|
|
29258
28583
|
subtitle: `${notOverriddenCount} agents`
|
|
29259
28584
|
},
|
|
29260
|
-
props.changes.length > 0 ? /* @__PURE__ */
|
|
29261
|
-
/* @__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(
|
|
29262
28587
|
"User agents",
|
|
29263
28588
|
props.agents.filter((a) => a.source === "userSettings")
|
|
29264
28589
|
), group(
|
|
@@ -29273,8 +28598,8 @@ function AgentsListView(props) {
|
|
|
29273
28598
|
), group(
|
|
29274
28599
|
"CLI arg agents",
|
|
29275
28600
|
props.agents.filter((a) => a.source === "flagSettings")
|
|
29276
|
-
), builtInSection("Built-in agents (always available)")) : props.source === "built-in" ? /* @__PURE__ */
|
|
29277
|
-
), /* @__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));
|
|
29278
28603
|
}
|
|
29279
28604
|
function wizardLocationToStorageLocation(location) {
|
|
29280
28605
|
return location === "projectSettings" ? "project" : "user";
|
|
@@ -29310,9 +28635,9 @@ function modelOptions() {
|
|
|
29310
28635
|
];
|
|
29311
28636
|
}
|
|
29312
28637
|
function Wizard(props) {
|
|
29313
|
-
const [stepIndex, setStepIndex] =
|
|
29314
|
-
const [data, setData] =
|
|
29315
|
-
const [history, setHistory] =
|
|
28638
|
+
const [stepIndex, setStepIndex] = useState28(0);
|
|
28639
|
+
const [data, setData] = useState28(props.initialData ?? {});
|
|
28640
|
+
const [history, setHistory] = useState28([]);
|
|
29316
28641
|
const goNext = useCallback17(() => {
|
|
29317
28642
|
setHistory((prev) => [...prev, stepIndex]);
|
|
29318
28643
|
setStepIndex((prev) => Math.min(prev + 1, props.steps.length - 1));
|
|
@@ -29341,7 +28666,7 @@ function Wizard(props) {
|
|
|
29341
28666
|
}, []);
|
|
29342
28667
|
const cancel = useCallback17(() => props.onCancel(), [props.onCancel]);
|
|
29343
28668
|
const done = useCallback17(() => props.onDone(data), [props, data]);
|
|
29344
|
-
const ctx =
|
|
28669
|
+
const ctx = useMemo26(
|
|
29345
28670
|
() => ({
|
|
29346
28671
|
stepIndex,
|
|
29347
28672
|
totalSteps: props.steps.length,
|
|
@@ -29365,16 +28690,16 @@ function Wizard(props) {
|
|
|
29365
28690
|
cancel
|
|
29366
28691
|
]
|
|
29367
28692
|
);
|
|
29368
|
-
return /* @__PURE__ */
|
|
28693
|
+
return /* @__PURE__ */ React101.createElement(React101.Fragment, null, props.steps[stepIndex]?.(ctx) ?? null);
|
|
29369
28694
|
}
|
|
29370
28695
|
function WizardPanel(props) {
|
|
29371
|
-
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 }));
|
|
29372
28697
|
}
|
|
29373
28698
|
function StepChooseLocation({ ctx }) {
|
|
29374
|
-
|
|
28699
|
+
useInput28((_input, key) => {
|
|
29375
28700
|
if (key.escape) ctx.cancel();
|
|
29376
28701
|
});
|
|
29377
|
-
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(
|
|
29378
28703
|
Select,
|
|
29379
28704
|
{
|
|
29380
28705
|
options: [
|
|
@@ -29390,10 +28715,10 @@ function StepChooseLocation({ ctx }) {
|
|
|
29390
28715
|
)));
|
|
29391
28716
|
}
|
|
29392
28717
|
function StepChooseMethod({ ctx }) {
|
|
29393
|
-
|
|
28718
|
+
useInput28((_input, key) => {
|
|
29394
28719
|
if (key.escape) ctx.goBack();
|
|
29395
28720
|
});
|
|
29396
|
-
return /* @__PURE__ */
|
|
28721
|
+
return /* @__PURE__ */ React101.createElement(WizardPanel, { subtitle: "Creation method" }, /* @__PURE__ */ React101.createElement(Box74, { marginTop: 1 }, /* @__PURE__ */ React101.createElement(
|
|
29397
28722
|
Select,
|
|
29398
28723
|
{
|
|
29399
28724
|
options: [
|
|
@@ -29411,13 +28736,13 @@ function StepChooseMethod({ ctx }) {
|
|
|
29411
28736
|
}
|
|
29412
28737
|
function StepGenerationPrompt(props) {
|
|
29413
28738
|
const { ctx } = props;
|
|
29414
|
-
const [value, setValue] =
|
|
29415
|
-
const [cursorOffset, setCursorOffset] =
|
|
29416
|
-
const [isGenerating, setIsGenerating] =
|
|
29417
|
-
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);
|
|
29418
28743
|
const abortRef = useRef14(null);
|
|
29419
28744
|
const columns = Math.min(80, process.stdout.columns ?? 80);
|
|
29420
|
-
|
|
28745
|
+
useInput28((_input, key) => {
|
|
29421
28746
|
if (!key.escape) return;
|
|
29422
28747
|
if (isGenerating && abortRef.current) {
|
|
29423
28748
|
abortRef.current.abort();
|
|
@@ -29477,7 +28802,7 @@ function StepGenerationPrompt(props) {
|
|
|
29477
28802
|
abortRef.current = null;
|
|
29478
28803
|
}
|
|
29479
28804
|
};
|
|
29480
|
-
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(
|
|
29481
28806
|
TextInput,
|
|
29482
28807
|
{
|
|
29483
28808
|
value,
|
|
@@ -29488,7 +28813,7 @@ function StepGenerationPrompt(props) {
|
|
|
29488
28813
|
cursorOffset,
|
|
29489
28814
|
onChangeCursorOffset: setCursorOffset
|
|
29490
28815
|
}
|
|
29491
|
-
), error ? /* @__PURE__ */
|
|
28816
|
+
), error ? /* @__PURE__ */ React101.createElement(Text78, { color: themeColor("error") }, error) : null, isGenerating ? /* @__PURE__ */ React101.createElement(Text78, { dimColor: true }, "Generating\u2026") : null));
|
|
29492
28817
|
}
|
|
29493
28818
|
function themeColor(kind) {
|
|
29494
28819
|
const theme = getTheme();
|
|
@@ -29506,11 +28831,11 @@ function themeColor(kind) {
|
|
|
29506
28831
|
}
|
|
29507
28832
|
function StepAgentType(props) {
|
|
29508
28833
|
const { ctx } = props;
|
|
29509
|
-
const [value, setValue] =
|
|
29510
|
-
const [cursorOffset, setCursorOffset] =
|
|
29511
|
-
const [error, setError] =
|
|
28834
|
+
const [value, setValue] = useState28(ctx.wizardData.agentType ?? "");
|
|
28835
|
+
const [cursorOffset, setCursorOffset] = useState28(value.length);
|
|
28836
|
+
const [error, setError] = useState28(null);
|
|
29512
28837
|
const columns = 60;
|
|
29513
|
-
|
|
28838
|
+
useInput28((_input, key) => {
|
|
29514
28839
|
if (key.escape) ctx.goBack();
|
|
29515
28840
|
});
|
|
29516
28841
|
const onSubmit = (next) => {
|
|
@@ -29524,13 +28849,13 @@ function StepAgentType(props) {
|
|
|
29524
28849
|
ctx.updateWizardData({ agentType: trimmed });
|
|
29525
28850
|
ctx.goNext();
|
|
29526
28851
|
};
|
|
29527
|
-
return /* @__PURE__ */
|
|
28852
|
+
return /* @__PURE__ */ React101.createElement(
|
|
29528
28853
|
WizardPanel,
|
|
29529
28854
|
{
|
|
29530
28855
|
subtitle: "Agent type (identifier)",
|
|
29531
28856
|
footerText: "Press Enter to continue \xB7 Esc to go back"
|
|
29532
28857
|
},
|
|
29533
|
-
/* @__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(
|
|
29534
28859
|
TextInput,
|
|
29535
28860
|
{
|
|
29536
28861
|
value,
|
|
@@ -29540,15 +28865,15 @@ function StepAgentType(props) {
|
|
|
29540
28865
|
cursorOffset,
|
|
29541
28866
|
onChangeCursorOffset: setCursorOffset
|
|
29542
28867
|
}
|
|
29543
|
-
), /* @__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)
|
|
29544
28869
|
);
|
|
29545
28870
|
}
|
|
29546
28871
|
function StepSystemPrompt({ ctx }) {
|
|
29547
|
-
const [value, setValue] =
|
|
29548
|
-
const [cursorOffset, setCursorOffset] =
|
|
29549
|
-
const [error, setError] =
|
|
28872
|
+
const [value, setValue] = useState28(ctx.wizardData.systemPrompt ?? "");
|
|
28873
|
+
const [cursorOffset, setCursorOffset] = useState28(value.length);
|
|
28874
|
+
const [error, setError] = useState28(null);
|
|
29550
28875
|
const columns = Math.min(80, process.stdout.columns ?? 80);
|
|
29551
|
-
|
|
28876
|
+
useInput28((_input, key) => {
|
|
29552
28877
|
if (key.escape) ctx.goBack();
|
|
29553
28878
|
});
|
|
29554
28879
|
const onSubmit = (next) => {
|
|
@@ -29561,13 +28886,13 @@ function StepSystemPrompt({ ctx }) {
|
|
|
29561
28886
|
ctx.updateWizardData({ systemPrompt: trimmed });
|
|
29562
28887
|
ctx.goNext();
|
|
29563
28888
|
};
|
|
29564
|
-
return /* @__PURE__ */
|
|
28889
|
+
return /* @__PURE__ */ React101.createElement(
|
|
29565
28890
|
WizardPanel,
|
|
29566
28891
|
{
|
|
29567
28892
|
subtitle: "System prompt",
|
|
29568
28893
|
footerText: "Press Enter to continue \xB7 Esc to go back"
|
|
29569
28894
|
},
|
|
29570
|
-
/* @__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(
|
|
29571
28896
|
TextInput,
|
|
29572
28897
|
{
|
|
29573
28898
|
value,
|
|
@@ -29578,15 +28903,15 @@ function StepSystemPrompt({ ctx }) {
|
|
|
29578
28903
|
cursorOffset,
|
|
29579
28904
|
onChangeCursorOffset: setCursorOffset
|
|
29580
28905
|
}
|
|
29581
|
-
), error ? /* @__PURE__ */
|
|
28906
|
+
), error ? /* @__PURE__ */ React101.createElement(Text78, { color: themeColor("error") }, error) : null)
|
|
29582
28907
|
);
|
|
29583
28908
|
}
|
|
29584
28909
|
function StepDescription({ ctx }) {
|
|
29585
|
-
const [value, setValue] =
|
|
29586
|
-
const [cursorOffset, setCursorOffset] =
|
|
29587
|
-
const [error, setError] =
|
|
28910
|
+
const [value, setValue] = useState28(ctx.wizardData.whenToUse ?? "");
|
|
28911
|
+
const [cursorOffset, setCursorOffset] = useState28(value.length);
|
|
28912
|
+
const [error, setError] = useState28(null);
|
|
29588
28913
|
const columns = Math.min(80, process.stdout.columns ?? 80);
|
|
29589
|
-
|
|
28914
|
+
useInput28((_input, key) => {
|
|
29590
28915
|
if (key.escape) ctx.goBack();
|
|
29591
28916
|
});
|
|
29592
28917
|
const onSubmit = (next) => {
|
|
@@ -29599,13 +28924,13 @@ function StepDescription({ ctx }) {
|
|
|
29599
28924
|
ctx.updateWizardData({ whenToUse: trimmed });
|
|
29600
28925
|
ctx.goNext();
|
|
29601
28926
|
};
|
|
29602
|
-
return /* @__PURE__ */
|
|
28927
|
+
return /* @__PURE__ */ React101.createElement(
|
|
29603
28928
|
WizardPanel,
|
|
29604
28929
|
{
|
|
29605
28930
|
subtitle: "Description (tell Claude when to use this agent)",
|
|
29606
28931
|
footerText: "Press Enter to continue \xB7 Esc to go back"
|
|
29607
28932
|
},
|
|
29608
|
-
/* @__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(
|
|
29609
28934
|
TextInput,
|
|
29610
28935
|
{
|
|
29611
28936
|
value,
|
|
@@ -29616,11 +28941,11 @@ function StepDescription({ ctx }) {
|
|
|
29616
28941
|
cursorOffset,
|
|
29617
28942
|
onChangeCursorOffset: setCursorOffset
|
|
29618
28943
|
}
|
|
29619
|
-
), error ? /* @__PURE__ */
|
|
28944
|
+
), error ? /* @__PURE__ */ React101.createElement(Text78, { color: themeColor("error") }, error) : null)
|
|
29620
28945
|
);
|
|
29621
28946
|
}
|
|
29622
28947
|
function ToolPicker(props) {
|
|
29623
|
-
const normalizedTools =
|
|
28948
|
+
const normalizedTools = useMemo26(() => {
|
|
29624
28949
|
const unique = /* @__PURE__ */ new Map();
|
|
29625
28950
|
for (const tool of props.tools) {
|
|
29626
28951
|
if (!tool?.name) continue;
|
|
@@ -29628,20 +28953,20 @@ function ToolPicker(props) {
|
|
|
29628
28953
|
}
|
|
29629
28954
|
return Array.from(unique.values()).sort((a, b) => a.name.localeCompare(b.name));
|
|
29630
28955
|
}, [props.tools]);
|
|
29631
|
-
const allToolNames =
|
|
28956
|
+
const allToolNames = useMemo26(
|
|
29632
28957
|
() => normalizedTools.map((t) => t.name),
|
|
29633
28958
|
[normalizedTools]
|
|
29634
28959
|
);
|
|
29635
|
-
const initialSelectedNames =
|
|
28960
|
+
const initialSelectedNames = useMemo26(() => {
|
|
29636
28961
|
if (!props.initialTools) return allToolNames;
|
|
29637
28962
|
if (props.initialTools.includes("*")) return allToolNames;
|
|
29638
28963
|
const available = new Set(allToolNames);
|
|
29639
28964
|
return props.initialTools.filter((t) => available.has(t));
|
|
29640
28965
|
}, [props.initialTools, allToolNames]);
|
|
29641
|
-
const [selected, setSelected] =
|
|
29642
|
-
const [cursorIndex, setCursorIndex] =
|
|
29643
|
-
const [showAdvanced, setShowAdvanced] =
|
|
29644
|
-
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]);
|
|
29645
28970
|
const isAllSelected = selected.length === allToolNames.length && allToolNames.length > 0;
|
|
29646
28971
|
const toggleOne = (name3) => {
|
|
29647
28972
|
setSelected(
|
|
@@ -29661,7 +28986,7 @@ function ToolPicker(props) {
|
|
|
29661
28986
|
const next = selected.length === allToolNames.length && allToolNames.every((n) => selected.includes(n)) ? void 0 : selected;
|
|
29662
28987
|
props.onComplete(next);
|
|
29663
28988
|
};
|
|
29664
|
-
const categorized =
|
|
28989
|
+
const categorized = useMemo26(() => {
|
|
29665
28990
|
const readOnly = /* @__PURE__ */ new Set(["Read", "Glob", "Grep", "LS"]);
|
|
29666
28991
|
const edit = /* @__PURE__ */ new Set(["Edit", "MultiEdit", "Write", "NotebookEdit"]);
|
|
29667
28992
|
const execution = /* @__PURE__ */ new Set(["Bash", "BashOutput", "KillBash"]);
|
|
@@ -29676,7 +29001,7 @@ function ToolPicker(props) {
|
|
|
29676
29001
|
}
|
|
29677
29002
|
return buckets;
|
|
29678
29003
|
}, [normalizedTools]);
|
|
29679
|
-
const mcpServers =
|
|
29004
|
+
const mcpServers = useMemo26(() => {
|
|
29680
29005
|
const byServer = /* @__PURE__ */ new Map();
|
|
29681
29006
|
for (const name3 of categorized.mcp) {
|
|
29682
29007
|
const parsed = parseMcpToolName(name3);
|
|
@@ -29687,7 +29012,7 @@ function ToolPicker(props) {
|
|
|
29687
29012
|
}
|
|
29688
29013
|
return Array.from(byServer.entries()).map(([serverName, toolNames]) => ({ serverName, toolNames })).sort((a, b) => a.serverName.localeCompare(b.serverName));
|
|
29689
29014
|
}, [categorized.mcp]);
|
|
29690
|
-
const items =
|
|
29015
|
+
const items = useMemo26(() => {
|
|
29691
29016
|
const out = [];
|
|
29692
29017
|
out.push({ id: "continue", label: "[ Continue ]", action: complete });
|
|
29693
29018
|
out.push({
|
|
@@ -29752,7 +29077,7 @@ function ToolPicker(props) {
|
|
|
29752
29077
|
selectedSet,
|
|
29753
29078
|
showAdvanced
|
|
29754
29079
|
]);
|
|
29755
|
-
|
|
29080
|
+
useInput28((_input, key) => {
|
|
29756
29081
|
if (key.escape) {
|
|
29757
29082
|
props.onCancel();
|
|
29758
29083
|
return;
|
|
@@ -29775,12 +29100,12 @@ function ToolPicker(props) {
|
|
|
29775
29100
|
return;
|
|
29776
29101
|
}
|
|
29777
29102
|
});
|
|
29778
|
-
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) => {
|
|
29779
29104
|
const index = idx + 1;
|
|
29780
29105
|
const focused = index === cursorIndex;
|
|
29781
29106
|
const prefix = item.isHeader ? "" : focused ? `${figures9.pointer} ` : " ";
|
|
29782
|
-
return /* @__PURE__ */
|
|
29783
|
-
|
|
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,
|
|
29784
29109
|
{
|
|
29785
29110
|
dimColor: item.isHeader,
|
|
29786
29111
|
color: !item.isHeader && focused ? themeColor("suggestion") : void 0,
|
|
@@ -29788,12 +29113,12 @@ function ToolPicker(props) {
|
|
|
29788
29113
|
},
|
|
29789
29114
|
item.isToggle ? `${prefix}[ ${item.label} ]` : `${prefix}${item.label}`
|
|
29790
29115
|
));
|
|
29791
|
-
}), /* @__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`)));
|
|
29792
29117
|
}
|
|
29793
29118
|
function StepSelectTools(props) {
|
|
29794
29119
|
const { ctx } = props;
|
|
29795
29120
|
const initialTools = ctx.wizardData.selectedTools;
|
|
29796
|
-
return /* @__PURE__ */
|
|
29121
|
+
return /* @__PURE__ */ React101.createElement(React101.Fragment, null, /* @__PURE__ */ React101.createElement(Panel, { title: "Create new agent", subtitle: "Select tools" }, /* @__PURE__ */ React101.createElement(
|
|
29797
29122
|
ToolPicker,
|
|
29798
29123
|
{
|
|
29799
29124
|
tools: props.tools,
|
|
@@ -29804,15 +29129,15 @@ function StepSelectTools(props) {
|
|
|
29804
29129
|
},
|
|
29805
29130
|
onCancel: ctx.goBack
|
|
29806
29131
|
}
|
|
29807
|
-
)), /* @__PURE__ */
|
|
29132
|
+
)), /* @__PURE__ */ React101.createElement(Instructions, { instructions: "Press Enter to toggle selection \xB7 \u2191\u2193 Navigate \xB7 Esc to go back" }));
|
|
29808
29133
|
}
|
|
29809
29134
|
function StepSelectModel({ ctx }) {
|
|
29810
|
-
|
|
29135
|
+
useInput28((_input, key) => {
|
|
29811
29136
|
if (key.escape) ctx.goBack();
|
|
29812
29137
|
});
|
|
29813
29138
|
const options = modelOptions();
|
|
29814
29139
|
const defaultValue = ctx.wizardData.selectedModel ?? DEFAULT_AGENT_MODEL;
|
|
29815
|
-
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(
|
|
29816
29141
|
Select,
|
|
29817
29142
|
{
|
|
29818
29143
|
options,
|
|
@@ -29825,20 +29150,20 @@ function StepSelectModel({ ctx }) {
|
|
|
29825
29150
|
)));
|
|
29826
29151
|
}
|
|
29827
29152
|
function ColorPicker(props) {
|
|
29828
|
-
const [index, setIndex] =
|
|
29153
|
+
const [index, setIndex] = useState28(
|
|
29829
29154
|
Math.max(0, COLOR_OPTIONS.findIndex((c) => c === props.currentColor))
|
|
29830
29155
|
);
|
|
29831
|
-
|
|
29156
|
+
useInput28((_input, key) => {
|
|
29832
29157
|
if (key.upArrow) setIndex((i) => i > 0 ? i - 1 : COLOR_OPTIONS.length - 1);
|
|
29833
29158
|
else if (key.downArrow) setIndex((i) => i < COLOR_OPTIONS.length - 1 ? i + 1 : 0);
|
|
29834
29159
|
else if (key.return) props.onConfirm(COLOR_OPTIONS[index] ?? "automatic");
|
|
29835
29160
|
});
|
|
29836
|
-
return /* @__PURE__ */
|
|
29161
|
+
return /* @__PURE__ */ React101.createElement(Box74, { flexDirection: "column", gap: 1 }, COLOR_OPTIONS.map((color, i) => {
|
|
29837
29162
|
const focused = i === index;
|
|
29838
29163
|
const prefix = focused ? figures9.pointer : " ";
|
|
29839
29164
|
const label = color === "automatic" ? "Automatic color" : color.charAt(0).toUpperCase() + color.slice(1);
|
|
29840
|
-
return /* @__PURE__ */
|
|
29841
|
-
|
|
29165
|
+
return /* @__PURE__ */ React101.createElement(React101.Fragment, { key: color }, /* @__PURE__ */ React101.createElement(
|
|
29166
|
+
Text78,
|
|
29842
29167
|
{
|
|
29843
29168
|
color: focused ? themeColor("suggestion") : void 0,
|
|
29844
29169
|
bold: focused
|
|
@@ -29850,7 +29175,7 @@ function ColorPicker(props) {
|
|
|
29850
29175
|
}));
|
|
29851
29176
|
}
|
|
29852
29177
|
function StepChooseColor({ ctx }) {
|
|
29853
|
-
|
|
29178
|
+
useInput28((_input, key) => {
|
|
29854
29179
|
if (key.escape) ctx.goBack();
|
|
29855
29180
|
});
|
|
29856
29181
|
const agentType = ctx.wizardData.agentType ?? "agent";
|
|
@@ -29871,7 +29196,7 @@ function StepChooseColor({ ctx }) {
|
|
|
29871
29196
|
});
|
|
29872
29197
|
ctx.goNext();
|
|
29873
29198
|
};
|
|
29874
|
-
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 })));
|
|
29875
29200
|
}
|
|
29876
29201
|
function validateFinalAgent(args) {
|
|
29877
29202
|
const errors = [];
|
|
@@ -29898,8 +29223,8 @@ function validateFinalAgent(args) {
|
|
|
29898
29223
|
function StepConfirm(props) {
|
|
29899
29224
|
const { ctx } = props;
|
|
29900
29225
|
const finalAgent = ctx.wizardData.finalAgent;
|
|
29901
|
-
const [error, setError] =
|
|
29902
|
-
|
|
29226
|
+
const [error, setError] = useState28(null);
|
|
29227
|
+
useInput28((input, key) => {
|
|
29903
29228
|
if (key.escape) ctx.goBack();
|
|
29904
29229
|
else if (input === "e") void doSave(true);
|
|
29905
29230
|
else if (input === "s" || key.return) void doSave(false);
|
|
@@ -29936,28 +29261,28 @@ function StepConfirm(props) {
|
|
|
29936
29261
|
});
|
|
29937
29262
|
const locationPath = finalAgent.source === "projectSettings" ? getPrimaryAgentFilePath("project", finalAgent.agentType) : getPrimaryAgentFilePath("user", finalAgent.agentType);
|
|
29938
29263
|
const truncate = (text) => text.length > 240 ? `${text.slice(0, 240)}\u2026` : text;
|
|
29939
|
-
return /* @__PURE__ */
|
|
29264
|
+
return /* @__PURE__ */ React101.createElement(
|
|
29940
29265
|
WizardPanel,
|
|
29941
29266
|
{
|
|
29942
29267
|
subtitle: "Confirm and save",
|
|
29943
29268
|
footerText: "Press s/Enter to save \xB7 e to edit in your editor \xB7 Esc to cancel"
|
|
29944
29269
|
},
|
|
29945
|
-
/* @__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)
|
|
29946
29271
|
);
|
|
29947
29272
|
}
|
|
29948
29273
|
function CreateAgentWizard(props) {
|
|
29949
|
-
const steps =
|
|
29274
|
+
const steps = useMemo26(() => {
|
|
29950
29275
|
return [
|
|
29951
|
-
(ctx) => /* @__PURE__ */
|
|
29952
|
-
(ctx) => /* @__PURE__ */
|
|
29953
|
-
(ctx) => /* @__PURE__ */
|
|
29954
|
-
(ctx) => /* @__PURE__ */
|
|
29955
|
-
(ctx) => /* @__PURE__ */
|
|
29956
|
-
(ctx) => /* @__PURE__ */
|
|
29957
|
-
(ctx) => /* @__PURE__ */
|
|
29958
|
-
(ctx) => /* @__PURE__ */
|
|
29959
|
-
(ctx) => /* @__PURE__ */
|
|
29960
|
-
(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(
|
|
29961
29286
|
StepConfirm,
|
|
29962
29287
|
{
|
|
29963
29288
|
ctx,
|
|
@@ -29990,7 +29315,7 @@ function CreateAgentWizard(props) {
|
|
|
29990
29315
|
)
|
|
29991
29316
|
];
|
|
29992
29317
|
}, [props]);
|
|
29993
|
-
return /* @__PURE__ */
|
|
29318
|
+
return /* @__PURE__ */ React101.createElement(
|
|
29994
29319
|
Wizard,
|
|
29995
29320
|
{
|
|
29996
29321
|
steps,
|
|
@@ -30001,7 +29326,7 @@ function CreateAgentWizard(props) {
|
|
|
30001
29326
|
);
|
|
30002
29327
|
}
|
|
30003
29328
|
function AgentMenu(props) {
|
|
30004
|
-
|
|
29329
|
+
useInput28((_input, key) => {
|
|
30005
29330
|
if (key.escape) props.onCancel();
|
|
30006
29331
|
});
|
|
30007
29332
|
const isBuiltIn = props.agent.source === "built-in";
|
|
@@ -30013,16 +29338,16 @@ function AgentMenu(props) {
|
|
|
30013
29338
|
],
|
|
30014
29339
|
{ label: "Back", value: "back" }
|
|
30015
29340
|
];
|
|
30016
|
-
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(
|
|
30017
29342
|
Select,
|
|
30018
29343
|
{
|
|
30019
29344
|
options,
|
|
30020
29345
|
onChange: (value) => props.onChoose(value)
|
|
30021
29346
|
}
|
|
30022
|
-
))), /* @__PURE__ */
|
|
29347
|
+
))), /* @__PURE__ */ React101.createElement(Instructions, null));
|
|
30023
29348
|
}
|
|
30024
29349
|
function ViewAgent(props) {
|
|
30025
|
-
|
|
29350
|
+
useInput28((_input, key) => {
|
|
30026
29351
|
if (key.escape || key.return) props.onBack();
|
|
30027
29352
|
});
|
|
30028
29353
|
const toolNames = new Set(props.tools.map((t) => t.name));
|
|
@@ -30055,15 +29380,15 @@ function ViewAgent(props) {
|
|
|
30055
29380
|
const toolsSummary = () => {
|
|
30056
29381
|
if (parsedTools.hasWildcard) return "All tools";
|
|
30057
29382
|
if (!props.agent.tools || props.agent.tools === "*" || props.agent.tools.length === 0) return "None";
|
|
30058
|
-
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);
|
|
30059
29384
|
};
|
|
30060
|
-
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" }));
|
|
30061
29386
|
}
|
|
30062
29387
|
function EditAgent(props) {
|
|
30063
|
-
const [mode, setMode] =
|
|
30064
|
-
const [selectedIndex, setSelectedIndex] =
|
|
30065
|
-
const [error, setError] =
|
|
30066
|
-
const menuItems =
|
|
29388
|
+
const [mode, setMode] = useState28("menu");
|
|
29389
|
+
const [selectedIndex, setSelectedIndex] = useState28(0);
|
|
29390
|
+
const [error, setError] = useState28(null);
|
|
29391
|
+
const menuItems = useMemo26(
|
|
30067
29392
|
() => [
|
|
30068
29393
|
{ label: "Open in editor", action: "open" },
|
|
30069
29394
|
{ label: "Edit tools", action: "edit-tools" },
|
|
@@ -30100,7 +29425,7 @@ function EditAgent(props) {
|
|
|
30100
29425
|
setError(err instanceof Error ? err.message : String(err));
|
|
30101
29426
|
}
|
|
30102
29427
|
};
|
|
30103
|
-
|
|
29428
|
+
useInput28((_input, key) => {
|
|
30104
29429
|
if (mode === "edit-model") {
|
|
30105
29430
|
if (key.escape) setMode("menu");
|
|
30106
29431
|
return;
|
|
@@ -30122,7 +29447,7 @@ function EditAgent(props) {
|
|
|
30122
29447
|
}
|
|
30123
29448
|
});
|
|
30124
29449
|
if (mode === "edit-tools") {
|
|
30125
|
-
return /* @__PURE__ */
|
|
29450
|
+
return /* @__PURE__ */ React101.createElement(React101.Fragment, null, /* @__PURE__ */ React101.createElement(Panel, { title: `Edit agent: ${props.agent.agentType}` }, /* @__PURE__ */ React101.createElement(
|
|
30126
29451
|
ToolPicker,
|
|
30127
29452
|
{
|
|
30128
29453
|
tools: props.tools,
|
|
@@ -30134,10 +29459,10 @@ function EditAgent(props) {
|
|
|
30134
29459
|
},
|
|
30135
29460
|
onCancel: () => setMode("menu")
|
|
30136
29461
|
}
|
|
30137
|
-
), 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" }));
|
|
30138
29463
|
}
|
|
30139
29464
|
if (mode === "edit-model") {
|
|
30140
|
-
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(
|
|
30141
29466
|
Select,
|
|
30142
29467
|
{
|
|
30143
29468
|
options: modelOptions(),
|
|
@@ -30147,10 +29472,10 @@ function EditAgent(props) {
|
|
|
30147
29472
|
setMode("menu");
|
|
30148
29473
|
}
|
|
30149
29474
|
}
|
|
30150
|
-
)), error ? /* @__PURE__ */
|
|
29475
|
+
)), error ? /* @__PURE__ */ React101.createElement(Box74, { marginTop: 1 }, /* @__PURE__ */ React101.createElement(Text78, { color: themeColor("error") }, error)) : null), /* @__PURE__ */ React101.createElement(Instructions, null));
|
|
30151
29476
|
}
|
|
30152
29477
|
if (mode === "edit-color") {
|
|
30153
|
-
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(
|
|
30154
29479
|
ColorPicker,
|
|
30155
29480
|
{
|
|
30156
29481
|
agentName: props.agent.agentType,
|
|
@@ -30160,29 +29485,29 @@ function EditAgent(props) {
|
|
|
30160
29485
|
setMode("menu");
|
|
30161
29486
|
}
|
|
30162
29487
|
}
|
|
30163
|
-
)), error ? /* @__PURE__ */
|
|
29488
|
+
)), error ? /* @__PURE__ */ React101.createElement(Box74, { marginTop: 1 }, /* @__PURE__ */ React101.createElement(Text78, { color: themeColor("error") }, error)) : null), /* @__PURE__ */ React101.createElement(Instructions, null));
|
|
30164
29489
|
}
|
|
30165
|
-
return /* @__PURE__ */
|
|
30166
|
-
|
|
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,
|
|
30167
29492
|
{
|
|
30168
29493
|
color: idx === selectedIndex ? themeColor("suggestion") : void 0
|
|
30169
29494
|
},
|
|
30170
29495
|
idx === selectedIndex ? `${figures9.pointer} ` : " ",
|
|
30171
29496
|
item.label
|
|
30172
|
-
)))), error ? /* @__PURE__ */
|
|
29497
|
+
)))), error ? /* @__PURE__ */ React101.createElement(Box74, { marginTop: 1 }, /* @__PURE__ */ React101.createElement(Text78, { color: themeColor("error") }, error)) : null)), /* @__PURE__ */ React101.createElement(Instructions, null));
|
|
30173
29498
|
}
|
|
30174
29499
|
function DeleteConfirm(props) {
|
|
30175
|
-
|
|
29500
|
+
useInput28((_input, key) => {
|
|
30176
29501
|
if (key.escape) props.onCancel();
|
|
30177
29502
|
});
|
|
30178
|
-
return /* @__PURE__ */
|
|
29503
|
+
return /* @__PURE__ */ React101.createElement(React101.Fragment, null, /* @__PURE__ */ React101.createElement(
|
|
30179
29504
|
Panel,
|
|
30180
29505
|
{
|
|
30181
29506
|
title: "Delete agent",
|
|
30182
29507
|
borderColor: panelBorderColor("error"),
|
|
30183
29508
|
titleColor: themeColor("error")
|
|
30184
29509
|
},
|
|
30185
|
-
/* @__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(
|
|
30186
29511
|
Select,
|
|
30187
29512
|
{
|
|
30188
29513
|
options: [
|
|
@@ -30195,22 +29520,22 @@ function DeleteConfirm(props) {
|
|
|
30195
29520
|
}
|
|
30196
29521
|
}
|
|
30197
29522
|
)))
|
|
30198
|
-
), /* @__PURE__ */
|
|
29523
|
+
), /* @__PURE__ */ React101.createElement(Instructions, { instructions: "Press \u2191\u2193 to navigate, Enter to select, Esc to cancel" }));
|
|
30199
29524
|
}
|
|
30200
29525
|
function AgentsUI({ onExit }) {
|
|
30201
|
-
const [mode, setMode] =
|
|
30202
|
-
const [loading, setLoading] =
|
|
30203
|
-
const [allAgents, setAllAgents] =
|
|
30204
|
-
const [activeAgents, setActiveAgents] =
|
|
30205
|
-
const [tools, setTools] =
|
|
30206
|
-
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([]);
|
|
30207
29532
|
const refresh = useCallback17(async () => {
|
|
30208
29533
|
clearAgentCache();
|
|
30209
29534
|
const [all, active2] = await Promise.all([getAllAgents(), getActiveAgents()]);
|
|
30210
29535
|
setAllAgents(all);
|
|
30211
29536
|
setActiveAgents(active2);
|
|
30212
29537
|
}, []);
|
|
30213
|
-
|
|
29538
|
+
useEffect26(() => {
|
|
30214
29539
|
let mounted = true;
|
|
30215
29540
|
(async () => {
|
|
30216
29541
|
try {
|
|
@@ -30225,11 +29550,11 @@ function AgentsUI({ onExit }) {
|
|
|
30225
29550
|
mounted = false;
|
|
30226
29551
|
};
|
|
30227
29552
|
}, [refresh]);
|
|
30228
|
-
const agentsWithOverride =
|
|
29553
|
+
const agentsWithOverride = useMemo26(
|
|
30229
29554
|
() => computeOverrides({ allAgents, activeAgents }),
|
|
30230
29555
|
[allAgents, activeAgents]
|
|
30231
29556
|
);
|
|
30232
|
-
const listAgentsForSource =
|
|
29557
|
+
const listAgentsForSource = useMemo26(() => {
|
|
30233
29558
|
const bySource = {
|
|
30234
29559
|
"built-in": agentsWithOverride.filter((a) => a.source === "built-in"),
|
|
30235
29560
|
userSettings: agentsWithOverride.filter((a) => a.source === "userSettings"),
|
|
@@ -30266,10 +29591,10 @@ ${changes.join("\n")}`);
|
|
|
30266
29591
|
onExit("Agents dialog dismissed");
|
|
30267
29592
|
}, [changes, onExit]);
|
|
30268
29593
|
if (loading) {
|
|
30269
|
-
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));
|
|
30270
29595
|
}
|
|
30271
29596
|
if (mode.mode === "list-agents") {
|
|
30272
|
-
return /* @__PURE__ */
|
|
29597
|
+
return /* @__PURE__ */ React101.createElement(
|
|
30273
29598
|
AgentsListView,
|
|
30274
29599
|
{
|
|
30275
29600
|
source: mode.source,
|
|
@@ -30282,7 +29607,7 @@ ${changes.join("\n")}`);
|
|
|
30282
29607
|
);
|
|
30283
29608
|
}
|
|
30284
29609
|
if (mode.mode === "create-agent") {
|
|
30285
|
-
return /* @__PURE__ */
|
|
29610
|
+
return /* @__PURE__ */ React101.createElement(
|
|
30286
29611
|
CreateAgentWizard,
|
|
30287
29612
|
{
|
|
30288
29613
|
tools,
|
|
@@ -30297,7 +29622,7 @@ ${changes.join("\n")}`);
|
|
|
30297
29622
|
);
|
|
30298
29623
|
}
|
|
30299
29624
|
if (mode.mode === "agent-menu") {
|
|
30300
|
-
return /* @__PURE__ */
|
|
29625
|
+
return /* @__PURE__ */ React101.createElement(
|
|
30301
29626
|
AgentMenu,
|
|
30302
29627
|
{
|
|
30303
29628
|
agent: mode.agent,
|
|
@@ -30312,7 +29637,7 @@ ${changes.join("\n")}`);
|
|
|
30312
29637
|
);
|
|
30313
29638
|
}
|
|
30314
29639
|
if (mode.mode === "view-agent") {
|
|
30315
|
-
return /* @__PURE__ */
|
|
29640
|
+
return /* @__PURE__ */ React101.createElement(
|
|
30316
29641
|
ViewAgent,
|
|
30317
29642
|
{
|
|
30318
29643
|
agent: mode.agent,
|
|
@@ -30322,7 +29647,7 @@ ${changes.join("\n")}`);
|
|
|
30322
29647
|
);
|
|
30323
29648
|
}
|
|
30324
29649
|
if (mode.mode === "edit-agent") {
|
|
30325
|
-
return /* @__PURE__ */
|
|
29650
|
+
return /* @__PURE__ */ React101.createElement(
|
|
30326
29651
|
EditAgent,
|
|
30327
29652
|
{
|
|
30328
29653
|
agent: mode.agent,
|
|
@@ -30337,7 +29662,7 @@ ${changes.join("\n")}`);
|
|
|
30337
29662
|
);
|
|
30338
29663
|
}
|
|
30339
29664
|
if (mode.mode === "delete-confirm") {
|
|
30340
|
-
return /* @__PURE__ */
|
|
29665
|
+
return /* @__PURE__ */ React101.createElement(
|
|
30341
29666
|
DeleteConfirm,
|
|
30342
29667
|
{
|
|
30343
29668
|
agent: mode.agent,
|
|
@@ -30362,7 +29687,7 @@ var agents_default = {
|
|
|
30362
29687
|
isEnabled: true,
|
|
30363
29688
|
isHidden: false,
|
|
30364
29689
|
async call(onExit) {
|
|
30365
|
-
return /* @__PURE__ */
|
|
29690
|
+
return /* @__PURE__ */ React102.createElement(AgentsUI, { onExit });
|
|
30366
29691
|
},
|
|
30367
29692
|
userFacingName() {
|
|
30368
29693
|
return "agents";
|
|
@@ -30434,8 +29759,8 @@ function getCommand(commandName, commands) {
|
|
|
30434
29759
|
var TOOL_NAME_FOR_PROMPT7 = "SlashCommand";
|
|
30435
29760
|
|
|
30436
29761
|
// src/tools/interaction/SlashCommandTool/SlashCommandTool.tsx
|
|
30437
|
-
var
|
|
30438
|
-
command:
|
|
29762
|
+
var inputSchema12 = z11.strictObject({
|
|
29763
|
+
command: z11.string().describe(
|
|
30439
29764
|
'The slash command to execute with its arguments, e.g., "/review-pr 123"'
|
|
30440
29765
|
)
|
|
30441
29766
|
});
|
|
@@ -30460,7 +29785,7 @@ var SlashCommandTool = {
|
|
|
30460
29785
|
userFacingName() {
|
|
30461
29786
|
return "SlashCommand";
|
|
30462
29787
|
},
|
|
30463
|
-
inputSchema:
|
|
29788
|
+
inputSchema: inputSchema12,
|
|
30464
29789
|
isReadOnly() {
|
|
30465
29790
|
return false;
|
|
30466
29791
|
},
|
|
@@ -30523,7 +29848,7 @@ ${availableLines}${truncatedNotice}
|
|
|
30523
29848
|
return command4 || "";
|
|
30524
29849
|
},
|
|
30525
29850
|
renderToolUseRejectedMessage() {
|
|
30526
|
-
return /* @__PURE__ */
|
|
29851
|
+
return /* @__PURE__ */ React103.createElement(FallbackToolUseRejectedMessage, null);
|
|
30527
29852
|
},
|
|
30528
29853
|
renderResultForAssistant(output) {
|
|
30529
29854
|
return `Launching command: /${output.commandName}`;
|
|
@@ -30679,9 +30004,9 @@ function parseMcpToolName2(name3) {
|
|
|
30679
30004
|
}
|
|
30680
30005
|
|
|
30681
30006
|
// src/tools/system/KillShellTool/KillShellTool.tsx
|
|
30682
|
-
import { Box as
|
|
30683
|
-
import
|
|
30684
|
-
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";
|
|
30685
30010
|
|
|
30686
30011
|
// src/tools/system/KillShellTool/prompt.ts
|
|
30687
30012
|
var TOOL_NAME_FOR_PROMPT8 = "KillShell";
|
|
@@ -30695,8 +30020,8 @@ var PROMPT7 = `
|
|
|
30695
30020
|
`;
|
|
30696
30021
|
|
|
30697
30022
|
// src/tools/system/KillShellTool/KillShellTool.tsx
|
|
30698
|
-
var
|
|
30699
|
-
shell_id:
|
|
30023
|
+
var inputSchema13 = z12.strictObject({
|
|
30024
|
+
shell_id: z12.string().describe("The ID of the background shell to kill")
|
|
30700
30025
|
});
|
|
30701
30026
|
var KillShellTool = {
|
|
30702
30027
|
name: TOOL_NAME_FOR_PROMPT8,
|
|
@@ -30706,7 +30031,7 @@ var KillShellTool = {
|
|
|
30706
30031
|
userFacingName() {
|
|
30707
30032
|
return "Kill Shell";
|
|
30708
30033
|
},
|
|
30709
|
-
inputSchema:
|
|
30034
|
+
inputSchema: inputSchema13,
|
|
30710
30035
|
isReadOnly() {
|
|
30711
30036
|
return false;
|
|
30712
30037
|
},
|
|
@@ -30726,10 +30051,10 @@ var KillShellTool = {
|
|
|
30726
30051
|
return `Kill shell: ${shell_id}`;
|
|
30727
30052
|
},
|
|
30728
30053
|
renderToolUseRejectedMessage() {
|
|
30729
|
-
return /* @__PURE__ */
|
|
30054
|
+
return /* @__PURE__ */ React104.createElement(FallbackToolUseRejectedMessage, null);
|
|
30730
30055
|
},
|
|
30731
30056
|
renderToolResultMessage(output) {
|
|
30732
|
-
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"));
|
|
30733
30058
|
},
|
|
30734
30059
|
renderResultForAssistant(output) {
|
|
30735
30060
|
return JSON.stringify(output);
|
|
@@ -30771,7 +30096,6 @@ var KillShellTool = {
|
|
|
30771
30096
|
|
|
30772
30097
|
// src/core/permissions/rules/planMode.ts
|
|
30773
30098
|
var PLAN_MODE_ALLOWED_NON_READONLY_TOOLS = /* @__PURE__ */ new Set([
|
|
30774
|
-
ExitPlanModeTool.name,
|
|
30775
30099
|
KillShellTool.name
|
|
30776
30100
|
]);
|
|
30777
30101
|
|
|
@@ -31027,7 +30351,7 @@ var hasPermissionsToUseTool = async (tool, input, context, _assistantMessage) =>
|
|
|
31027
30351
|
const permissionResult = await (async () => {
|
|
31028
30352
|
switch (tool) {
|
|
31029
30353
|
case BashTool: {
|
|
31030
|
-
const { command: command4, dangerouslyDisableSandbox } =
|
|
30354
|
+
const { command: command4, dangerouslyDisableSandbox } = inputSchema11.parse(input);
|
|
31031
30355
|
const trimmed = command4.trim();
|
|
31032
30356
|
if (isSafeBashCommand(trimmed)) {
|
|
31033
30357
|
return { result: true };
|
|
@@ -31431,7 +30755,7 @@ function WebFetchPermissionRequest({
|
|
|
31431
30755
|
verbose
|
|
31432
30756
|
}) {
|
|
31433
30757
|
const theme = getTheme();
|
|
31434
|
-
const unaryEvent =
|
|
30758
|
+
const unaryEvent = useMemo27(
|
|
31435
30759
|
() => ({ completion_type: "tool_use_single", language_name: "none" }),
|
|
31436
30760
|
[]
|
|
31437
30761
|
);
|
|
@@ -31451,13 +30775,13 @@ function WebFetchPermissionRequest({
|
|
|
31451
30775
|
toolUseConfirm.onReject();
|
|
31452
30776
|
onDone();
|
|
31453
30777
|
};
|
|
31454
|
-
|
|
30778
|
+
useInput29((_input, key) => {
|
|
31455
30779
|
if (key.escape) {
|
|
31456
30780
|
reject();
|
|
31457
30781
|
}
|
|
31458
30782
|
});
|
|
31459
|
-
return /* @__PURE__ */
|
|
31460
|
-
|
|
30783
|
+
return /* @__PURE__ */ React105.createElement(
|
|
30784
|
+
Box76,
|
|
31461
30785
|
{
|
|
31462
30786
|
flexDirection: "column",
|
|
31463
30787
|
borderStyle: "round",
|
|
@@ -31467,14 +30791,14 @@ function WebFetchPermissionRequest({
|
|
|
31467
30791
|
paddingRight: 1,
|
|
31468
30792
|
paddingBottom: 1
|
|
31469
30793
|
},
|
|
31470
|
-
/* @__PURE__ */
|
|
30794
|
+
/* @__PURE__ */ React105.createElement(
|
|
31471
30795
|
PermissionRequestTitle,
|
|
31472
30796
|
{
|
|
31473
30797
|
title: "Network request outside of sandbox",
|
|
31474
30798
|
riskScore: null
|
|
31475
30799
|
}
|
|
31476
30800
|
),
|
|
31477
|
-
/* @__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(
|
|
31478
30802
|
Select,
|
|
31479
30803
|
{
|
|
31480
30804
|
options: [
|
|
@@ -31679,13 +31003,13 @@ function countNewlines(text) {
|
|
|
31679
31003
|
}
|
|
31680
31004
|
return count;
|
|
31681
31005
|
}
|
|
31682
|
-
var
|
|
31683
|
-
command:
|
|
31684
|
-
cwd:
|
|
31006
|
+
var inputSchema11 = z13.strictObject({
|
|
31007
|
+
command: z13.string().describe("The command to execute"),
|
|
31008
|
+
cwd: z13.string().optional().describe(
|
|
31685
31009
|
"The directory to execute the command in. Use absolute path or path relative to the project root."
|
|
31686
31010
|
),
|
|
31687
|
-
timeout:
|
|
31688
|
-
description:
|
|
31011
|
+
timeout: z13.number().optional().describe("Optional timeout in milliseconds (max 600000)"),
|
|
31012
|
+
description: z13.string().optional().describe(
|
|
31689
31013
|
`Clear, concise description of what this command does in 5-10 words, in active voice. Examples:
|
|
31690
31014
|
Input: ls
|
|
31691
31015
|
Output: List files in current directory
|
|
@@ -31699,10 +31023,10 @@ Output: Install package dependencies
|
|
|
31699
31023
|
Input: mkdir foo
|
|
31700
31024
|
Output: Create directory 'foo'`
|
|
31701
31025
|
),
|
|
31702
|
-
run_in_background:
|
|
31026
|
+
run_in_background: z13.boolean().optional().describe(
|
|
31703
31027
|
"Set to true to run this command in the background. Use TaskOutput to read the output later."
|
|
31704
31028
|
),
|
|
31705
|
-
dangerouslyDisableSandbox:
|
|
31029
|
+
dangerouslyDisableSandbox: z13.boolean().optional().describe(
|
|
31706
31030
|
"Set this to true to dangerously override sandbox mode and run commands without sandboxing."
|
|
31707
31031
|
)
|
|
31708
31032
|
});
|
|
@@ -31722,7 +31046,7 @@ var BashTool = {
|
|
|
31722
31046
|
isConcurrencySafe(input) {
|
|
31723
31047
|
return this.isReadOnly(input);
|
|
31724
31048
|
},
|
|
31725
|
-
inputSchema:
|
|
31049
|
+
inputSchema: inputSchema11,
|
|
31726
31050
|
userFacingName(input) {
|
|
31727
31051
|
if (!input) return "Bash";
|
|
31728
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;
|
|
@@ -31846,10 +31170,10 @@ var BashTool = {
|
|
|
31846
31170
|
return withDescription(base.trim());
|
|
31847
31171
|
},
|
|
31848
31172
|
renderToolUseRejectedMessage() {
|
|
31849
|
-
return /* @__PURE__ */
|
|
31173
|
+
return /* @__PURE__ */ React106.createElement(FallbackToolUseRejectedMessage, null);
|
|
31850
31174
|
},
|
|
31851
31175
|
renderToolResultMessage(content) {
|
|
31852
|
-
return /* @__PURE__ */
|
|
31176
|
+
return /* @__PURE__ */ React106.createElement(BashToolResultMessage_default, { content, verbose: false });
|
|
31853
31177
|
},
|
|
31854
31178
|
renderResultForAssistant({
|
|
31855
31179
|
interrupted,
|
|
@@ -32090,7 +31414,7 @@ Did you mean "git ${cmdParts.slice(1).join(" ")}"?`;
|
|
|
32090
31414
|
}
|
|
32091
31415
|
};
|
|
32092
31416
|
setToolJSX({
|
|
32093
|
-
jsx: /* @__PURE__ */
|
|
31417
|
+
jsx: /* @__PURE__ */ React106.createElement(
|
|
32094
31418
|
WebFetchPermissionRequest,
|
|
32095
31419
|
{
|
|
32096
31420
|
toolUseConfirm,
|
|
@@ -32286,7 +31610,7 @@ ${footerParts.join(" ")}`;
|
|
|
32286
31610
|
if (!overlayShown && setToolJSX && Date.now() - startedAt >= PROGRESS_INITIAL_DELAY_MS) {
|
|
32287
31611
|
overlayShown = true;
|
|
32288
31612
|
setToolJSX({
|
|
32289
|
-
jsx: /* @__PURE__ */
|
|
31613
|
+
jsx: /* @__PURE__ */ React106.createElement(
|
|
32290
31614
|
BashToolRunInBackgroundOverlay,
|
|
32291
31615
|
{
|
|
32292
31616
|
onBackground: requestBackground
|
|
@@ -32476,7 +31800,7 @@ NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTAN
|
|
|
32476
31800
|
` : ""}
|
|
32477
31801
|
|
|
32478
31802
|
# Tool usage policy
|
|
32479
|
-
- **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.
|
|
32480
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.
|
|
32481
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.
|
|
32482
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.
|
|
@@ -32569,7 +31893,6 @@ export {
|
|
|
32569
31893
|
WebSearchTool,
|
|
32570
31894
|
SlashCommandTool,
|
|
32571
31895
|
SkillTool,
|
|
32572
|
-
ExitPlanModeTool,
|
|
32573
31896
|
KillShellTool,
|
|
32574
31897
|
hasPermissionsToUseTool,
|
|
32575
31898
|
BashTool,
|
|
@@ -32597,7 +31920,6 @@ export {
|
|
|
32597
31920
|
listTasks,
|
|
32598
31921
|
updateTask,
|
|
32599
31922
|
rebuildTaskBlocks,
|
|
32600
|
-
EnterPlanModeTool,
|
|
32601
31923
|
AskUserQuestionTool,
|
|
32602
31924
|
addToHistory,
|
|
32603
31925
|
countTokens,
|