pybao-cli 1.4.80 → 1.4.82

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.
Files changed (166) hide show
  1. package/dist/REPL-VOJCD6X6.js +49 -0
  2. package/dist/{acp-PA6S5MGT.js → acp-ASRH57AF.js} +79 -32
  3. package/dist/acp-ASRH57AF.js.map +7 -0
  4. package/dist/{agentsValidate-YM6XVDQL.js → agentsValidate-35AHZXNB.js} +7 -9
  5. package/dist/agentsValidate-35AHZXNB.js.map +7 -0
  6. package/dist/ask-TI3ITWN7.js +143 -0
  7. package/dist/ask-TI3ITWN7.js.map +7 -0
  8. package/dist/{autoUpdater-AKRMM25L.js → autoUpdater-MRK5BD2L.js} +3 -3
  9. package/dist/{chunk-CP3HV6YN.js → chunk-2AG4BTRV.js} +1 -1
  10. package/dist/{chunk-OQA7RUJA.js → chunk-2S2V2ZI7.js} +16 -22
  11. package/dist/chunk-2S2V2ZI7.js.map +7 -0
  12. package/dist/{chunk-LLSY2GBI.js → chunk-2WIUQUTU.js} +3 -3
  13. package/dist/{chunk-MIUJHRUY.js → chunk-2YM35XWE.js} +3 -3
  14. package/dist/{chunk-AERD7AWQ.js → chunk-AUGXOUTX.js} +11 -1
  15. package/dist/chunk-AUGXOUTX.js.map +7 -0
  16. package/dist/{chunk-TG7JXSXM.js → chunk-AYVB6VUF.js} +1 -1
  17. package/dist/{chunk-PXEQDOU3.js → chunk-DYJD66YF.js} +1 -1
  18. package/dist/{chunk-744K4I7E.js → chunk-DZTZPEPA.js} +2 -2
  19. package/dist/chunk-F4AXICO7.js +28 -0
  20. package/dist/chunk-F4AXICO7.js.map +7 -0
  21. package/dist/{chunk-BWTCQG4X.js → chunk-GSAG6WNQ.js} +1 -1
  22. package/dist/{chunk-CWZPDQJA.js → chunk-GUTLXPN6.js} +38 -4
  23. package/dist/{chunk-CWZPDQJA.js.map → chunk-GUTLXPN6.js.map} +2 -2
  24. package/dist/{chunk-3WG3WTUV.js → chunk-GZT2DWED.js} +1 -1
  25. package/dist/{chunk-3SFRVXA2.js → chunk-HJWUPFGF.js} +4 -4
  26. package/dist/{chunk-WTRPPL2M.js → chunk-IIVG2SHE.js} +3 -3
  27. package/dist/{chunk-JM762ZDE.js → chunk-JQVZNIKI.js} +4 -4
  28. package/dist/{chunk-KTATOOLL.js → chunk-JT3RE7UH.js} +6 -22
  29. package/dist/{chunk-KTATOOLL.js.map → chunk-JT3RE7UH.js.map} +3 -3
  30. package/dist/{chunk-3CW5FEOJ.js → chunk-KNWW4HGV.js} +2 -2
  31. package/dist/chunk-LM665HND.js +262 -0
  32. package/dist/chunk-LM665HND.js.map +7 -0
  33. package/dist/{chunk-42HW6S7R.js → chunk-NTL5PKCX.js} +3 -3
  34. package/dist/{chunk-7ZNKXJQ6.js → chunk-PXPTGNYH.js} +2 -2
  35. package/dist/{chunk-2QU7ZSUS.js → chunk-QUWUFGZF.js} +4 -4
  36. package/dist/{chunk-I37OY5QI.js → chunk-SZEYDC6A.js} +3 -3
  37. package/dist/{chunk-3PA2KVRH.js → chunk-TWWQYBVK.js} +3 -3
  38. package/dist/{chunk-LMS74RIF.js → chunk-U265OPSO.js} +5 -25
  39. package/dist/chunk-U265OPSO.js.map +7 -0
  40. package/dist/{chunk-F5LYIQAC.js → chunk-UBX7JQR2.js} +2 -2
  41. package/dist/{chunk-VHWL7AZC.js → chunk-UXVOYFKL.js} +2 -2
  42. package/dist/{chunk-FTXFHBBF.js → chunk-VMWEFYQB.js} +1 -1
  43. package/dist/{chunk-QOJN4AXT.js → chunk-WBBMOYXK.js} +1 -1
  44. package/dist/{chunk-QOJN4AXT.js.map → chunk-WBBMOYXK.js.map} +1 -1
  45. package/dist/{chunk-EZ5OXAWM.js → chunk-WVYIFMLG.js} +4 -4
  46. package/dist/chunk-XKYHFZEC.js +68 -0
  47. package/dist/chunk-XKYHFZEC.js.map +7 -0
  48. package/dist/{chunk-XNEBNYWQ.js → chunk-XOOHCC63.js} +996 -1479
  49. package/dist/chunk-XOOHCC63.js.map +7 -0
  50. package/dist/{chunk-455FF5IG.js → chunk-Y5JPSTQ4.js} +1 -1
  51. package/dist/{chunk-JD2LVXSN.js → chunk-ZW25QNXS.js} +3 -3
  52. package/dist/{cli-6XU5K75R.js → cli-ECB4WYUZ.js} +399 -379
  53. package/dist/cli-ECB4WYUZ.js.map +7 -0
  54. package/dist/commands-3B77L2SI.js +53 -0
  55. package/dist/{config-REKPGWPW.js → config-KZHPV37P.js} +4 -4
  56. package/dist/{context-7V2M3ID6.js → context-ZZI53BPM.js} +6 -6
  57. package/dist/conversationTracker-SC6NCQHL.js +17 -0
  58. package/dist/{customCommands-WLOMXCCK.js → customCommands-MX6OENKO.js} +4 -4
  59. package/dist/{env-35CB7KWZ.js → env-76WAAGI6.js} +2 -2
  60. package/dist/{file-TCC75FSO.js → file-LCS77XWE.js} +4 -4
  61. package/dist/index.js +3 -3
  62. package/dist/{llm-C6QFJQ42.js → llm-AR66BS2U.js} +32 -29
  63. package/dist/{llm-C6QFJQ42.js.map → llm-AR66BS2U.js.map} +1 -1
  64. package/dist/{llmLazy-7GZ6NMOQ.js → llmLazy-5W6E5BCB.js} +1 -1
  65. package/dist/{loader-X6LBDHGF.js → loader-OWZ3WD2X.js} +4 -4
  66. package/dist/{lsp-SWPSA5Q7.js → lsp-NLPSJYH4.js} +6 -6
  67. package/dist/{lspAnchor-7DFVRBS2.js → lspAnchor-MWASWGQD.js} +6 -6
  68. package/dist/{mcp-PHB7FETI.js → mcp-T2UB74Y2.js} +7 -7
  69. package/dist/{mentionProcessor-V26NXWYI.js → mentionProcessor-KIBWOHEC.js} +5 -5
  70. package/dist/{messages-WHTP6PI3.js → messages-6BHCXDWR.js} +5 -1
  71. package/dist/{model-5DT4TF4B.js → model-5NDSZPIL.js} +5 -5
  72. package/dist/{openai-737OOCXA.js → openai-7XPWH2G7.js} +6 -5
  73. package/dist/{outputStyles-EPSYXOCH.js → outputStyles-QUE4ALJQ.js} +4 -4
  74. package/dist/{pluginRuntime-NUMYY7SH.js → pluginRuntime-PQ3VZRX7.js} +6 -6
  75. package/dist/{pluginValidation-27NUUYNZ.js → pluginValidation-RQ34XQY3.js} +6 -6
  76. package/dist/prompts-5576MRUX.js +55 -0
  77. package/dist/{pybAgentSessionLoad-QMQTSGQ7.js → pybAgentSessionLoad-5MWAY2A4.js} +4 -4
  78. package/dist/{pybAgentSessionResume-RX3URXYK.js → pybAgentSessionResume-NZGSUGGS.js} +4 -4
  79. package/dist/{pybAgentStreamJsonSession-V2QVHE7Y.js → pybAgentStreamJsonSession-UP4WOINX.js} +3 -3
  80. package/dist/pybAgentStreamJsonSession-UP4WOINX.js.map +7 -0
  81. package/dist/{pybHooks-WR66ZII4.js → pybHooks-HILU7ZB4.js} +4 -4
  82. package/dist/query-LMPE4HBF.js +57 -0
  83. package/dist/{registry-3Z3F4SUL.js → registry-4MWYBUFA.js} +5 -5
  84. package/dist/replSessionBridge-EBXNFUAD.js +10 -0
  85. package/dist/{ripgrep-5FHFS5OM.js → ripgrep-J74GL455.js} +3 -3
  86. package/dist/{skillMarketplace-HC5HJ4MG.js → skillMarketplace-ATLDIEEX.js} +3 -3
  87. package/dist/{state-LXTRD5P4.js → state-Y2Q4MPY5.js} +2 -2
  88. package/dist/{theme-XFUQOISY.js → theme-3L66ZU5Z.js} +5 -5
  89. package/dist/{toolPermissionSettings-Z2IVN6T2.js → toolPermissionSettings-PDGMFGN2.js} +6 -6
  90. package/dist/toolPermissionSettings-PDGMFGN2.js.map +7 -0
  91. package/dist/tools-45UHHM5S.js +54 -0
  92. package/dist/tools-45UHHM5S.js.map +7 -0
  93. package/dist/{userInput-CVQ4TYJZ.js → userInput-GBXOUS4W.js} +40 -36
  94. package/dist/userInput-GBXOUS4W.js.map +7 -0
  95. package/package.json +1 -1
  96. package/dist/REPL-4JXH3XRO.js +0 -46
  97. package/dist/acp-PA6S5MGT.js.map +0 -7
  98. package/dist/agentsValidate-YM6XVDQL.js.map +0 -7
  99. package/dist/ask-TKEZYYAI.js +0 -129
  100. package/dist/ask-TKEZYYAI.js.map +0 -7
  101. package/dist/chunk-AERD7AWQ.js.map +0 -7
  102. package/dist/chunk-LMS74RIF.js.map +0 -7
  103. package/dist/chunk-OQA7RUJA.js.map +0 -7
  104. package/dist/chunk-XNEBNYWQ.js.map +0 -7
  105. package/dist/cli-6XU5K75R.js.map +0 -7
  106. package/dist/commands-LBQTQ6YP.js +0 -50
  107. package/dist/prompts-HHTQ43AP.js +0 -52
  108. package/dist/pybAgentStreamJsonSession-V2QVHE7Y.js.map +0 -7
  109. package/dist/query-LQZ7XTT3.js +0 -54
  110. package/dist/tools-A3ZAFFOB.js +0 -51
  111. package/dist/userInput-CVQ4TYJZ.js.map +0 -7
  112. /package/dist/{REPL-4JXH3XRO.js.map → REPL-VOJCD6X6.js.map} +0 -0
  113. /package/dist/{autoUpdater-AKRMM25L.js.map → autoUpdater-MRK5BD2L.js.map} +0 -0
  114. /package/dist/{chunk-CP3HV6YN.js.map → chunk-2AG4BTRV.js.map} +0 -0
  115. /package/dist/{chunk-LLSY2GBI.js.map → chunk-2WIUQUTU.js.map} +0 -0
  116. /package/dist/{chunk-MIUJHRUY.js.map → chunk-2YM35XWE.js.map} +0 -0
  117. /package/dist/{chunk-TG7JXSXM.js.map → chunk-AYVB6VUF.js.map} +0 -0
  118. /package/dist/{chunk-PXEQDOU3.js.map → chunk-DYJD66YF.js.map} +0 -0
  119. /package/dist/{chunk-744K4I7E.js.map → chunk-DZTZPEPA.js.map} +0 -0
  120. /package/dist/{chunk-BWTCQG4X.js.map → chunk-GSAG6WNQ.js.map} +0 -0
  121. /package/dist/{chunk-3WG3WTUV.js.map → chunk-GZT2DWED.js.map} +0 -0
  122. /package/dist/{chunk-3SFRVXA2.js.map → chunk-HJWUPFGF.js.map} +0 -0
  123. /package/dist/{chunk-WTRPPL2M.js.map → chunk-IIVG2SHE.js.map} +0 -0
  124. /package/dist/{chunk-JM762ZDE.js.map → chunk-JQVZNIKI.js.map} +0 -0
  125. /package/dist/{chunk-3CW5FEOJ.js.map → chunk-KNWW4HGV.js.map} +0 -0
  126. /package/dist/{chunk-42HW6S7R.js.map → chunk-NTL5PKCX.js.map} +0 -0
  127. /package/dist/{chunk-7ZNKXJQ6.js.map → chunk-PXPTGNYH.js.map} +0 -0
  128. /package/dist/{chunk-2QU7ZSUS.js.map → chunk-QUWUFGZF.js.map} +0 -0
  129. /package/dist/{chunk-I37OY5QI.js.map → chunk-SZEYDC6A.js.map} +0 -0
  130. /package/dist/{chunk-3PA2KVRH.js.map → chunk-TWWQYBVK.js.map} +0 -0
  131. /package/dist/{chunk-F5LYIQAC.js.map → chunk-UBX7JQR2.js.map} +0 -0
  132. /package/dist/{chunk-VHWL7AZC.js.map → chunk-UXVOYFKL.js.map} +0 -0
  133. /package/dist/{chunk-FTXFHBBF.js.map → chunk-VMWEFYQB.js.map} +0 -0
  134. /package/dist/{chunk-EZ5OXAWM.js.map → chunk-WVYIFMLG.js.map} +0 -0
  135. /package/dist/{chunk-455FF5IG.js.map → chunk-Y5JPSTQ4.js.map} +0 -0
  136. /package/dist/{chunk-JD2LVXSN.js.map → chunk-ZW25QNXS.js.map} +0 -0
  137. /package/dist/{commands-LBQTQ6YP.js.map → commands-3B77L2SI.js.map} +0 -0
  138. /package/dist/{config-REKPGWPW.js.map → config-KZHPV37P.js.map} +0 -0
  139. /package/dist/{context-7V2M3ID6.js.map → context-ZZI53BPM.js.map} +0 -0
  140. /package/dist/{customCommands-WLOMXCCK.js.map → conversationTracker-SC6NCQHL.js.map} +0 -0
  141. /package/dist/{env-35CB7KWZ.js.map → customCommands-MX6OENKO.js.map} +0 -0
  142. /package/dist/{file-TCC75FSO.js.map → env-76WAAGI6.js.map} +0 -0
  143. /package/dist/{llmLazy-7GZ6NMOQ.js.map → file-LCS77XWE.js.map} +0 -0
  144. /package/dist/{loader-X6LBDHGF.js.map → llmLazy-5W6E5BCB.js.map} +0 -0
  145. /package/dist/{lsp-SWPSA5Q7.js.map → loader-OWZ3WD2X.js.map} +0 -0
  146. /package/dist/{mcp-PHB7FETI.js.map → lsp-NLPSJYH4.js.map} +0 -0
  147. /package/dist/{lspAnchor-7DFVRBS2.js.map → lspAnchor-MWASWGQD.js.map} +0 -0
  148. /package/dist/{messages-WHTP6PI3.js.map → mcp-T2UB74Y2.js.map} +0 -0
  149. /package/dist/{mentionProcessor-V26NXWYI.js.map → mentionProcessor-KIBWOHEC.js.map} +0 -0
  150. /package/dist/{model-5DT4TF4B.js.map → messages-6BHCXDWR.js.map} +0 -0
  151. /package/dist/{openai-737OOCXA.js.map → model-5NDSZPIL.js.map} +0 -0
  152. /package/dist/{outputStyles-EPSYXOCH.js.map → openai-7XPWH2G7.js.map} +0 -0
  153. /package/dist/{pluginValidation-27NUUYNZ.js.map → outputStyles-QUE4ALJQ.js.map} +0 -0
  154. /package/dist/{pluginRuntime-NUMYY7SH.js.map → pluginRuntime-PQ3VZRX7.js.map} +0 -0
  155. /package/dist/{prompts-HHTQ43AP.js.map → pluginValidation-RQ34XQY3.js.map} +0 -0
  156. /package/dist/{pybAgentSessionLoad-QMQTSGQ7.js.map → prompts-5576MRUX.js.map} +0 -0
  157. /package/dist/{pybAgentSessionResume-RX3URXYK.js.map → pybAgentSessionLoad-5MWAY2A4.js.map} +0 -0
  158. /package/dist/{pybHooks-WR66ZII4.js.map → pybAgentSessionResume-NZGSUGGS.js.map} +0 -0
  159. /package/dist/{query-LQZ7XTT3.js.map → pybHooks-HILU7ZB4.js.map} +0 -0
  160. /package/dist/{registry-3Z3F4SUL.js.map → query-LMPE4HBF.js.map} +0 -0
  161. /package/dist/{ripgrep-5FHFS5OM.js.map → registry-4MWYBUFA.js.map} +0 -0
  162. /package/dist/{skillMarketplace-HC5HJ4MG.js.map → replSessionBridge-EBXNFUAD.js.map} +0 -0
  163. /package/dist/{state-LXTRD5P4.js.map → ripgrep-J74GL455.js.map} +0 -0
  164. /package/dist/{theme-XFUQOISY.js.map → skillMarketplace-ATLDIEEX.js.map} +0 -0
  165. /package/dist/{toolPermissionSettings-Z2IVN6T2.js.map → state-Y2Q4MPY5.js.map} +0 -0
  166. /package/dist/{tools-A3ZAFFOB.js.map → theme-3L66ZU5Z.js.map} +0 -0
@@ -1,20 +1,31 @@
1
1
  import { createRequire as __pybCreateRequire } from "node:module";
2
2
  const require = __pybCreateRequire(import.meta.url);
3
+ import {
4
+ listPybAgentSessions
5
+ } from "./chunk-GZT2DWED.js";
3
6
  import {
4
7
  formatValidationResult,
5
8
  validatePluginOrMarketplacePath
6
- } from "./chunk-JD2LVXSN.js";
9
+ } from "./chunk-ZW25QNXS.js";
7
10
  import {
8
- loadPybAgentSessionMessages
9
- } from "./chunk-TG7JXSXM.js";
11
+ ConversationTracker,
12
+ appendFinishState,
13
+ findNaturalUserMessageForParent,
14
+ getConversationTrackerForContext,
15
+ isFinishComplete,
16
+ mapFinishReason
17
+ } from "./chunk-LM665HND.js";
10
18
  import {
11
- listPybAgentSessions
12
- } from "./chunk-3WG3WTUV.js";
19
+ beginReplSessionScope
20
+ } from "./chunk-F4AXICO7.js";
21
+ import {
22
+ loadPybAgentSessionMessages
23
+ } from "./chunk-AYVB6VUF.js";
13
24
  import {
14
25
  appendSessionCustomTitleRecord,
15
26
  appendSessionJsonlFromMessage,
16
27
  appendSessionTagRecord
17
- } from "./chunk-F5LYIQAC.js";
28
+ } from "./chunk-UBX7JQR2.js";
18
29
  import {
19
30
  drainHookSystemPromptAdditions,
20
31
  getHookTranscriptPath,
@@ -26,7 +37,7 @@ import {
26
37
  runStopHooks,
27
38
  runUserPromptSubmitHooks,
28
39
  updateHookTranscriptForMessages
29
- } from "./chunk-WTRPPL2M.js";
40
+ } from "./chunk-IIVG2SHE.js";
30
41
  import {
31
42
  DEFAULT_OUTPUT_STYLE,
32
43
  getAvailableOutputStyles,
@@ -35,17 +46,19 @@ import {
35
46
  getOutputStyleSystemPromptAdditions,
36
47
  resolveOutputStyleName,
37
48
  setCurrentOutputStyle
38
- } from "./chunk-VHWL7AZC.js";
49
+ } from "./chunk-UXVOYFKL.js";
39
50
  import {
40
51
  fetchCustomModels,
41
- getModelFeatures,
52
+ getModelFeatures
53
+ } from "./chunk-JT3RE7UH.js";
54
+ import {
42
55
  getSessionState
43
- } from "./chunk-KTATOOLL.js";
56
+ } from "./chunk-XKYHFZEC.js";
44
57
  import {
45
58
  queryLLM,
46
59
  queryQuick,
47
60
  verifyApiKey
48
- } from "./chunk-3SFRVXA2.js";
61
+ } from "./chunk-HJWUPFGF.js";
49
62
  import {
50
63
  DEFAULT_TIMEOUT_MS,
51
64
  FallbackToolUseRejectedMessage,
@@ -59,7 +72,7 @@ import {
59
72
  listMCPServers,
60
73
  loadMergedSettings,
61
74
  normalizeSandboxRuntimeConfigFromSettings
62
- } from "./chunk-2QU7ZSUS.js";
75
+ } from "./chunk-QUWUFGZF.js";
63
76
  import {
64
77
  addMarketplace,
65
78
  disableSkillPlugin,
@@ -72,11 +85,11 @@ import {
72
85
  refreshMarketplaceAsync,
73
86
  removeMarketplace,
74
87
  uninstallSkillPlugin
75
- } from "./chunk-BWTCQG4X.js";
88
+ } from "./chunk-GSAG6WNQ.js";
76
89
  import {
77
90
  loadToolPermissionContextFromDisk,
78
91
  persistToolPermissionUpdateToDisk
79
- } from "./chunk-I37OY5QI.js";
92
+ } from "./chunk-SZEYDC6A.js";
80
93
  import {
81
94
  applyToolPermissionContextUpdate,
82
95
  applyToolPermissionContextUpdates,
@@ -87,13 +100,13 @@ import {
87
100
  generateSystemReminders,
88
101
  resetReminderSession,
89
102
  systemReminderService
90
- } from "./chunk-7ZNKXJQ6.js";
103
+ } from "./chunk-PXPTGNYH.js";
91
104
  import {
92
105
  clearAgentCache,
93
106
  getActiveAgents,
94
107
  getAgentByType,
95
108
  getAllAgents
96
- } from "./chunk-CWZPDQJA.js";
109
+ } from "./chunk-GUTLXPN6.js";
97
110
  import {
98
111
  API_ERROR_MESSAGE_PREFIX,
99
112
  CANCEL_MESSAGE,
@@ -124,7 +137,7 @@ import {
124
137
  processUserInput,
125
138
  reorderMessages,
126
139
  stripSystemMessages
127
- } from "./chunk-AERD7AWQ.js";
140
+ } from "./chunk-AUGXOUTX.js";
128
141
  import {
129
142
  getRequestStatus,
130
143
  setRequestStatus,
@@ -154,7 +167,7 @@ import {
154
167
  normalizeFilePath,
155
168
  readTextContent,
156
169
  writeTextContent
157
- } from "./chunk-744K4I7E.js";
170
+ } from "./chunk-DZTZPEPA.js";
158
171
  import {
159
172
  parseBlockEdits
160
173
  } from "./chunk-QWIBSCDN.js";
@@ -164,18 +177,18 @@ import {
164
177
  ParserRegistry,
165
178
  initParser,
166
179
  loadLanguage
167
- } from "./chunk-JM762ZDE.js";
180
+ } from "./chunk-JQVZNIKI.js";
168
181
  import {
169
182
  getSettingsFileCandidates,
170
183
  loadSettingsWithLegacyFallback,
171
184
  readSettingsFile
172
- } from "./chunk-CP3HV6YN.js";
185
+ } from "./chunk-2AG4BTRV.js";
173
186
  import {
174
187
  getCustomCommandDirectories,
175
188
  hasCustomCommands,
176
189
  loadCustomCommands,
177
190
  reloadCustomCommands
178
- } from "./chunk-3CW5FEOJ.js";
191
+ } from "./chunk-KNWW4HGV.js";
179
192
  import {
180
193
  getSessionPlugins
181
194
  } from "./chunk-BJSWTHRM.js";
@@ -183,7 +196,7 @@ import {
183
196
  ModelManager,
184
197
  getModelManager,
185
198
  isDefaultSlowAndCapableModel
186
- } from "./chunk-42HW6S7R.js";
199
+ } from "./chunk-NTL5PKCX.js";
187
200
  import {
188
201
  getCodeStyle,
189
202
  getContext,
@@ -191,13 +204,13 @@ import {
191
204
  getIsGit,
192
205
  getProjectDocs,
193
206
  getProjectStructureStatisticsBlock
194
- } from "./chunk-EZ5OXAWM.js";
207
+ } from "./chunk-WVYIFMLG.js";
195
208
  import {
196
209
  ripGrep
197
- } from "./chunk-FTXFHBBF.js";
210
+ } from "./chunk-VMWEFYQB.js";
198
211
  import {
199
212
  getTheme
200
- } from "./chunk-455FF5IG.js";
213
+ } from "./chunk-Y5JPSTQ4.js";
201
214
  import {
202
215
  DEFAULT_GLOBAL_CONFIG,
203
216
  enableConfigs,
@@ -210,7 +223,7 @@ import {
210
223
  saveGlobalConfig,
211
224
  setAllPointersToModel,
212
225
  setModelPointer
213
- } from "./chunk-LLSY2GBI.js";
226
+ } from "./chunk-2WIUQUTU.js";
214
227
  import {
215
228
  AbortError
216
229
  } from "./chunk-RQVLBMP7.js";
@@ -219,7 +232,7 @@ import {
219
232
  getCurrentRequest,
220
233
  logUserFriendly,
221
234
  markPhase
222
- } from "./chunk-PXEQDOU3.js";
235
+ } from "./chunk-DYJD66YF.js";
223
236
  import {
224
237
  ASCII_LOGO,
225
238
  BunShell,
@@ -231,7 +244,6 @@ import {
231
244
  SESSION_ID,
232
245
  captureException,
233
246
  dateToFilename,
234
- enterPlanMode,
235
247
  enterPlanModeForConversationKey,
236
248
  env,
237
249
  execFileNoThrow,
@@ -252,7 +264,6 @@ import {
252
264
  isMainPlanFilePathForActiveConversation,
253
265
  logError,
254
266
  overwriteLog,
255
- readPlanFile,
256
267
  renderBackgroundShellStatusAttachment,
257
268
  renderBashNotification,
258
269
  resolveXdgDataPath,
@@ -260,10 +271,10 @@ import {
260
271
  setCwd,
261
272
  shouldApplyToolOutputTruncation,
262
273
  truncateToolOutput
263
- } from "./chunk-LMS74RIF.js";
274
+ } from "./chunk-U265OPSO.js";
264
275
  import {
265
276
  MACRO
266
- } from "./chunk-QOJN4AXT.js";
277
+ } from "./chunk-WBBMOYXK.js";
267
278
  import {
268
279
  __export
269
280
  } from "./chunk-I3J4JYES.js";
@@ -272,8 +283,8 @@ import {
272
283
  import { statSync as statSync13 } from "fs";
273
284
  import { EOL as EOL3 } from "os";
274
285
  import { isAbsolute as isAbsolute8, relative as relative12, resolve as resolve10 } from "path";
275
- import * as React110 from "react";
276
- import { z as z15 } from "zod";
286
+ import * as React106 from "react";
287
+ import { z as z13 } from "zod";
277
288
 
278
289
  // src/utils/commands/index.ts
279
290
  import { memoize } from "lodash-es";
@@ -444,7 +455,7 @@ var getCommandSubcommandPrefix = memoize(
444
455
  var getCommandPrefix = memoize(
445
456
  async (command4, abortSignal) => {
446
457
  const { systemPrompt, userPrompt } = buildBashCommandPrefixDetectionPrompt(command4);
447
- const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryQuick: queryQuick2 } = await import("./llm-C6QFJQ42.js");
458
+ const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryQuick: queryQuick2 } = await import("./llm-AR66BS2U.js");
448
459
  const response = await queryQuick2({
449
460
  systemPrompt,
450
461
  userPrompt,
@@ -4246,7 +4257,7 @@ function formatParseError(error) {
4246
4257
  return error instanceof Error ? error.message : String(error);
4247
4258
  }
4248
4259
  async function defaultGateQuery(args) {
4249
- const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryLLM: queryLLM2 } = await import("./llm-C6QFJQ42.js");
4260
+ const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryLLM: queryLLM2 } = await import("./llm-AR66BS2U.js");
4250
4261
  const queryLLMFn = args.queryLLMOverride ?? queryLLM2;
4251
4262
  const messages = [
4252
4263
  {
@@ -5265,8 +5276,8 @@ ${formatted}`;
5265
5276
  };
5266
5277
 
5267
5278
  // src/ui/components/permissions/web-fetch-permission-request/WebFetchPermissionRequest.tsx
5268
- import { Box as Box80, Text as Text84, useInput as useInput31 } from "ink";
5269
- import React109, { useMemo as useMemo28 } from "react";
5279
+ import { Box as Box76, Text as Text80, useInput as useInput29 } from "ink";
5280
+ import React105, { useMemo as useMemo27 } from "react";
5270
5281
  import chalk16 from "chalk";
5271
5282
 
5272
5283
  // src/ui/components/custom-select/select.tsx
@@ -6643,7 +6654,7 @@ var FileEditTool = {
6643
6654
  const originalFileContent = currentFileContent;
6644
6655
  let totalPatch = [];
6645
6656
  const { SmartEdit } = await import("./smart-edit-AWHJDSU6.js");
6646
- const { findLspAnchor } = await import("./lspAnchor-7DFVRBS2.js");
6657
+ const { findLspAnchor } = await import("./lspAnchor-MWASWGQD.js");
6647
6658
  for (const op of editOperations) {
6648
6659
  const normalizedSearch = normalizeLineEndings(op.search);
6649
6660
  const normalizedReplace = normalizeLineEndings(op.replace);
@@ -8977,8 +8988,8 @@ var WebSearchTool = {
8977
8988
  };
8978
8989
 
8979
8990
  // src/tools/interaction/SlashCommandTool/SlashCommandTool.tsx
8980
- import { z as z13 } from "zod";
8981
- import * as React107 from "react";
8991
+ import { z as z11 } from "zod";
8992
+ import * as React103 from "react";
8982
8993
 
8983
8994
  // src/ui/components/Bug.tsx
8984
8995
  import { Box as Box17, Text as Text19, useInput as useInput5 } from "ink";
@@ -11347,7 +11358,7 @@ async function createAndStoreApiKey(accessToken) {
11347
11358
  }
11348
11359
  saveGlobalConfig(config2);
11349
11360
  try {
11350
- const { resetAnthropicClient } = await import("./llm-C6QFJQ42.js");
11361
+ const { resetAnthropicClient } = await import("./llm-AR66BS2U.js");
11351
11362
  resetAnthropicClient();
11352
11363
  } catch {
11353
11364
  }
@@ -15714,7 +15725,7 @@ async function refreshPluginRuntimeFromInstalls() {
15714
15725
  const existingRoots = getSessionPlugins().map((p) => p.rootDir);
15715
15726
  const dirs = Array.from(/* @__PURE__ */ new Set([...existingRoots, ...installedRoots]));
15716
15727
  if (dirs.length === 0) return [];
15717
- const { configureSessionPlugins } = await import("./pluginRuntime-NUMYY7SH.js");
15728
+ const { configureSessionPlugins } = await import("./pluginRuntime-PQ3VZRX7.js");
15718
15729
  const { errors } = await configureSessionPlugins({ pluginDirs: dirs });
15719
15730
  return errors;
15720
15731
  }
@@ -16383,7 +16394,7 @@ async function call(onDone, context) {
16383
16394
  ModelConfig,
16384
16395
  {
16385
16396
  onClose: () => {
16386
- import("./model-5DT4TF4B.js").then(({ reloadModelManager: reloadModelManager2 }) => {
16397
+ import("./model-5NDSZPIL.js").then(({ reloadModelManager: reloadModelManager2 }) => {
16387
16398
  reloadModelManager2();
16388
16399
  triggerModelConfigChange();
16389
16400
  onDone();
@@ -17517,14 +17528,14 @@ async function call2(onDone, context) {
17517
17528
  }
17518
17529
 
17519
17530
  // src/commands/resume.tsx
17520
- import * as React104 from "react";
17531
+ import * as React100 from "react";
17521
17532
 
17522
17533
  // src/ui/screens/ResumeConversation.tsx
17523
- import React103 from "react";
17534
+ import React99 from "react";
17524
17535
  import { render } from "ink";
17525
17536
 
17526
17537
  // src/ui/screens/REPL.tsx
17527
- import { Box as Box76, Newline as Newline4, Static as Static2 } from "ink";
17538
+ import { Box as Box72, Newline as Newline4, Static as Static2 } from "ink";
17528
17539
 
17529
17540
  // src/ui/components/CostThresholdDialog.tsx
17530
17541
  import { Box as Box37, Text as Text42, useInput as useInput17 } from "ink";
@@ -17577,8 +17588,8 @@ function CostThresholdDialog({ onDone }) {
17577
17588
  }
17578
17589
 
17579
17590
  // src/ui/screens/REPL.tsx
17580
- import * as React101 from "react";
17581
- import { useEffect as useEffect26, useMemo as useMemo26, useRef as useRef13, useState as useState28, useCallback as useCallback16 } from "react";
17591
+ import * as React97 from "react";
17592
+ import { useEffect as useEffect25, useMemo as useMemo25, useRef as useRef13, useState as useState27, useCallback as useCallback16 } from "react";
17582
17593
 
17583
17594
  // src/ui/components/Message.tsx
17584
17595
  import { Box as Box51 } from "ink";
@@ -17793,10 +17804,6 @@ function getPermissionMode(context) {
17793
17804
  isBypassPermissionsModeAvailable: !safeMode
17794
17805
  });
17795
17806
  }
17796
- function setPermissionMode(context, mode) {
17797
- const conversationKey = getConversationKey(context);
17798
- permissionModeByConversationKey.set(conversationKey, mode);
17799
- }
17800
17807
 
17801
17808
  // src/utils/permissions/toolPermissionContextState.ts
17802
17809
  var toolPermissionContextByConversationKey = /* @__PURE__ */ new Map();
@@ -19832,8 +19839,8 @@ function TaskPanel({
19832
19839
  }
19833
19840
 
19834
19841
  // src/ui/components/permissions/PermissionRequest.tsx
19835
- import { useInput as useInput25 } from "ink";
19836
- import * as React92 from "react";
19842
+ import { useInput as useInput23 } from "ink";
19843
+ import * as React88 from "react";
19837
19844
 
19838
19845
  // src/ui/components/permissions/file-edit-permission-request/FileEditPermissionRequest.tsx
19839
19846
  import chalk7 from "chalk";
@@ -21541,220 +21548,64 @@ function SkillPermissionRequest({
21541
21548
  );
21542
21549
  }
21543
21550
 
21544
- // src/tools/agent/PlanModeTool/EnterPlanModeTool.tsx
21551
+ // src/tools/interaction/AskUserQuestionTool/AskUserQuestionTool.tsx
21545
21552
  import { Box as Box65, Text as Text70 } from "ink";
21546
21553
  import React86 from "react";
21547
21554
  import { z as z10 } from "zod";
21548
21555
 
21549
- // src/tools/agent/PlanModeTool/prompt.ts
21550
- var ENTER_TOOL_NAME = "EnterPlanMode";
21551
- var EXIT_TOOL_NAME = "ExitPlanMode";
21552
- var ENTER_DESCRIPTION = "Enters plan mode for complex tasks requiring exploration and design";
21553
- var ENTER_PROMPT = `Use this tool proactively when you're about to start a non-trivial implementation task. It will transition you into plan mode, allowing you to explore the codebase and design an implementation approach\u2014this not only prevents wasted effort and ensures alignment with user goals when writing code, but its structured workflow also guarantees thorough analysis of the code and ultimately delivers a well-designed solution.
21554
-
21555
- ## When to Use This Tool
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
21556
+ // src/tools/interaction/AskUserQuestionTool/prompt.ts
21557
+ var TOOL_NAME_FOR_PROMPT6 = "AskUserQuestion";
21558
+ var DESCRIPTION6 = "Asks the user multiple choice questions to gather information, clarify ambiguity, understand preferences, make decisions or offer them choices.";
21559
+ var PROMPT6 = `Use this tool when you need to ask the user questions during execution. This allows you to:
21560
+ 1. Gather user preferences or requirements
21561
+ 2. Clarify ambiguous instructions
21562
+ 3. Get decisions on implementation choices as you work
21563
+ 4. Offer choices to the user about what direction to take.
21659
21564
 
21660
- 1. Initial task: "Search for and understand the implementation of vim mode in the codebase" - Do not use the exit plan mode tool because you are not planning the implementation steps of the task.
21661
- 2. Initial task: "Help me implement yank mode for vim" - Use the exit plan mode tool after you have finished planning the implementation steps of the task.
21662
- 3. Initial task: "Add a new feature to handle user authentication" - If unsure about auth method (OAuth, JWT, etc.), use AskUserQuestion first, then use exit plan mode tool after clarifying the approach.`;
21565
+ Usage notes:
21566
+ - Users will always be able to select "Other" to provide custom text input
21567
+ - Use multiSelect: true to allow multiple answers to be selected for a question
21568
+ - If you recommend a specific option, make that the first option in the list and add "(Recommended)" at the end of the label`;
21663
21569
 
21664
- // src/tools/agent/PlanModeTool/EnterPlanModeTool.tsx
21665
- var inputSchema10 = z10.strictObject({});
21666
- var EnterPlanModeTool = {
21667
- name: ENTER_TOOL_NAME,
21668
- async description() {
21669
- return ENTER_DESCRIPTION;
21670
- },
21671
- userFacingName() {
21672
- return "";
21673
- },
21674
- inputSchema: inputSchema10,
21675
- isReadOnly() {
21676
- return true;
21677
- },
21678
- isConcurrencySafe() {
21679
- return true;
21680
- },
21681
- async isEnabled() {
21570
+ // src/tools/interaction/AskUserQuestionTool/AskUserQuestionTool.tsx
21571
+ var optionSchema = z10.object({
21572
+ label: z10.string(),
21573
+ description: z10.string()
21574
+ });
21575
+ var questionSchema = z10.object({
21576
+ question: z10.string(),
21577
+ header: z10.string(),
21578
+ options: z10.array(optionSchema).min(2).max(4),
21579
+ multiSelect: z10.boolean()
21580
+ });
21581
+ var inputSchema10 = z10.strictObject({
21582
+ questions: z10.array(questionSchema).min(1).max(4),
21583
+ answers: z10.record(z10.string(), z10.string()).optional()
21584
+ }).refine(
21585
+ (input) => {
21586
+ const questionTexts = input.questions.map((q) => q.question);
21587
+ if (questionTexts.length !== new Set(questionTexts).size) return false;
21588
+ for (const question of input.questions) {
21589
+ const optionLabels = question.options.map((option) => option.label);
21590
+ if (optionLabels.length !== new Set(optionLabels).size) return false;
21591
+ }
21682
21592
  return true;
21683
21593
  },
21684
- needsPermissions() {
21685
- return false;
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
- };
21594
+ {
21595
+ message: "Question texts must be unique, option labels must be unique within each question"
21732
21596
  }
21733
- };
21734
-
21735
- // src/tools/agent/PlanModeTool/ExitPlanModeTool.tsx
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,
21597
+ );
21598
+ var AskUserQuestionTool = {
21599
+ name: TOOL_NAME_FOR_PROMPT6,
21749
21600
  async description() {
21750
- return EXIT_DESCRIPTION;
21601
+ return DESCRIPTION6;
21751
21602
  },
21752
21603
  userFacingName() {
21753
21604
  return "";
21754
21605
  },
21755
- inputSchema: inputSchema11,
21606
+ inputSchema: inputSchema10,
21756
21607
  isReadOnly() {
21757
- return false;
21608
+ return true;
21758
21609
  },
21759
21610
  isConcurrencySafe() {
21760
21611
  return true;
@@ -21769,117 +21620,25 @@ var ExitPlanModeTool = {
21769
21620
  return true;
21770
21621
  },
21771
21622
  async prompt() {
21772
- return EXIT_PROMPT;
21623
+ return PROMPT6;
21773
21624
  },
21774
21625
  renderToolUseMessage() {
21775
- return "";
21626
+ return null;
21776
21627
  },
21777
- renderToolUseRejectedMessage(_input, options = {}) {
21628
+ renderToolUseRejectedMessage() {
21778
21629
  const theme = getTheme();
21779
- const conversationKey = typeof options.conversationKey === "string" && options.conversationKey.trim() ? options.conversationKey.trim() : void 0;
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
- ))));
21630
+ 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
21631
  },
21794
- renderToolResultMessage(output) {
21632
+ renderToolResultMessage(output, _options) {
21795
21633
  const theme = getTheme();
21796
- const planPath = typeof output.filePath === "string" ? output.filePath : null;
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))));
21634
+ 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
21635
  },
21800
21636
  renderResultForAssistant(output) {
21801
- if (output.isAgent) {
21802
- return 'User has approved the plan. There is nothing else needed from you now. Please respond with "ok"';
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.**`;
21637
+ const formatted = Object.entries(output.answers).map(([question, answer]) => `"${question}"="${answer}"`).join(", ");
21638
+ return `User has answered your questions: ${formatted}. You can now continue with the user's answers in mind.`;
21865
21639
  },
21866
- async *call(input, context) {
21867
- const conversationKey = getPlanConversationKey(context);
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
- };
21640
+ async *call({ questions, answers: prefilled }) {
21641
+ const output = { questions, answers: prefilled ?? {} };
21883
21642
  yield {
21884
21643
  type: "result",
21885
21644
  data: output,
@@ -21888,613 +21647,59 @@ ${output.plan}
21888
21647
  }
21889
21648
  };
21890
21649
 
21891
- // src/ui/components/permissions/plan-mode-permission-request/EnterPlanModePermissionRequest.tsx
21892
- import { Box as Box67, Text as Text72, useInput as useInput22 } from "ink";
21893
- import React88 from "react";
21894
- function EnterPlanModePermissionRequest({
21895
- toolUseConfirm,
21896
- onDone
21897
- }) {
21898
- const theme = getTheme();
21899
- const { setMode } = usePermissionContext();
21900
- useInput22((_input, key) => {
21901
- if (key.escape) {
21902
- toolUseConfirm.onReject();
21903
- onDone();
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
- );
21650
+ // src/ui/components/permissions/ask-user-question-permission-request/AskUserQuestionPermissionRequest.tsx
21651
+ import React87, { useCallback as useCallback11, useMemo as useMemo23, useState as useState21 } from "react";
21652
+ import { Box as Box66, Text as Text71, useInput as useInput22 } from "ink";
21653
+ import figures8 from "figures";
21654
+ import stringWidth from "string-width";
21655
+ function isTextInputChar(input, key) {
21656
+ if (key.ctrl || key.meta || key.tab) return false;
21657
+ if (typeof input !== "string" || input.length === 0) return false;
21658
+ for (const char of input) {
21659
+ const code = char.codePointAt(0);
21660
+ if (code === void 0) return false;
21661
+ if (code < 32 || code === 127) return false;
21662
+ }
21663
+ return true;
21941
21664
  }
21942
-
21943
- // src/ui/components/permissions/plan-mode-permission-request/ExitPlanModePermissionRequest.tsx
21944
- import { Box as Box68, Text as Text73, useInput as useInput23 } from "ink";
21945
- import React89, { useEffect as useEffect20, useMemo as useMemo23, useState as useState21 } from "react";
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;
21665
+ function applySingleSelectNav(args) {
21666
+ const { focusedOptionIndex, key, optionCount } = args;
21667
+ if (key.downArrow) return Math.min(optionCount - 1, focusedOptionIndex + 1);
21668
+ if (key.upArrow) return Math.max(0, focusedOptionIndex - 1);
21669
+ return focusedOptionIndex;
21957
21670
  }
21958
- function resolveEditorCommand() {
21959
- const envEditor = process.env.VISUAL || process.env.EDITOR;
21960
- if (envEditor?.trim()) {
21671
+ function applyMultiSelectNav(args) {
21672
+ const { state, key, optionCount } = args;
21673
+ const nextKey = key.downArrow || key.tab && !key.shift;
21674
+ const prevKey = key.upArrow || key.tab && key.shift;
21675
+ if (state.isSubmitFocused) {
21676
+ if (prevKey) {
21677
+ return {
21678
+ focusedOptionIndex: Math.max(0, optionCount - 1),
21679
+ isSubmitFocused: false
21680
+ };
21681
+ }
21682
+ return state;
21683
+ }
21684
+ if (nextKey) {
21685
+ if (state.focusedOptionIndex >= optionCount - 1) {
21686
+ return { ...state, isSubmitFocused: true };
21687
+ }
21688
+ return { ...state, focusedOptionIndex: state.focusedOptionIndex + 1 };
21689
+ }
21690
+ if (prevKey) {
21961
21691
  return {
21962
- command: envEditor.trim(),
21963
- args: [],
21964
- displayName: envEditor.trim(),
21965
- shell: true
21692
+ ...state,
21693
+ focusedOptionIndex: Math.max(0, state.focusedOptionIndex - 1)
21966
21694
  };
21967
21695
  }
21968
- const candidates = [];
21969
- if (isCommandAvailable("code")) {
21970
- candidates.push({
21971
- command: "code",
21972
- args: ["-w"],
21973
- displayName: "code -w"
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);
21696
+ return state;
21697
+ }
21698
+ function truncateWithEllipsis(label, maxWidth) {
21699
+ if (stringWidth(label) <= maxWidth) return label;
21700
+ let candidate = label;
21701
+ while (candidate.length > 1 && stringWidth(candidate + "\u2026") > maxWidth) {
21702
+ candidate = candidate.slice(0, -1);
22498
21703
  }
22499
21704
  return candidate.length ? candidate + "\u2026" : "\u2026";
22500
21705
  }
@@ -22551,7 +21756,7 @@ function AskUserQuestionPermissionRequest({
22551
21756
  }) {
22552
21757
  const theme = getTheme();
22553
21758
  const { columns } = useTerminalSize();
22554
- const parsed = useMemo24(() => {
21759
+ const parsed = useMemo23(() => {
22555
21760
  const result = AskUserQuestionTool.inputSchema.safeParse(
22556
21761
  toolUseConfirm.input
22557
21762
  );
@@ -22566,18 +21771,18 @@ function AskUserQuestionPermissionRequest({
22566
21771
  };
22567
21772
  }, [toolUseConfirm.input]);
22568
21773
  const questions = parsed.questions;
22569
- const [currentQuestionIndex, setCurrentQuestionIndex] = useState22(0);
22570
- const [focusedOptionIndex, setFocusedOptionIndex] = useState22(0);
22571
- const [isMultiSelectSubmitFocused, setIsMultiSelectSubmitFocused] = useState22(false);
22572
- const [answers, setAnswers] = useState22(
21774
+ const [currentQuestionIndex, setCurrentQuestionIndex] = useState21(0);
21775
+ const [focusedOptionIndex, setFocusedOptionIndex] = useState21(0);
21776
+ const [isMultiSelectSubmitFocused, setIsMultiSelectSubmitFocused] = useState21(false);
21777
+ const [answers, setAnswers] = useState21(
22573
21778
  parsed.initialAnswers
22574
21779
  );
22575
- const [questionStates, setQuestionStates] = useState22({});
21780
+ const [questionStates, setQuestionStates] = useState21({});
22576
21781
  const currentQuestion = questions[currentQuestionIndex];
22577
21782
  const isSubmitTab = currentQuestionIndex === questions.length;
22578
21783
  const hideSubmitTab = questions.length === 1 && !questions[0]?.multiSelect;
22579
21784
  const maxTabIndex = hideSubmitTab ? Math.max(0, questions.length - 1) : questions.length;
22580
- const tabHeaders = useMemo24(
21785
+ const tabHeaders = useMemo23(
22581
21786
  () => getTabHeaders({
22582
21787
  questions,
22583
21788
  currentQuestionIndex,
@@ -22623,7 +21828,7 @@ function AskUserQuestionPermissionRequest({
22623
21828
  },
22624
21829
  []
22625
21830
  );
22626
- useInput24((input, key) => {
21831
+ useInput22((input, key) => {
22627
21832
  if (key.escape) {
22628
21833
  cancel();
22629
21834
  return;
@@ -22798,18 +22003,18 @@ function AskUserQuestionPermissionRequest({
22798
22003
  const rightArrowInactive = currentQuestionIndex === maxTabIndex;
22799
22004
  const allQuestionsAnswered = questions.every((q) => q?.question && Boolean(answers[q.question])) ?? false;
22800
22005
  if (questions.length === 0) {
22801
- return /* @__PURE__ */ React91.createElement(Box70, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React91.createElement(Text75, { color: theme.error }, "Invalid AskUserQuestion input."), /* @__PURE__ */ React91.createElement(Text75, { dimColor: true }, "Press Esc to cancel."));
22006
+ 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
22007
  }
22803
- return /* @__PURE__ */ React91.createElement(Box70, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React91.createElement(
22804
- Box70,
22008
+ return /* @__PURE__ */ React87.createElement(Box66, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React87.createElement(
22009
+ Box66,
22805
22010
  {
22806
22011
  borderTop: true,
22807
22012
  borderColor: theme.secondaryText,
22808
22013
  flexDirection: "column",
22809
22014
  paddingTop: 0
22810
22015
  },
22811
- /* @__PURE__ */ React91.createElement(Box70, { flexDirection: "row", marginBottom: 1 }, showArrows && /* @__PURE__ */ React91.createElement(
22812
- Text75,
22016
+ /* @__PURE__ */ React87.createElement(Box66, { flexDirection: "row", marginBottom: 1 }, showArrows && /* @__PURE__ */ React87.createElement(
22017
+ Text71,
22813
22018
  {
22814
22019
  color: currentQuestionIndex === 0 ? theme.secondaryText : void 0
22815
22020
  },
@@ -22820,16 +22025,16 @@ function AskUserQuestionPermissionRequest({
22820
22025
  const checkbox = question.question && answers[question.question] ? figures8.checkboxOn : figures8.checkboxOff;
22821
22026
  const headerText = tabHeaders[index] ?? question.header ?? `Q${index + 1}`;
22822
22027
  const tabText = ` ${checkbox} ${headerText} `;
22823
- return /* @__PURE__ */ React91.createElement(React91.Fragment, { key: question.question || `question-${index}` }, /* @__PURE__ */ React91.createElement(
22824
- Text75,
22028
+ return /* @__PURE__ */ React87.createElement(React87.Fragment, { key: question.question || `question-${index}` }, /* @__PURE__ */ React87.createElement(
22029
+ Text71,
22825
22030
  {
22826
22031
  backgroundColor: isSelected ? theme.permission : void 0,
22827
22032
  color: isSelected ? inverseText : void 0
22828
22033
  },
22829
22034
  tabText
22830
22035
  ));
22831
- }), !hideSubmitTab && /* @__PURE__ */ React91.createElement(
22832
- Text75,
22036
+ }), !hideSubmitTab && /* @__PURE__ */ React87.createElement(
22037
+ Text71,
22833
22038
  {
22834
22039
  backgroundColor: isSubmitTab ? theme.permission : void 0,
22835
22040
  color: isSubmitTab ? inverseText : void 0
@@ -22838,23 +22043,23 @@ function AskUserQuestionPermissionRequest({
22838
22043
  figures8.tick,
22839
22044
  " Submit",
22840
22045
  " "
22841
- ), showArrows && /* @__PURE__ */ React91.createElement(Text75, { color: rightArrowInactive ? theme.secondaryText : void 0 }, " ", "\u2192")),
22842
- !isSubmitTab && currentQuestion && /* @__PURE__ */ React91.createElement(React91.Fragment, null, /* @__PURE__ */ React91.createElement(Text75, { bold: true }, currentQuestion.question), /* @__PURE__ */ React91.createElement(Box70, { flexDirection: "column", marginTop: 1 }, (() => {
22046
+ ), showArrows && /* @__PURE__ */ React87.createElement(Text71, { color: rightArrowInactive ? theme.secondaryText : void 0 }, " ", "\u2192")),
22047
+ !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
22048
  const rawSelected = activeQuestionState?.selectedValue;
22844
22049
  const selectedValues = Array.isArray(rawSelected) ? rawSelected : [];
22845
22050
  const otherSelected = currentQuestion.multiSelect ? selectedValues.includes("__other__") : rawSelected === "__other__";
22846
22051
  const otherText = questionStates[currentQuestion.question]?.textInputValue ?? "";
22847
22052
  const otherPlaceholder = currentQuestion.multiSelect ? "Type something" : "Type something.";
22848
22053
  const otherLine = otherText.length > 0 ? otherText : isOtherFocused || otherSelected ? otherPlaceholder : "";
22849
- return /* @__PURE__ */ React91.createElement(React91.Fragment, null, currentQuestion.options.map((option, index) => {
22054
+ return /* @__PURE__ */ React87.createElement(React87.Fragment, null, currentQuestion.options.map((option, index) => {
22850
22055
  const isFocused = !isMultiSelectSubmitFocused && index === focusedOptionIndex;
22851
22056
  const isSelected = currentQuestion.multiSelect ? selectedValues.includes(option.label) : rawSelected === option.label;
22852
22057
  const pointer = isFocused ? figures8.pointer : " ";
22853
22058
  const color = isFocused ? theme.pyb : theme.text;
22854
22059
  const indicator = currentQuestion.multiSelect ? isSelected ? figures8.checkboxOn : figures8.checkboxOff : isSelected ? figures8.tick : " ";
22855
- return /* @__PURE__ */ React91.createElement(Box70, { key: option.label, flexDirection: "column" }, /* @__PURE__ */ React91.createElement(Text75, { color }, pointer, " ", indicator, " ", option.label), /* @__PURE__ */ React91.createElement(Text75, { color: theme.secondaryText }, " ", option.description));
22856
- }), /* @__PURE__ */ React91.createElement(Box70, { flexDirection: "column" }, /* @__PURE__ */ React91.createElement(Text75, { 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__ */ React91.createElement(Text75, { color: theme.secondaryText }, otherLine, isOtherFocused && /* @__PURE__ */ React91.createElement(Text75, { color: "gray" }, "\u258C"))), currentQuestion.multiSelect && /* @__PURE__ */ React91.createElement(Box70, { marginTop: 0 }, /* @__PURE__ */ React91.createElement(
22857
- Text75,
22060
+ 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));
22061
+ }), /* @__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(
22062
+ Text71,
22858
22063
  {
22859
22064
  color: isMultiSelectSubmitFocused ? theme.pyb : theme.text,
22860
22065
  bold: isMultiSelectSubmitFocused
@@ -22862,9 +22067,9 @@ function AskUserQuestionPermissionRequest({
22862
22067
  isMultiSelectSubmitFocused ? figures8.pointer : " ",
22863
22068
  " ",
22864
22069
  currentQuestionIndex === questions.length - 1 ? "Submit" : "Next"
22865
- )), /* @__PURE__ */ React91.createElement(Box70, { marginTop: 1 }, /* @__PURE__ */ React91.createElement(Text75, { color: theme.secondaryText, dimColor: true }, "Enter to select \xB7 Tab/Arrow keys to navigate \xB7 Esc to cancel")));
22070
+ )), /* @__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
22071
  })())),
22867
- isSubmitTab && /* @__PURE__ */ React91.createElement(Box70, { flexDirection: "column" }, /* @__PURE__ */ React91.createElement(Text75, { bold: true }, "Review your answers"), !allQuestionsAnswered && /* @__PURE__ */ React91.createElement(Box70, { marginTop: 1 }, /* @__PURE__ */ React91.createElement(Text75, { color: theme.warning }, figures8.warning, " You have not answered all questions")), /* @__PURE__ */ React91.createElement(Box70, { flexDirection: "column", marginTop: 1 }, questions.filter((q) => q?.question && answers[q.question]).map((q) => /* @__PURE__ */ React91.createElement(Box70, { key: q.question, flexDirection: "column", marginLeft: 1 }, /* @__PURE__ */ React91.createElement(Text75, null, figures8.bullet, " ", q.question), /* @__PURE__ */ React91.createElement(Box70, { marginLeft: 2 }, /* @__PURE__ */ React91.createElement(Text75, { color: theme.success }, figures8.arrowRight, " ", answers[q.question]))))), /* @__PURE__ */ React91.createElement(Box70, { marginTop: 1 }, /* @__PURE__ */ React91.createElement(Text75, { color: theme.secondaryText }, "Ready to submit your answers?")), /* @__PURE__ */ React91.createElement(Box70, { marginTop: 1 }, /* @__PURE__ */ React91.createElement(
22072
+ 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
22073
  Select,
22869
22074
  {
22870
22075
  options: [
@@ -22905,10 +22110,6 @@ function permissionComponentForTool(tool) {
22905
22110
  return SkillPermissionRequest;
22906
22111
  case WebFetchTool:
22907
22112
  return WebFetchPermissionRequest;
22908
- case EnterPlanModeTool:
22909
- return EnterPlanModePermissionRequest;
22910
- case ExitPlanModeTool:
22911
- return ExitPlanModePermissionRequest;
22912
22113
  case AskUserQuestionTool:
22913
22114
  return AskUserQuestionPermissionRequest;
22914
22115
  default:
@@ -22923,7 +22124,7 @@ function PermissionRequest({
22923
22124
  onDone,
22924
22125
  verbose
22925
22126
  }) {
22926
- useInput25((input, key) => {
22127
+ useInput23((input, key) => {
22927
22128
  if (key.ctrl && input === "c") {
22928
22129
  onDone();
22929
22130
  toolUseConfirm.onReject();
@@ -22934,7 +22135,7 @@ function PermissionRequest({
22934
22135
  `${PRODUCT_NAME} needs your permission to use ${toolName}`
22935
22136
  );
22936
22137
  const PermissionComponent = permissionComponentForTool(toolUseConfirm.tool);
22937
- return /* @__PURE__ */ React92.createElement(
22138
+ return /* @__PURE__ */ React88.createElement(
22938
22139
  PermissionComponent,
22939
22140
  {
22940
22141
  toolUseConfirm,
@@ -22945,11 +22146,11 @@ function PermissionRequest({
22945
22146
  }
22946
22147
 
22947
22148
  // src/ui/components/PromptInput.tsx
22948
- import { Box as Box73, Text as Text78, useInput as useInput27 } from "ink";
22949
- import * as React96 from "react";
22149
+ import { Box as Box69, Text as Text74, useInput as useInput25 } from "ink";
22150
+ import * as React92 from "react";
22950
22151
 
22951
22152
  // src/ui/hooks/useArrowKeyHistory.ts
22952
- import { useState as useState23 } from "react";
22153
+ import { useState as useState22 } from "react";
22953
22154
 
22954
22155
  // src/app/history.ts
22955
22156
  var MAX_HISTORY_ITEMS = 100;
@@ -22971,8 +22172,8 @@ function addToHistory(command4) {
22971
22172
 
22972
22173
  // src/ui/hooks/useArrowKeyHistory.ts
22973
22174
  function useArrowKeyHistory(onSetInput, currentInput) {
22974
- const [historyIndex, setHistoryIndex] = useState23(0);
22975
- const [lastTypedInput, setLastTypedInput] = useState23("");
22175
+ const [historyIndex, setHistoryIndex] = useState22(0);
22176
+ const [lastTypedInput, setLastTypedInput] = useState22("");
22976
22177
  const updateInput = (input) => {
22977
22178
  if (input !== void 0) {
22978
22179
  const mode = input.startsWith("!") ? "bash" : "prompt";
@@ -23016,8 +22217,8 @@ function useArrowKeyHistory(onSetInput, currentInput) {
23016
22217
  }
23017
22218
 
23018
22219
  // src/ui/hooks/useUnifiedCompletion.ts
23019
- import { useState as useState24, useCallback as useCallback12, useEffect as useEffect21, useRef as useRef9 } from "react";
23020
- import { useInput as useInput26 } from "ink";
22220
+ import { useState as useState23, useCallback as useCallback12, useEffect as useEffect20, useRef as useRef9 } from "react";
22221
+ import { useInput as useInput24 } from "ink";
23021
22222
 
23022
22223
  // src/utils/completion/context.ts
23023
22224
  function getCompletionContext(args) {
@@ -23088,7 +22289,7 @@ function getCompletionContext(args) {
23088
22289
 
23089
22290
  // src/utils/completion/fileSuggestions.ts
23090
22291
  import { existsSync as existsSync13, readdirSync as readdirSync3, statSync as statSync11 } from "fs";
23091
- import { basename as basename4, dirname as dirname8, join as join9, resolve as resolve8 } from "path";
22292
+ import { basename as basename4, dirname as dirname8, join as join8, resolve as resolve8 } from "path";
23092
22293
  function generateFileSuggestions(args) {
23093
22294
  const { prefix, cwd } = args;
23094
22295
  try {
@@ -23122,8 +22323,8 @@ function generateFileSuggestions(args) {
23122
22323
  return false;
23123
22324
  return true;
23124
22325
  }).sort((a, b) => {
23125
- const aPath = join9(searchDir, a);
23126
- const bPath = join9(searchDir, b);
22326
+ const aPath = join8(searchDir, a);
22327
+ const bPath = join8(searchDir, b);
23127
22328
  const aIsDir = statSync11(aPath).isDirectory();
23128
22329
  const bIsDir = statSync11(bPath).isDirectory();
23129
22330
  if (aIsDir && !bIsDir) return -1;
@@ -23131,7 +22332,7 @@ function generateFileSuggestions(args) {
23131
22332
  return a.toLowerCase().localeCompare(b.toLowerCase());
23132
22333
  }).slice(0, 25);
23133
22334
  return entries.map((entry) => {
23134
- const entryPath = join9(searchDir, entry);
22335
+ const entryPath = join8(searchDir, entry);
23135
22336
  const isDir = statSync11(entryPath).isDirectory();
23136
22337
  const icon = isDir ? "\u{1F4C1}" : "\u{1F4C4}";
23137
22338
  let value;
@@ -24423,7 +23624,7 @@ function useUnifiedCompletion({
24423
23624
  disableSlashCommands = false,
24424
23625
  onSubmit
24425
23626
  }) {
24426
- const [state, setState] = useState24(INITIAL_STATE);
23627
+ const [state, setState] = useState23(INITIAL_STATE);
24427
23628
  const updateState = useCallback12((updates) => {
24428
23629
  setState((prev) => ({ ...prev, ...updates }));
24429
23630
  }, []);
@@ -24459,8 +23660,8 @@ function useUnifiedCompletion({
24459
23660
  disableSlashCommands
24460
23661
  });
24461
23662
  }, [input, cursorOffset, disableSlashCommands]);
24462
- const [systemCommands, setSystemCommands] = useState24([]);
24463
- const [isLoadingCommands, setIsLoadingCommands] = useState24(false);
23663
+ const [systemCommands, setSystemCommands] = useState23([]);
23664
+ const [isLoadingCommands, setIsLoadingCommands] = useState23(false);
24464
23665
  const loadSystemCommands = useCallback12(async () => {
24465
23666
  if (systemCommands.length > 0 || isLoadingCommands) return;
24466
23667
  setIsLoadingCommands(true);
@@ -24500,16 +23701,16 @@ function useUnifiedCompletion({
24500
23701
  setIsLoadingCommands(false);
24501
23702
  }
24502
23703
  }, [systemCommands.length, isLoadingCommands]);
24503
- useEffect21(() => {
23704
+ useEffect20(() => {
24504
23705
  loadSystemCommands();
24505
23706
  }, [loadSystemCommands]);
24506
- const [agentSuggestions, setAgentSuggestions] = useState24(
23707
+ const [agentSuggestions, setAgentSuggestions] = useState23(
24507
23708
  []
24508
23709
  );
24509
- const [modelSuggestions, setModelSuggestions] = useState24(
23710
+ const [modelSuggestions, setModelSuggestions] = useState23(
24510
23711
  []
24511
23712
  );
24512
- useEffect21(() => {
23713
+ useEffect20(() => {
24513
23714
  try {
24514
23715
  const modelManager = getModelManager();
24515
23716
  const allModels = modelManager.getAllAvailableModelNames();
@@ -24531,7 +23732,7 @@ function useUnifiedCompletion({
24531
23732
  setModelSuggestions([]);
24532
23733
  }
24533
23734
  }, []);
24534
- useEffect21(() => {
23735
+ useEffect20(() => {
24535
23736
  getActiveAgents().then((agents) => {
24536
23737
  const suggestions2 = agents.map((config2) => {
24537
23738
  let shortDesc = config2.whenToUse;
@@ -24665,7 +23866,7 @@ function useUnifiedCompletion({
24665
23866
  },
24666
23867
  [input, onInputChange, setCursorOffset]
24667
23868
  );
24668
- useInput26((input_str, key) => {
23869
+ useInput24((input_str, key) => {
24669
23870
  if (!__shouldHandleUnifiedCompletionTabKeyForTests(key)) return false;
24670
23871
  const context = getWordAtCursor();
24671
23872
  if (!context) return false;
@@ -24738,7 +23939,7 @@ function useUnifiedCompletion({
24738
23939
  return true;
24739
23940
  }
24740
23941
  });
24741
- useInput26((inputChar, key) => {
23942
+ useInput24((inputChar, key) => {
24742
23943
  if (key.return && !key.shift && !key.meta && state.isActive && state.suggestions.length > 0) {
24743
23944
  const selectedSuggestion = state.suggestions[state.selectedIndex];
24744
23945
  if (selectedSuggestion && state.context) {
@@ -24855,7 +24056,7 @@ function useUnifiedCompletion({
24855
24056
  }
24856
24057
  return false;
24857
24058
  });
24858
- useInput26((input_str, key) => {
24059
+ useInput24((input_str, key) => {
24859
24060
  if (key.backspace || key.delete) {
24860
24061
  if (state.isActive) {
24861
24062
  resetCompletion();
@@ -24869,7 +24070,7 @@ function useUnifiedCompletion({
24869
24070
  return false;
24870
24071
  });
24871
24072
  const lastInputRef = useRef9("");
24872
- useEffect21(() => {
24073
+ useEffect20(() => {
24873
24074
  if (lastInputRef.current === input) return;
24874
24075
  const inputLengthChange = Math.abs(
24875
24076
  input.length - lastInputRef.current.length
@@ -24963,7 +24164,7 @@ function __shouldHandleUnifiedCompletionTabKeyForTests(key) {
24963
24164
  }
24964
24165
 
24965
24166
  // src/ui/components/PromptInput.tsx
24966
- import { memo, useCallback as useCallback13, useEffect as useEffect23, useMemo as useMemo25, useState as useState26 } from "react";
24167
+ import { memo, useCallback as useCallback13, useEffect as useEffect22, useMemo as useMemo24, useState as useState25 } from "react";
24967
24168
 
24968
24169
  // src/utils/model/tokens.ts
24969
24170
  function countTokens(messages) {
@@ -24980,8 +24181,8 @@ function countTokens(messages) {
24980
24181
  }
24981
24182
 
24982
24183
  // src/ui/components/SentryErrorBoundary.ts
24983
- import * as React93 from "react";
24984
- var SentryErrorBoundary = class extends React93.Component {
24184
+ import * as React89 from "react";
24185
+ var SentryErrorBoundary = class extends React89.Component {
24985
24186
  constructor(props) {
24986
24187
  super(props);
24987
24188
  this.state = { hasError: false };
@@ -25001,26 +24202,163 @@ var SentryErrorBoundary = class extends React93.Component {
25001
24202
  }
25002
24203
  return this.props.children;
25003
24204
  }
25004
- };
25005
-
25006
- // src/ui/components/TokenWarning.tsx
25007
- import { Box as Box71, Text as Text76 } from "ink";
25008
- import * as React94 from "react";
25009
- var MAX_TOKENS = 19e4;
25010
- var WARNING_THRESHOLD = MAX_TOKENS * 0.6;
25011
- var ERROR_THRESHOLD = MAX_TOKENS * 0.8;
25012
- function TokenWarning({ tokenUsage }) {
25013
- const theme = getTheme();
25014
- if (tokenUsage < WARNING_THRESHOLD) {
25015
- return null;
24205
+ };
24206
+
24207
+ // src/ui/components/TokenWarning.tsx
24208
+ import { Box as Box67, Text as Text72 } from "ink";
24209
+ import * as React90 from "react";
24210
+ var MAX_TOKENS = 19e4;
24211
+ var WARNING_THRESHOLD = MAX_TOKENS * 0.6;
24212
+ var ERROR_THRESHOLD = MAX_TOKENS * 0.8;
24213
+ function TokenWarning({ tokenUsage }) {
24214
+ const theme = getTheme();
24215
+ if (tokenUsage < WARNING_THRESHOLD) {
24216
+ return null;
24217
+ }
24218
+ const isError = tokenUsage >= ERROR_THRESHOLD;
24219
+ 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"));
24220
+ }
24221
+
24222
+ // src/utils/system/externalEditor.ts
24223
+ import { spawn, spawnSync } from "child_process";
24224
+ import { mkdtempSync, readFileSync as readFileSync9, rmSync as rmSync2, writeFileSync as writeFileSync4 } from "fs";
24225
+ import { tmpdir } from "os";
24226
+ import { join as join9 } from "path";
24227
+ var isWindows = process.platform === "win32";
24228
+ function isCommandAvailable(command4) {
24229
+ const checker = isWindows ? "where" : "which";
24230
+ const result = spawnSync(checker, [command4], { stdio: "ignore" });
24231
+ return result.status === 0;
24232
+ }
24233
+ function resolveEditorCommand() {
24234
+ const envEditor = process.env.VISUAL || process.env.EDITOR;
24235
+ if (envEditor?.trim()) {
24236
+ return {
24237
+ command: envEditor.trim(),
24238
+ args: [],
24239
+ displayName: envEditor.trim(),
24240
+ shell: true
24241
+ };
24242
+ }
24243
+ const candidates = [];
24244
+ if (isCommandAvailable("code")) {
24245
+ candidates.push({
24246
+ command: "code",
24247
+ args: ["-w"],
24248
+ displayName: "code -w"
24249
+ });
24250
+ }
24251
+ if (!isWindows) {
24252
+ if (isCommandAvailable("nano")) {
24253
+ candidates.push({
24254
+ command: "nano",
24255
+ args: [],
24256
+ displayName: "nano"
24257
+ });
24258
+ }
24259
+ if (isCommandAvailable("vim")) {
24260
+ candidates.push({
24261
+ command: "vim",
24262
+ args: [],
24263
+ displayName: "vim"
24264
+ });
24265
+ }
24266
+ if (isCommandAvailable("open")) {
24267
+ candidates.push({
24268
+ command: "open",
24269
+ args: ["-W", "-t"],
24270
+ displayName: "open -W -t"
24271
+ });
24272
+ }
24273
+ } else {
24274
+ candidates.push({
24275
+ command: "notepad",
24276
+ args: [],
24277
+ displayName: "notepad"
24278
+ });
24279
+ }
24280
+ return candidates.find((candidate) => isCommandAvailable(candidate.command)) ?? null;
24281
+ }
24282
+ function restoreStdinState(previouslyRaw) {
24283
+ if (!process.stdin.isTTY) return;
24284
+ process.stdin.resume();
24285
+ if (previouslyRaw && process.stdin.setRawMode) {
24286
+ process.stdin.setRawMode(true);
24287
+ }
24288
+ }
24289
+ function normalizeNewlines(text) {
24290
+ return text.replace(/\r\n/g, "\n");
24291
+ }
24292
+ async function launchExternalEditor(initialText) {
24293
+ const editorCommand = resolveEditorCommand();
24294
+ if (!editorCommand) {
24295
+ return {
24296
+ text: null,
24297
+ error: new Error(
24298
+ "No editor found. Set $VISUAL or $EDITOR, or install code, nano, vim, or notepad."
24299
+ )
24300
+ };
24301
+ }
24302
+ const dir = mkdtempSync(join9(tmpdir(), "pyb-edit-"));
24303
+ const filePath = join9(dir, "message.txt");
24304
+ writeFileSync4(filePath, initialText, "utf-8");
24305
+ const wasRaw = Boolean(process.stdin.isTTY && process.stdin.isRaw);
24306
+ if (process.stdin.isTTY) {
24307
+ process.stdin.pause();
24308
+ if (process.stdin.setRawMode) {
24309
+ process.stdin.setRawMode(false);
24310
+ }
24311
+ }
24312
+ try {
24313
+ await new Promise((resolve11, reject) => {
24314
+ const child = spawn(
24315
+ editorCommand.command,
24316
+ [...editorCommand.args, filePath],
24317
+ {
24318
+ stdio: "inherit",
24319
+ shell: editorCommand.shell ?? false
24320
+ }
24321
+ );
24322
+ child.on("error", reject);
24323
+ child.on("exit", (code, signal) => {
24324
+ if (code === 0 || code === null) {
24325
+ resolve11();
24326
+ } else {
24327
+ reject(
24328
+ new Error(
24329
+ `Editor exited with code ${code}${signal ? ` (signal ${signal})` : ""}`
24330
+ )
24331
+ );
24332
+ }
24333
+ });
24334
+ });
24335
+ } catch (error) {
24336
+ restoreStdinState(wasRaw);
24337
+ rmSync2(dir, { recursive: true, force: true });
24338
+ return {
24339
+ text: null,
24340
+ editorLabel: editorCommand.displayName,
24341
+ error
24342
+ };
24343
+ }
24344
+ restoreStdinState(wasRaw);
24345
+ try {
24346
+ const edited = normalizeNewlines(readFileSync9(filePath, "utf-8"));
24347
+ rmSync2(dir, { recursive: true, force: true });
24348
+ return { text: edited, editorLabel: editorCommand.displayName };
24349
+ } catch (error) {
24350
+ rmSync2(dir, { recursive: true, force: true });
24351
+ return {
24352
+ text: null,
24353
+ editorLabel: editorCommand.displayName,
24354
+ error
24355
+ };
25016
24356
  }
25017
- const isError = tokenUsage >= ERROR_THRESHOLD;
25018
- return /* @__PURE__ */ React94.createElement(Box71, { flexDirection: "row" }, /* @__PURE__ */ React94.createElement(Text76, { 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"));
25019
24357
  }
25020
24358
 
25021
24359
  // src/utils/commands/hashCommand.ts
25022
24360
  import { join as join10 } from "path";
25023
- import { readFileSync as readFileSync10, writeFileSync as writeFileSync6 } from "fs";
24361
+ import { readFileSync as readFileSync10, writeFileSync as writeFileSync5 } from "fs";
25024
24362
  function handleHashCommand(interpreted) {
25025
24363
  try {
25026
24364
  const cwd = process.cwd();
@@ -25049,7 +24387,7 @@ _Added on ${now.toLocaleString()} ${timezone}_`;
25049
24387
  }
25050
24388
  const separator = existingContent ? "\n\n" : "";
25051
24389
  const newContent = `${existingContent}${separator}${interpreted}${timestamp}`;
25052
- writeFileSync6(file.path, newContent, "utf-8");
24390
+ writeFileSync5(file.path, newContent, "utf-8");
25053
24391
  updatedFiles.push(file.name);
25054
24392
  } catch (error) {
25055
24393
  logError(error);
@@ -25061,8 +24399,8 @@ _Added on ${now.toLocaleString()} ${timezone}_`;
25061
24399
  }
25062
24400
 
25063
24401
  // src/ui/components/ModeIndicator.tsx
25064
- import React95 from "react";
25065
- import { Box as Box72, Text as Text77 } from "ink";
24402
+ import React91 from "react";
24403
+ import { Box as Box68, Text as Text73 } from "ink";
25066
24404
  function __getModeIndicatorDisplayForTests(args) {
25067
24405
  if (args.mode === "default") {
25068
24406
  return {
@@ -25133,7 +24471,7 @@ function CompactModeIndicator() {
25133
24471
  shortcutDisplayText: shortcut.displayText,
25134
24472
  theme
25135
24473
  });
25136
- return /* @__PURE__ */ React95.createElement(Text77, { color: indicator.color }, indicator.mainText, /* @__PURE__ */ React95.createElement(Text77, { dimColor: true }, indicator.shortcutHintText));
24474
+ return /* @__PURE__ */ React91.createElement(Text73, { color: indicator.color }, indicator.mainText, /* @__PURE__ */ React91.createElement(Text73, { dimColor: true }, indicator.shortcutHintText));
25137
24475
  }
25138
24476
 
25139
24477
  // src/utils/terminal/promptInputSpecialKey.ts
@@ -25170,7 +24508,7 @@ function logStartupProfile(event) {
25170
24508
  }
25171
24509
 
25172
24510
  // src/ui/hooks/useStatusLine.ts
25173
- import { useEffect as useEffect22, useRef as useRef10, useState as useState25 } from "react";
24511
+ import { useEffect as useEffect21, useRef as useRef10, useState as useState24 } from "react";
25174
24512
 
25175
24513
  // src/services/ui/statusline.ts
25176
24514
  import { join as join11 } from "path";
@@ -25212,12 +24550,12 @@ function normalizeStatusLineText(value) {
25212
24550
  return singleLine.length > 300 ? `${singleLine.slice(0, 300)}\u2026` : singleLine;
25213
24551
  }
25214
24552
  function useStatusLine() {
25215
- const [text, setText] = useState25(null);
24553
+ const [text, setText] = useState24(null);
25216
24554
  const lastCommandRef = useRef10(null);
25217
24555
  const abortRef = useRef10(null);
25218
24556
  const configDir = process.env.PYB_CONFIG_DIR ?? process.env.CLAUDE_CONFIG_DIR;
25219
24557
  const homeDir = typeof process.env.HOME === "string" ? process.env.HOME : typeof process.env.USERPROFILE === "string" ? process.env.USERPROFILE : void 0;
25220
- useEffect22(() => {
24558
+ useEffect21(() => {
25221
24559
  const enabled = process.env.PYB_STATUSLINE_ENABLED === "1" || process.env.NODE_ENV !== "test";
25222
24560
  if (!enabled) return;
25223
24561
  const shell = BunShell.getInstance();
@@ -25260,7 +24598,7 @@ function useStatusLine() {
25260
24598
  // src/ui/components/PromptInput.tsx
25261
24599
  async function interpretHashCommand(input) {
25262
24600
  try {
25263
- const { queryQuick: queryQuick2 } = await import("./llm-C6QFJQ42.js");
24601
+ const { queryQuick: queryQuick2 } = await import("./llm-AR66BS2U.js");
25264
24602
  const systemPrompt = [
25265
24603
  "You're helping the user structure notes that will be added to their PYB.md file.",
25266
24604
  "Format the user's input into a well-structured note that will be useful for later reference.",
@@ -25313,36 +24651,36 @@ function PromptInput({
25313
24651
  readFileTimestamps,
25314
24652
  onModelChange
25315
24653
  }) {
25316
- useEffect23(() => {
24654
+ useEffect22(() => {
25317
24655
  if (!isDisabled && !isLoading) {
25318
24656
  logStartupProfile("prompt_ready");
25319
24657
  }
25320
24658
  }, [isDisabled, isLoading]);
25321
- const [exitMessage, setExitMessage] = useState26({ show: false });
25322
- const [rewindMessagePending, setRewindMessagePending] = useState26(false);
25323
- const [message, setMessage] = useState26({
24659
+ const [exitMessage, setExitMessage] = useState25({ show: false });
24660
+ const [rewindMessagePending, setRewindMessagePending] = useState25(false);
24661
+ const [message, setMessage] = useState25({
25324
24662
  show: false
25325
24663
  });
25326
- const [modelSwitchMessage, setModelSwitchMessage] = useState26({
24664
+ const [modelSwitchMessage, setModelSwitchMessage] = useState25({
25327
24665
  show: false
25328
24666
  });
25329
- const [placeholder, setPlaceholder] = useState26("");
25330
- const [cursorOffset, setCursorOffset] = useState26(input.length);
25331
- const [pastedTexts, setPastedTexts] = useState26([]);
25332
- const [pastedImages, setPastedImages] = useState26([]);
25333
- const [isEditingExternally, setIsEditingExternally] = useState26(false);
25334
- const [currentPwd, setCurrentPwd] = useState26(process.cwd());
25335
- const pastedTextCounter = React96.useRef(1);
25336
- const pastedImageCounter = React96.useRef(1);
24667
+ const [placeholder, setPlaceholder] = useState25("");
24668
+ const [cursorOffset, setCursorOffset] = useState25(input.length);
24669
+ const [pastedTexts, setPastedTexts] = useState25([]);
24670
+ const [pastedImages, setPastedImages] = useState25([]);
24671
+ const [isEditingExternally, setIsEditingExternally] = useState25(false);
24672
+ const [currentPwd, setCurrentPwd] = useState25(process.cwd());
24673
+ const pastedTextCounter = React92.useRef(1);
24674
+ const pastedImageCounter = React92.useRef(1);
25337
24675
  const { cycleMode, currentMode, toolPermissionContext } = usePermissionContext();
25338
- const modeCycleShortcut = useMemo25(() => getPermissionModeCycleShortcut(), []);
24676
+ const modeCycleShortcut = useMemo24(() => getPermissionModeCycleShortcut(), []);
25339
24677
  const showQuickModelSwitchShortcut = modeCycleShortcut.displayText !== "alt+m";
25340
24678
  const handleRewindConversation = useDoublePress(
25341
24679
  setRewindMessagePending,
25342
24680
  () => onShowMessageSelector()
25343
24681
  );
25344
24682
  const { columns, rows } = useTerminalSize();
25345
- const commandWidth = useMemo25(
24683
+ const commandWidth = useMemo24(
25346
24684
  () => Math.max(...commands.map((cmd) => cmd.userFacingName().length)) + 5,
25347
24685
  [commands]
25348
24686
  );
@@ -25362,19 +24700,19 @@ function PromptInput({
25362
24700
  });
25363
24701
  const theme = getTheme();
25364
24702
  const statusLine = useStatusLine();
25365
- const renderedSuggestions = useMemo25(() => {
24703
+ const renderedSuggestions = useMemo24(() => {
25366
24704
  if (suggestions.length === 0) return null;
25367
24705
  return suggestions.map((suggestion, index) => {
25368
24706
  const isSelected = index === selectedIndex;
25369
24707
  const isAgent = suggestion.type === "agent";
25370
24708
  const displayColor = isSelected ? theme.suggestion : isAgent && suggestion.metadata?.color ? suggestion.metadata.color : void 0;
25371
- return /* @__PURE__ */ React96.createElement(
25372
- Box73,
24709
+ return /* @__PURE__ */ React92.createElement(
24710
+ Box69,
25373
24711
  {
25374
24712
  key: `${suggestion.type}-${suggestion.value}-${index}`,
25375
24713
  flexDirection: "row"
25376
24714
  },
25377
- /* @__PURE__ */ React96.createElement(Text78, { color: displayColor, dimColor: !isSelected && !displayColor }, isSelected ? "\u25C6 " : " ", suggestion.displayValue)
24715
+ /* @__PURE__ */ React92.createElement(Text74, { color: displayColor, dimColor: !isSelected && !displayColor }, isSelected ? "\u25C6 " : " ", suggestion.displayValue)
25378
24716
  );
25379
24717
  });
25380
24718
  }, [suggestions, selectedIndex, theme.suggestion]);
@@ -25573,7 +24911,7 @@ function PromptInput({
25573
24911
  if (messages2.length) {
25574
24912
  if (mode === "bash") {
25575
24913
  onQuery(messages2, newAbortController).then(async () => {
25576
- const { getCwd: getCwd2 } = await import("./state-LXTRD5P4.js");
24914
+ const { getCwd: getCwd2 } = await import("./state-Y2Q4MPY5.js");
25577
24915
  setCurrentPwd(getCwd2());
25578
24916
  });
25579
24917
  } else {
@@ -25619,11 +24957,11 @@ function PromptInput({
25619
24957
  setCursorOffset(cursorOffset + pastedPrompt.length);
25620
24958
  setPastedTexts((prev) => [...prev, { placeholder: pastedPrompt, text }]);
25621
24959
  }
25622
- useEffect23(() => {
24960
+ useEffect22(() => {
25623
24961
  setPastedTexts((prev) => prev.filter((p) => input.includes(p.placeholder)));
25624
24962
  setPastedImages((prev) => prev.filter((p) => input.includes(p.placeholder)));
25625
24963
  }, [input]);
25626
- useInput27(
24964
+ useInput25(
25627
24965
  (inputChar, key) => {
25628
24966
  if (mode === "bash" && (key.backspace || key.delete)) {
25629
24967
  if (input === "") {
@@ -25712,10 +25050,10 @@ function PromptInput({
25712
25050
  ]
25713
25051
  );
25714
25052
  const textInputColumns = columns - 6;
25715
- const tokenUsage = useMemo25(() => countTokens(messages), [messages]);
25053
+ const tokenUsage = useMemo24(() => countTokens(messages), [messages]);
25716
25054
  const modelManager = getModelManager();
25717
25055
  const currentModelId = modelManager.getModel("main")?.id || null;
25718
- const modelInfo = useMemo25(() => {
25056
+ const modelInfo = useMemo24(() => {
25719
25057
  const freshModelManager = getModelManager();
25720
25058
  const currentModel = freshModelManager.getModel("main");
25721
25059
  if (!currentModel) {
@@ -25729,17 +25067,17 @@ function PromptInput({
25729
25067
  currentTokens: tokenUsage
25730
25068
  };
25731
25069
  }, [tokenUsage, modelSwitchMessage.show, submitCount, currentModelId]);
25732
- return /* @__PURE__ */ React96.createElement(Box73, { flexDirection: "column" }, (mode === "bash" || modelInfo) && /* @__PURE__ */ React96.createElement(
25733
- Box73,
25070
+ return /* @__PURE__ */ React92.createElement(Box69, { flexDirection: "column" }, (mode === "bash" || modelInfo) && /* @__PURE__ */ React92.createElement(
25071
+ Box69,
25734
25072
  {
25735
25073
  justifyContent: "space-between",
25736
25074
  marginBottom: 1,
25737
25075
  flexDirection: "row"
25738
25076
  },
25739
- mode === "bash" ? /* @__PURE__ */ React96.createElement(Text78, { color: theme.bashBorder }, "Shell PWD: ", currentPwd) : /* @__PURE__ */ React96.createElement(Text78, null, " "),
25740
- modelInfo && /* @__PURE__ */ React96.createElement(Text78, { dimColor: true }, "[", modelInfo.provider, "] ", modelInfo.name, ":", " ", Math.round(modelInfo.currentTokens / 1e3), "k /", " ", Math.round(modelInfo.contextLength / 1e3), "k")
25741
- ), /* @__PURE__ */ React96.createElement(
25742
- Box73,
25077
+ mode === "bash" ? /* @__PURE__ */ React92.createElement(Text74, { color: theme.bashBorder }, "Shell PWD: ", currentPwd) : /* @__PURE__ */ React92.createElement(Text74, null, " "),
25078
+ modelInfo && /* @__PURE__ */ React92.createElement(Text74, { dimColor: true }, "[", modelInfo.provider, "] ", modelInfo.name, ":", " ", Math.round(modelInfo.currentTokens / 1e3), "k /", " ", Math.round(modelInfo.contextLength / 1e3), "k")
25079
+ ), /* @__PURE__ */ React92.createElement(
25080
+ Box69,
25743
25081
  {
25744
25082
  alignItems: "flex-start",
25745
25083
  justifyContent: "flex-start",
@@ -25753,8 +25091,8 @@ function PromptInput({
25753
25091
  marginTop: 1,
25754
25092
  width: "100%"
25755
25093
  },
25756
- /* @__PURE__ */ React96.createElement(
25757
- Box73,
25094
+ /* @__PURE__ */ React92.createElement(
25095
+ Box69,
25758
25096
  {
25759
25097
  alignItems: "flex-start",
25760
25098
  alignSelf: "flex-start",
@@ -25762,9 +25100,9 @@ function PromptInput({
25762
25100
  justifyContent: "flex-start",
25763
25101
  width: 3
25764
25102
  },
25765
- mode === "bash" ? /* @__PURE__ */ React96.createElement(Text78, { color: theme.bashBorder }, "\xA0!\xA0") : mode === "pyb" ? /* @__PURE__ */ React96.createElement(Text78, { color: theme.noting }, "\xA0#\xA0") : /* @__PURE__ */ React96.createElement(Text78, { color: isLoading ? theme.secondaryText : void 0 }, "P>\xA0")
25103
+ 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
25104
  ),
25767
- /* @__PURE__ */ React96.createElement(Box73, { paddingRight: 1 }, /* @__PURE__ */ React96.createElement(
25105
+ /* @__PURE__ */ React92.createElement(Box69, { paddingRight: 1 }, /* @__PURE__ */ React92.createElement(
25768
25106
  TextInput,
25769
25107
  {
25770
25108
  multiline: true,
@@ -25789,44 +25127,44 @@ function PromptInput({
25789
25127
  onSpecialKey: handleSpecialKey
25790
25128
  }
25791
25129
  ))
25792
- ), !completionActive && suggestions.length === 0 && /* @__PURE__ */ React96.createElement(Box73, { flexDirection: "column", paddingX: 2, paddingY: 0 }, /* @__PURE__ */ React96.createElement(Box73, { flexDirection: "row", justifyContent: "space-between" }, /* @__PURE__ */ React96.createElement(Box73, { justifyContent: "flex-start", gap: 1 }, exitMessage.show ? /* @__PURE__ */ React96.createElement(Text78, { dimColor: true }, "Press ", exitMessage.key, " again to exit") : message.show ? /* @__PURE__ */ React96.createElement(Text78, { dimColor: true }, message.text) : rewindMessagePending ? /* @__PURE__ */ React96.createElement(Text78, { dimColor: true }, "Press Escape again to undo") : modelSwitchMessage.show ? /* @__PURE__ */ React96.createElement(Text78, { color: theme.success }, modelSwitchMessage.text) : mode === "prompt" && currentMode !== "default" ? /* @__PURE__ */ React96.createElement(CompactModeIndicator, null) : /* @__PURE__ */ React96.createElement(React96.Fragment, null, /* @__PURE__ */ React96.createElement(
25793
- Text78,
25130
+ ), !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(
25131
+ Text74,
25794
25132
  {
25795
25133
  color: mode === "bash" ? theme.bashBorder : void 0,
25796
25134
  dimColor: mode !== "bash"
25797
25135
  },
25798
25136
  "! run some shell command"
25799
- ), /* @__PURE__ */ React96.createElement(Text78, { dimColor: true }, " \xB7 / for commands"), /* @__PURE__ */ React96.createElement(
25800
- Text78,
25137
+ ), /* @__PURE__ */ React92.createElement(Text74, { dimColor: true }, " \xB7 / for commands"), /* @__PURE__ */ React92.createElement(
25138
+ Text74,
25801
25139
  {
25802
25140
  color: mode === "pyb" ? theme.noting : void 0,
25803
25141
  dimColor: mode !== "pyb"
25804
25142
  },
25805
25143
  " ",
25806
25144
  "\xB7 # tell agent something to remember forever"
25807
- ))), /* @__PURE__ */ React96.createElement(Box73, { justifyContent: "flex-end" }, /* @__PURE__ */ React96.createElement(Text78, { 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__ */ React96.createElement(Box73, { flexDirection: "row", justifyContent: "space-between" }, /* @__PURE__ */ React96.createElement(Box73, { justifyContent: "flex-start", gap: 1 }, /* @__PURE__ */ React96.createElement(Text78, { 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__ */ React96.createElement(
25145
+ ))), /* @__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
25146
  SentryErrorBoundary,
25809
25147
  {
25810
- children: /* @__PURE__ */ React96.createElement(Box73, { justifyContent: "flex-end", gap: 1 }, /* @__PURE__ */ React96.createElement(TokenWarning, { tokenUsage }))
25148
+ children: /* @__PURE__ */ React92.createElement(Box69, { justifyContent: "flex-end", gap: 1 }, /* @__PURE__ */ React92.createElement(TokenWarning, { tokenUsage }))
25811
25149
  }
25812
- ))), suggestions.length > 0 && /* @__PURE__ */ React96.createElement(
25813
- Box73,
25150
+ ))), suggestions.length > 0 && /* @__PURE__ */ React92.createElement(
25151
+ Box69,
25814
25152
  {
25815
25153
  flexDirection: "row",
25816
25154
  justifyContent: "space-between",
25817
25155
  paddingX: 2,
25818
25156
  paddingY: 0
25819
25157
  },
25820
- /* @__PURE__ */ React96.createElement(Box73, { flexDirection: "column" }, renderedSuggestions, /* @__PURE__ */ React96.createElement(
25821
- Box73,
25158
+ /* @__PURE__ */ React92.createElement(Box69, { flexDirection: "column" }, renderedSuggestions, /* @__PURE__ */ React92.createElement(
25159
+ Box69,
25822
25160
  {
25823
25161
  marginTop: 1,
25824
25162
  paddingX: 3,
25825
25163
  borderStyle: "round",
25826
25164
  borderColor: "gray"
25827
25165
  },
25828
- /* @__PURE__ */ React96.createElement(
25829
- Text78,
25166
+ /* @__PURE__ */ React92.createElement(
25167
+ Text74,
25830
25168
  {
25831
25169
  dimColor: !emptyDirMessage,
25832
25170
  color: emptyDirMessage ? "yellow" : void 0
@@ -25846,10 +25184,10 @@ function PromptInput({
25846
25184
  })()
25847
25185
  )
25848
25186
  )),
25849
- /* @__PURE__ */ React96.createElement(
25187
+ /* @__PURE__ */ React92.createElement(
25850
25188
  SentryErrorBoundary,
25851
25189
  {
25852
- children: /* @__PURE__ */ React96.createElement(Box73, { justifyContent: "flex-end", gap: 1 }, /* @__PURE__ */ React96.createElement(TokenWarning, { tokenUsage: countTokens(messages) }))
25190
+ children: /* @__PURE__ */ React92.createElement(Box69, { justifyContent: "flex-end", gap: 1 }, /* @__PURE__ */ React92.createElement(TokenWarning, { tokenUsage: countTokens(messages) }))
25853
25191
  }
25854
25192
  )
25855
25193
  ));
@@ -25861,9 +25199,9 @@ function exit() {
25861
25199
  }
25862
25200
 
25863
25201
  // src/ui/hooks/useCostSummary.ts
25864
- import { useEffect as useEffect24 } from "react";
25202
+ import { useEffect as useEffect23 } from "react";
25865
25203
  function useCostSummary() {
25866
- useEffect24(() => {
25204
+ useEffect23(() => {
25867
25205
  const onExit = () => {
25868
25206
  process.stdout.write("\n" + formatTotalCost() + "\n");
25869
25207
  const projectConfig = getCurrentProjectConfig();
@@ -25903,9 +25241,9 @@ function useApiKeyVerification() {
25903
25241
  }
25904
25242
 
25905
25243
  // src/ui/hooks/useCancelRequest.ts
25906
- import { useInput as useInput28 } from "ink";
25244
+ import { useInput as useInput26 } from "ink";
25907
25245
  function useCancelRequest(setToolJSX, setToolUseConfirm, setBinaryFeedbackContext, onCancel, isLoading, isMessageSelectorVisible, abortSignal) {
25908
- useInput28((_, key) => {
25246
+ useInput26((_, key) => {
25909
25247
  if (!key.escape) {
25910
25248
  return;
25911
25249
  }
@@ -25966,7 +25304,7 @@ function useCanUseTool(setToolUseConfirm) {
25966
25304
  const [description3, commandPrefix] = await Promise.all([
25967
25305
  typeof tool.description === "function" ? tool.description(input) : Promise.resolve(tool.description ?? `Tool: ${tool.name}`),
25968
25306
  tool === BashTool ? getCommandSubcommandPrefix(
25969
- inputSchema13.parse(input).command,
25307
+ inputSchema11.parse(input).command,
25970
25308
  toolUseContext.abortController.signal
25971
25309
  ) : Promise.resolve(null)
25972
25310
  ]);
@@ -26014,9 +25352,9 @@ function useCanUseTool(setToolUseConfirm) {
26014
25352
  var useCanUseTool_default = useCanUseTool;
26015
25353
 
26016
25354
  // src/ui/hooks/useLogMessages.ts
26017
- import { useEffect as useEffect25 } from "react";
25355
+ import { useEffect as useEffect24 } from "react";
26018
25356
  function useLogMessages(messages, messageLogName, forkNumber) {
26019
- useEffect25(() => {
25357
+ useEffect24(() => {
26020
25358
  overwriteLog(
26021
25359
  getMessagesPath(messageLogName, forkNumber, 0),
26022
25360
  messages.filter((_) => _.type !== "progress"),
@@ -26212,11 +25550,70 @@ if (process.env.NODE_ENV !== "test") {
26212
25550
  }, 0);
26213
25551
  }
26214
25552
 
25553
+ // src/utils/session/conversationTrackingBaseline.ts
25554
+ var TRUE_VALUES = /* @__PURE__ */ new Set(["1", "true", "yes", "on"]);
25555
+ var FALSE_VALUES = /* @__PURE__ */ new Set(["0", "false", "no", "off"]);
25556
+ function parseBooleanEnv(raw, fallback) {
25557
+ const normalized = String(raw ?? "").trim().toLowerCase();
25558
+ if (!normalized) return fallback;
25559
+ if (TRUE_VALUES.has(normalized)) return true;
25560
+ if (FALSE_VALUES.has(normalized)) return false;
25561
+ return fallback;
25562
+ }
25563
+ var DEFAULT_CONFIG2 = {
25564
+ enabled: true,
25565
+ injectSummary: true,
25566
+ markCompletion: true,
25567
+ observabilityEnabled: true
25568
+ };
25569
+ function getConversationTrackingConfig(env2 = process.env) {
25570
+ return {
25571
+ enabled: parseBooleanEnv(
25572
+ env2.PYB_CONVERSATION_TRACKING_ENABLED,
25573
+ DEFAULT_CONFIG2.enabled
25574
+ ),
25575
+ injectSummary: parseBooleanEnv(
25576
+ env2.PYB_CONVERSATION_SUMMARY_ENABLED,
25577
+ DEFAULT_CONFIG2.injectSummary
25578
+ ),
25579
+ markCompletion: parseBooleanEnv(
25580
+ env2.PYB_CONVERSATION_COMPLETION_ENABLED,
25581
+ DEFAULT_CONFIG2.markCompletion
25582
+ ),
25583
+ observabilityEnabled: parseBooleanEnv(
25584
+ env2.PYB_CONVERSATION_OBSERVABILITY_ENABLED,
25585
+ DEFAULT_CONFIG2.observabilityEnabled
25586
+ )
25587
+ };
25588
+ }
25589
+ function createConversationTrackingBaselinePayload(input) {
25590
+ return {
25591
+ stage: input.stage,
25592
+ agentId: input.agentId || "main",
25593
+ messageCount: input.messageCount,
25594
+ systemPromptCount: input.systemPromptCount,
25595
+ requestId: input.requestId,
25596
+ flags: {
25597
+ enabled: input.config.enabled,
25598
+ injectSummary: input.config.injectSummary,
25599
+ markCompletion: input.config.markCompletion,
25600
+ observabilityEnabled: input.config.observabilityEnabled
25601
+ },
25602
+ timestamp: Date.now()
25603
+ };
25604
+ }
25605
+ function logConversationTrackingBaseline(input, deps) {
25606
+ if (!input.config.observabilityEnabled) return;
25607
+ const payload = createConversationTrackingBaselinePayload(input);
25608
+ const stateLogger = deps?.stateLogger ?? debug.state;
25609
+ stateLogger("CONVERSATION_TRACKING_BASELINE", payload, input.requestId);
25610
+ }
25611
+
26215
25612
  // src/services/system/systemPrompt.ts
26216
25613
  function isGPT5Model(modelName) {
26217
25614
  return modelName.startsWith("gpt-5");
26218
25615
  }
26219
- function formatSystemPromptWithContext(systemPrompt, context, agentId, skipContextReminders = false) {
25616
+ function formatSystemPromptWithContext(systemPrompt, context, agentId, skipContextReminders = false, options) {
26220
25617
  const enhancedPrompt = [...systemPrompt];
26221
25618
  let reminders = "";
26222
25619
  const modelManager = getModelManager();
@@ -26264,6 +25661,19 @@ As you answer the user's questions, you can use the following context:
26264
25661
  )
26265
25662
  );
26266
25663
  }
25664
+ const trackingConfig = getConversationTrackingConfig();
25665
+ if (trackingConfig.enabled && trackingConfig.injectSummary && (!agentId || agentId === "main") && options?.conversationTracker) {
25666
+ const summary = options.conversationTracker.generateConversationSummary({
25667
+ maxEntries: 10,
25668
+ maxEntryChars: 80,
25669
+ maxTotalChars: 2e3
25670
+ });
25671
+ if (summary) {
25672
+ enhancedPrompt.push("\n---\n# \u5BF9\u8BDD\u72B6\u6001\u6458\u8981\n");
25673
+ enhancedPrompt.push(summary);
25674
+ enhancedPrompt.push("\n---\n");
25675
+ }
25676
+ }
26267
25677
  return { systemPrompt: enhancedPrompt, reminders };
26268
25678
  }
26269
25679
 
@@ -26561,6 +25971,12 @@ Important technical decisions made and their rationale. Alternative approaches c
26561
25971
  Focus on information essential for continuing the conversation effectively, including specific details about code, files, errors, and plans.`;
26562
25972
  var AUTO_COMPACT_NOTICE = "Context automatically compressed due to token limit.";
26563
25973
  var RECOVERED_FILE_MARKER = "**Recovered File:";
25974
+ var CONVERSATION_SUMMARY_LIMITS = {
25975
+ maxEntries: 10,
25976
+ maxEntryChars: 80,
25977
+ maxTotalChars: 2e3
25978
+ };
25979
+ var MAX_COMPACTED_QUERY_IDS = 10;
26564
25980
  function getMessageText(message) {
26565
25981
  if (!message || typeof message !== "object") return null;
26566
25982
  if (message.type !== "user" && message.type !== "assistant") return null;
@@ -26615,7 +26031,17 @@ async function checkAutoCompact(messages, toolUseContext) {
26615
26031
  return { messages, wasCompacted: false };
26616
26032
  }
26617
26033
  try {
26618
- const compactedMessages = await executeAutoCompact(messages, toolUseContext);
26034
+ const tracker = getConversationTrackerForContext(toolUseContext);
26035
+ const completedQueryIds = tracker.getCompletedQueries().map((item) => item.queryId).slice(-MAX_COMPACTED_QUERY_IDS);
26036
+ const preservedSummary = tracker.generateConversationSummary(
26037
+ CONVERSATION_SUMMARY_LIMITS
26038
+ );
26039
+ const compactedMessages = await executeAutoCompact(messages, toolUseContext, {
26040
+ preservedSummary,
26041
+ compactedQueryIds: completedQueryIds
26042
+ });
26043
+ tracker.reset();
26044
+ tracker.persist();
26619
26045
  return {
26620
26046
  messages: compactedMessages,
26621
26047
  wasCompacted: true
@@ -26628,7 +26054,7 @@ async function checkAutoCompact(messages, toolUseContext) {
26628
26054
  return { messages, wasCompacted: false };
26629
26055
  }
26630
26056
  }
26631
- async function executeAutoCompact(messages, toolUseContext) {
26057
+ async function executeAutoCompact(messages, toolUseContext, options) {
26632
26058
  const previousSummary = findLatestAutoCompactSummary(messages);
26633
26059
  const summaryRequestContent = previousSummary ? `We already have an existing conversation summary:
26634
26060
 
@@ -26698,6 +26124,23 @@ ${COMPRESSION_PROMPT2}` : COMPRESSION_PROMPT2;
26698
26124
  ),
26699
26125
  summaryResponse
26700
26126
  ];
26127
+ compactedMessages[1].compaction = {
26128
+ type: "compaction",
26129
+ auto: true,
26130
+ compactedQueryIds: (options?.compactedQueryIds ?? []).slice(
26131
+ -MAX_COMPACTED_QUERY_IDS
26132
+ ),
26133
+ timestamp: Date.now()
26134
+ };
26135
+ if (options?.preservedSummary) {
26136
+ compactedMessages.push(
26137
+ createAssistantMessage(
26138
+ `<conversation-summary>
26139
+ ${options.preservedSummary}
26140
+ </conversation-summary>`
26141
+ )
26142
+ );
26143
+ }
26701
26144
  if (recoveredFiles.length > 0) {
26702
26145
  for (const file of recoveredFiles) {
26703
26146
  const contentWithLines = addLineNumbers({
@@ -27027,13 +26470,28 @@ async function* queryCore(messages, systemPrompt, context, canUseTool, toolUseCo
27027
26470
  );
27028
26471
  };
27029
26472
  const currentRequest = getCurrentRequest();
26473
+ const conversationTrackingConfig = getConversationTrackingConfig();
27030
26474
  markPhase("QUERY_INIT");
26475
+ logConversationTrackingBaseline({
26476
+ stage: "query_init",
26477
+ agentId: toolUseContext.agentId || "main",
26478
+ messageCount: messages.length,
26479
+ systemPromptCount: systemPrompt.length,
26480
+ requestId: currentRequest?.id,
26481
+ config: conversationTrackingConfig
26482
+ });
27031
26483
  const stopHookActive = hookState?.stopHookActive === true;
27032
26484
  const stopHookAttempts = hookState?.stopHookAttempts ?? 0;
27033
26485
  const { messages: processedMessages, wasCompacted } = await checkAutoCompact(messages, toolUseContext);
27034
26486
  if (wasCompacted) {
27035
26487
  messages = processedMessages;
27036
26488
  }
26489
+ const tracker = getConversationTrackerForContext(toolUseContext);
26490
+ const activeNaturalUserMessage = findNaturalUserMessageForParent(messages);
26491
+ const activeQueryId = activeNaturalUserMessage?.queryId || activeNaturalUserMessage?.uuid;
26492
+ if (conversationTrackingConfig.enabled && activeNaturalUserMessage && activeQueryId) {
26493
+ tracker.startQuery(activeQueryId, activeNaturalUserMessage);
26494
+ }
27037
26495
  if (toolUseContext.agentId === "main") {
27038
26496
  const shell = BunShell.getInstance();
27039
26497
  const notifications = shell.flushBashNotifications();
@@ -27100,7 +26558,9 @@ async function* queryCore(messages, systemPrompt, context, canUseTool, toolUseCo
27100
26558
  const { systemPrompt: fullSystemPrompt, reminders } = formatSystemPromptWithContext(
27101
26559
  systemPrompt,
27102
26560
  context,
27103
- toolUseContext.agentId
26561
+ toolUseContext.agentId,
26562
+ false,
26563
+ { conversationTracker: tracker }
27104
26564
  );
27105
26565
  const planModeAdditions = getPlanModeSystemPromptAdditions(
27106
26566
  messages,
@@ -27119,6 +26579,14 @@ async function* queryCore(messages, systemPrompt, context, canUseTool, toolUseCo
27119
26579
  fullSystemPrompt.push(...outputStyleAdditions);
27120
26580
  }
27121
26581
  }
26582
+ logConversationTrackingBaseline({
26583
+ stage: "system_prompt_built",
26584
+ agentId: toolUseContext.agentId || "main",
26585
+ messageCount: messages.length,
26586
+ systemPromptCount: fullSystemPrompt.length,
26587
+ requestId: currentRequest?.id,
26588
+ config: conversationTrackingConfig
26589
+ });
27122
26590
  emitReminderEvent("session:startup", {
27123
26591
  agentId: toolUseContext.agentId,
27124
26592
  messages: messages.length,
@@ -27162,10 +26630,12 @@ async function* queryCore(messages, systemPrompt, context, canUseTool, toolUseCo
27162
26630
  }
27163
26631
  const assistantMessage = result.message;
27164
26632
  const shouldSkipPermissionCheck = result.shouldSkipPermissionCheck;
26633
+ const parentUserMessage = findNaturalUserMessageForParent(messages);
27165
26634
  const toolUseMessages = assistantMessage.message.content.filter(isToolUseLikeBlock);
27166
26635
  if (!toolUseMessages.length) {
27167
26636
  const stopHookEvent = toolUseContext.agentId && toolUseContext.agentId !== "main" ? "SubagentStop" : "Stop";
27168
26637
  const stopReason = assistantMessage.message?.stop_reason || assistantMessage.message?.stopReason || "end_turn";
26638
+ const finish = mapFinishReason(stopReason);
27169
26639
  const stopOutcome = await runStopHooks({
27170
26640
  hookEvent: stopHookEvent,
27171
26641
  reason: String(stopReason ?? ""),
@@ -27205,10 +26675,38 @@ async function* queryCore(messages, systemPrompt, context, canUseTool, toolUseCo
27205
26675
  return;
27206
26676
  }
27207
26677
  }
27208
- yield assistantMessage;
26678
+ if (!parentUserMessage?.uuid) {
26679
+ yield assistantMessage;
26680
+ return;
26681
+ }
26682
+ const enrichedAssistantMessage = appendFinishState(assistantMessage, {
26683
+ finish,
26684
+ parentID: parentUserMessage.uuid,
26685
+ ...isFinishComplete(finish) ? { completedAt: Date.now() } : {}
26686
+ });
26687
+ const completedQueryId = parentUserMessage.queryId || parentUserMessage.uuid;
26688
+ if (conversationTrackingConfig.enabled && conversationTrackingConfig.markCompletion && isFinishComplete(enrichedAssistantMessage.finish) && completedQueryId) {
26689
+ const completed = tracker.completeQuery(
26690
+ completedQueryId,
26691
+ enrichedAssistantMessage,
26692
+ parentUserMessage
26693
+ );
26694
+ if (completed) {
26695
+ tracker.persist();
26696
+ }
26697
+ }
26698
+ yield enrichedAssistantMessage;
27209
26699
  return;
27210
26700
  }
27211
- yield assistantMessage;
26701
+ if (!parentUserMessage?.uuid) {
26702
+ yield assistantMessage;
26703
+ } else {
26704
+ const enrichedAssistantMessage = appendFinishState(assistantMessage, {
26705
+ finish: "tool_calls",
26706
+ parentID: parentUserMessage.uuid
26707
+ });
26708
+ yield enrichedAssistantMessage;
26709
+ }
27212
26710
  const siblingToolUseIDs = new Set(toolUseMessages.map((_) => _.id));
27213
26711
  const toolQueue = new ToolUseQueue({
27214
26712
  toolDefinitions: toolUseContext.options.tools,
@@ -27651,17 +27149,17 @@ function createErrorToolResultBlock(args) {
27651
27149
  }
27652
27150
 
27653
27151
  // src/ui/components/binary-feedback/BinaryFeedback.tsx
27654
- import { default as React100, useCallback as useCallback15 } from "react";
27152
+ import { default as React96, useCallback as useCallback15 } from "react";
27655
27153
 
27656
27154
  // src/ui/components/binary-feedback/BinaryFeedbackView.tsx
27657
27155
  import chalk14 from "chalk";
27658
- import { Box as Box75, Text as Text79, useInput as useInput29 } from "ink";
27156
+ import { Box as Box71, Text as Text75, useInput as useInput27 } from "ink";
27659
27157
  import Link2 from "ink-link";
27660
- import React99, { useState as useState27 } from "react";
27158
+ import React95, { useState as useState26 } from "react";
27661
27159
 
27662
27160
  // src/ui/components/binary-feedback/BinaryFeedbackOption.tsx
27663
- import * as React98 from "react";
27664
- import { Box as Box74 } from "ink";
27161
+ import * as React94 from "react";
27162
+ import { Box as Box70 } from "ink";
27665
27163
  function BinaryFeedbackOption({
27666
27164
  debug: debug2,
27667
27165
  erroredToolUseIDs,
@@ -27673,7 +27171,7 @@ function BinaryFeedbackOption({
27673
27171
  verbose
27674
27172
  }) {
27675
27173
  const { columns } = useTerminalSize();
27676
- return normalizeMessages([message]).filter((_) => _.type !== "progress").map((_, index) => /* @__PURE__ */ React98.createElement(Box74, { flexDirection: "column", key: index }, /* @__PURE__ */ React98.createElement(
27174
+ return normalizeMessages([message]).filter((_) => _.type !== "progress").map((_, index) => /* @__PURE__ */ React94.createElement(Box70, { flexDirection: "column", key: index }, /* @__PURE__ */ React94.createElement(
27677
27175
  Message,
27678
27176
  {
27679
27177
  addMargin: false,
@@ -27689,7 +27187,7 @@ function BinaryFeedbackOption({
27689
27187
  verbose,
27690
27188
  width: columns / 2 - 6
27691
27189
  }
27692
- ), /* @__PURE__ */ React98.createElement(AdditionalContext, { message: _, verbose })));
27190
+ ), /* @__PURE__ */ React94.createElement(AdditionalContext, { message: _, verbose })));
27693
27191
  }
27694
27192
  function AdditionalContext({
27695
27193
  message,
@@ -27721,7 +27219,7 @@ function AdditionalContext({
27721
27219
  } catch {
27722
27220
  return null;
27723
27221
  }
27724
- return /* @__PURE__ */ React98.createElement(
27222
+ return /* @__PURE__ */ React94.createElement(
27725
27223
  FileEditToolDiff,
27726
27224
  {
27727
27225
  file_path: input.data.file_path,
@@ -27737,7 +27235,7 @@ function AdditionalContext({
27737
27235
  if (!input.success) {
27738
27236
  return null;
27739
27237
  }
27740
- return /* @__PURE__ */ React98.createElement(
27238
+ return /* @__PURE__ */ React94.createElement(
27741
27239
  FileWriteToolDiff,
27742
27240
  {
27743
27241
  file_path: input.data.file_path,
@@ -27790,10 +27288,10 @@ function BinaryFeedbackView({
27790
27288
  verbose
27791
27289
  }) {
27792
27290
  const theme = getTheme();
27793
- const [focused, setFocus] = useState27("no-preference");
27794
- const [focusValue, setFocusValue] = useState27(void 0);
27291
+ const [focused, setFocus] = useState26("no-preference");
27292
+ const [focusValue, setFocusValue] = useState26(void 0);
27795
27293
  const exitState = useExitOnCtrlCD(() => process.exit(1));
27796
- useInput29((_input, key) => {
27294
+ useInput27((_input, key) => {
27797
27295
  if (key.leftArrow) {
27798
27296
  setFocusValue("prefer-left");
27799
27297
  } else if (key.rightArrow) {
@@ -27802,8 +27300,8 @@ function BinaryFeedbackView({
27802
27300
  onChoose?.("neither");
27803
27301
  }
27804
27302
  });
27805
- return /* @__PURE__ */ React99.createElement(React99.Fragment, null, /* @__PURE__ */ React99.createElement(
27806
- Box75,
27303
+ return /* @__PURE__ */ React95.createElement(React95.Fragment, null, /* @__PURE__ */ React95.createElement(
27304
+ Box71,
27807
27305
  {
27808
27306
  flexDirection: "column",
27809
27307
  height: "100%",
@@ -27811,9 +27309,9 @@ function BinaryFeedbackView({
27811
27309
  borderStyle: "round",
27812
27310
  borderColor: theme.permission
27813
27311
  },
27814
- /* @__PURE__ */ React99.createElement(Box75, { width: "100%", justifyContent: "space-between", paddingX: 1 }, /* @__PURE__ */ React99.createElement(Text79, { bold: true, color: theme.permission }, "[ANT-ONLY] Help train ", PRODUCT_NAME), /* @__PURE__ */ React99.createElement(Text79, null, /* @__PURE__ */ React99.createElement(Link2, { url: HELP_URL }, "[?]"))),
27815
- /* @__PURE__ */ React99.createElement(Box75, { flexDirection: "row", width: "100%", flexGrow: 1, paddingTop: 1 }, /* @__PURE__ */ React99.createElement(
27816
- Box75,
27312
+ /* @__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 }, "[?]"))),
27313
+ /* @__PURE__ */ React95.createElement(Box71, { flexDirection: "row", width: "100%", flexGrow: 1, paddingTop: 1 }, /* @__PURE__ */ React95.createElement(
27314
+ Box71,
27817
27315
  {
27818
27316
  flexDirection: "column",
27819
27317
  flexGrow: 1,
@@ -27824,7 +27322,7 @@ function BinaryFeedbackView({
27824
27322
  marginRight: 1,
27825
27323
  padding: 1
27826
27324
  },
27827
- /* @__PURE__ */ React99.createElement(
27325
+ /* @__PURE__ */ React95.createElement(
27828
27326
  BinaryFeedbackOption,
27829
27327
  {
27830
27328
  erroredToolUseIDs,
@@ -27837,8 +27335,8 @@ function BinaryFeedbackView({
27837
27335
  verbose
27838
27336
  }
27839
27337
  )
27840
- ), /* @__PURE__ */ React99.createElement(
27841
- Box75,
27338
+ ), /* @__PURE__ */ React95.createElement(
27339
+ Box71,
27842
27340
  {
27843
27341
  flexDirection: "column",
27844
27342
  flexGrow: 1,
@@ -27849,7 +27347,7 @@ function BinaryFeedbackView({
27849
27347
  marginLeft: 1,
27850
27348
  padding: 1
27851
27349
  },
27852
- /* @__PURE__ */ React99.createElement(
27350
+ /* @__PURE__ */ React95.createElement(
27853
27351
  BinaryFeedbackOption,
27854
27352
  {
27855
27353
  erroredToolUseIDs,
@@ -27863,7 +27361,7 @@ function BinaryFeedbackView({
27863
27361
  }
27864
27362
  )
27865
27363
  )),
27866
- /* @__PURE__ */ React99.createElement(Box75, { flexDirection: "column", paddingTop: 1, paddingX: 1 }, /* @__PURE__ */ React99.createElement(Text79, null, "How do you want to proceed?"), /* @__PURE__ */ React99.createElement(
27364
+ /* @__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
27365
  Select,
27868
27366
  {
27869
27367
  options: getOptions2(),
@@ -27872,7 +27370,7 @@ function BinaryFeedbackView({
27872
27370
  onChange: onChoose
27873
27371
  }
27874
27372
  ))
27875
- ), exitState.pending ? /* @__PURE__ */ React99.createElement(Box75, { marginLeft: 3 }, /* @__PURE__ */ React99.createElement(Text79, { dimColor: true }, "Press ", exitState.keyName, " again to exit")) : /* @__PURE__ */ React99.createElement(Text79, null, " "));
27373
+ ), 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
27374
  }
27877
27375
 
27878
27376
  // src/ui/components/binary-feedback/BinaryFeedback.tsx
@@ -27898,7 +27396,7 @@ function BinaryFeedback({
27898
27396
  useNotifyAfterTimeout(
27899
27397
  `${PRODUCT_NAME} needs your input on a response comparison`
27900
27398
  );
27901
- return /* @__PURE__ */ React100.createElement(
27399
+ return /* @__PURE__ */ React96.createElement(
27902
27400
  BinaryFeedbackView,
27903
27401
  {
27904
27402
  debug: debug2,
@@ -27987,36 +27485,36 @@ function REPL({
27987
27485
  initialUpdateCommands,
27988
27486
  autoExit
27989
27487
  }) {
27990
- const [verboseConfig] = useState28(
27488
+ const [verboseConfig] = useState27(
27991
27489
  () => verboseFromCLI ?? getGlobalConfig().verbose
27992
27490
  );
27993
27491
  const verbose = verboseConfig;
27994
- const [forkNumber, setForkNumber] = useState28(
27492
+ const [forkNumber, setForkNumber] = useState27(
27995
27493
  getNextAvailableLogForkNumber(messageLogName, initialForkNumber, 0)
27996
27494
  );
27997
- const [uiRefreshCounter, setUiRefreshCounter] = useState28(0);
27495
+ const [uiRefreshCounter, setUiRefreshCounter] = useState27(0);
27998
27496
  const [
27999
27497
  forkConvoWithMessagesOnTheNextRender,
28000
27498
  setForkConvoWithMessagesOnTheNextRender
28001
- ] = useState28(null);
28002
- const [abortController, setAbortController] = useState28(null);
28003
- const [isLoading, setIsLoading] = useState28(false);
28004
- const [toolJSX, setToolJSX] = useState28(null);
28005
- const [toolUseConfirm, setToolUseConfirm] = useState28(
27499
+ ] = useState27(null);
27500
+ const [abortController, setAbortController] = useState27(null);
27501
+ const [isLoading, setIsLoading] = useState27(false);
27502
+ const [toolJSX, setToolJSX] = useState27(null);
27503
+ const [toolUseConfirm, setToolUseConfirm] = useState27(
28006
27504
  null
28007
27505
  );
28008
- const [messages, setMessages2] = useState28(initialMessages ?? []);
28009
- const [inputValue, setInputValue] = useState28("");
28010
- const [inputMode, setInputMode] = useState28(
27506
+ const [messages, setMessages2] = useState27(initialMessages ?? []);
27507
+ const [inputValue, setInputValue] = useState27("");
27508
+ const [inputMode, setInputMode] = useState27(
28011
27509
  "prompt"
28012
27510
  );
28013
- const [submitCount, setSubmitCount] = useState28(0);
28014
- const [isMessageSelectorVisible, setIsMessageSelectorVisible] = useState28(false);
28015
- const [showCostDialog, setShowCostDialog] = useState28(false);
28016
- const [haveShownCostDialog, setHaveShownCostDialog] = useState28(
27511
+ const [submitCount, setSubmitCount] = useState27(0);
27512
+ const [isMessageSelectorVisible, setIsMessageSelectorVisible] = useState27(false);
27513
+ const [showCostDialog, setShowCostDialog] = useState27(false);
27514
+ const [haveShownCostDialog, setHaveShownCostDialog] = useState27(
28017
27515
  getGlobalConfig().hasAcknowledgedCostThreshold
28018
27516
  );
28019
- const [binaryFeedbackContext, setBinaryFeedbackContext] = useState28(null);
27517
+ const [binaryFeedbackContext, setBinaryFeedbackContext] = useState27(null);
28020
27518
  const updateAvailableVersion = initialUpdateVersion ?? null;
28021
27519
  const updateCommands = initialUpdateCommands ?? null;
28022
27520
  const getBinaryFeedbackResponse = useCallback16(
@@ -28032,6 +27530,20 @@ function REPL({
28032
27530
  []
28033
27531
  );
28034
27532
  const readFileTimestamps = useRef13({});
27533
+ const conversationTrackersRef = useRef13(
27534
+ /* @__PURE__ */ new Map()
27535
+ );
27536
+ const getConversationTrackerForKey = useCallback16(
27537
+ (conversationKey2) => {
27538
+ const existing = conversationTrackersRef.current.get(conversationKey2);
27539
+ if (existing) return existing;
27540
+ const created = new ConversationTracker();
27541
+ conversationTrackersRef.current.set(conversationKey2, created);
27542
+ return created;
27543
+ },
27544
+ []
27545
+ );
27546
+ const conversationKey = `${messageLogName}:${forkNumber}`;
28035
27547
  const { status: apiKeyStatus, reverify } = useApiKeyVerification();
28036
27548
  function onCancel() {
28037
27549
  if (!isLoading) {
@@ -28053,20 +27565,20 @@ function REPL({
28053
27565
  isMessageSelectorVisible,
28054
27566
  abortController?.signal
28055
27567
  );
28056
- useEffect26(() => {
27568
+ useEffect25(() => {
28057
27569
  if (forkConvoWithMessagesOnTheNextRender) {
28058
27570
  setForkNumber((_) => _ + 1);
28059
27571
  setForkConvoWithMessagesOnTheNextRender(null);
28060
27572
  setMessages2(forkConvoWithMessagesOnTheNextRender);
28061
27573
  }
28062
27574
  }, [forkConvoWithMessagesOnTheNextRender]);
28063
- useEffect26(() => {
27575
+ useEffect25(() => {
28064
27576
  const totalCost = getTotalCost();
28065
27577
  if (totalCost >= 5 && !showCostDialog && !haveShownCostDialog) {
28066
27578
  setShowCostDialog(true);
28067
27579
  }
28068
27580
  }, [messages, showCostDialog, haveShownCostDialog]);
28069
- useEffect26(() => {
27581
+ useEffect25(() => {
28070
27582
  if (autoExit && !isLoading) {
28071
27583
  const tasks = listTasks({});
28072
27584
  const hasTasks = tasks.length > 0;
@@ -28086,56 +27598,124 @@ function REPL({
28086
27598
  if (!initialPrompt) {
28087
27599
  return;
28088
27600
  }
27601
+ const restoreSessionScope = beginReplSessionScope(conversationKey);
28089
27602
  setIsLoading(true);
28090
27603
  const newAbortController = new AbortController();
28091
27604
  setAbortController(newAbortController);
28092
- const model = new ModelManager(getGlobalConfig()).getModelName("main");
28093
- const newMessages = await processUserInput(
28094
- initialPrompt,
28095
- "prompt",
28096
- setToolJSX,
28097
- {
28098
- abortController: newAbortController,
28099
- options: {
28100
- commands,
28101
- forkNumber,
28102
- messageLogName,
28103
- tools,
28104
- mcpClients,
28105
- verbose,
28106
- maxThinkingTokens: 0,
28107
- toolPermissionContext: getToolPermissionContextForConversationKey({
28108
- conversationKey: `${messageLogName}:${forkNumber}`,
28109
- isBypassPermissionsModeAvailable: !(safeMode ?? false)
28110
- })
27605
+ try {
27606
+ const model = new ModelManager(getGlobalConfig()).getModelName("main");
27607
+ const newMessages = await processUserInput(
27608
+ initialPrompt,
27609
+ "prompt",
27610
+ setToolJSX,
27611
+ {
27612
+ abortController: newAbortController,
27613
+ options: {
27614
+ commands,
27615
+ forkNumber,
27616
+ messageLogName,
27617
+ tools,
27618
+ mcpClients,
27619
+ verbose,
27620
+ maxThinkingTokens: 0,
27621
+ toolPermissionContext: getToolPermissionContextForConversationKey({
27622
+ conversationKey,
27623
+ isBypassPermissionsModeAvailable: !(safeMode ?? false)
27624
+ })
27625
+ },
27626
+ messageId: getLastAssistantMessageId(messages),
27627
+ setForkConvoWithMessagesOnTheNextRender,
27628
+ readFileTimestamps: readFileTimestamps.current
28111
27629
  },
28112
- messageId: getLastAssistantMessageId(messages),
28113
- setForkConvoWithMessagesOnTheNextRender,
28114
- readFileTimestamps: readFileTimestamps.current
28115
- },
28116
- null
28117
- );
28118
- if (newMessages.length) {
28119
- for (const message of newMessages) {
28120
- if (message.type === "user") {
28121
- addToHistory(initialPrompt);
27630
+ null
27631
+ );
27632
+ if (newMessages.length) {
27633
+ for (const message of newMessages) {
27634
+ if (message.type === "user") {
27635
+ addToHistory(initialPrompt);
27636
+ }
27637
+ }
27638
+ setMessages2((_) => [..._, ...newMessages]);
27639
+ const lastMessage = newMessages[newMessages.length - 1];
27640
+ if (lastMessage.type === "assistant") {
27641
+ return;
27642
+ }
27643
+ const [systemPrompt, context, model2, maxThinkingTokens] = await Promise.all([
27644
+ getSystemPrompt({ disableSlashCommands }),
27645
+ getContext(),
27646
+ new ModelManager(getGlobalConfig()).getModelName("main"),
27647
+ getMaxThinkingTokens([...messages, ...newMessages])
27648
+ ]);
27649
+ for await (const message of query(
27650
+ [...messages, ...newMessages],
27651
+ systemPrompt,
27652
+ context,
27653
+ canUseTool,
27654
+ {
27655
+ options: {
27656
+ commands,
27657
+ forkNumber,
27658
+ messageLogName,
27659
+ tools,
27660
+ mcpClients,
27661
+ verbose,
27662
+ safeMode,
27663
+ maxThinkingTokens,
27664
+ toolPermissionContext: getToolPermissionContextForConversationKey({
27665
+ conversationKey,
27666
+ isBypassPermissionsModeAvailable: !(safeMode ?? false)
27667
+ })
27668
+ },
27669
+ messageId: getLastAssistantMessageId([...messages, ...newMessages]),
27670
+ readFileTimestamps: readFileTimestamps.current,
27671
+ abortController: newAbortController,
27672
+ setToolJSX,
27673
+ conversationTracker: getConversationTrackerForKey(conversationKey)
27674
+ },
27675
+ getBinaryFeedbackResponse
27676
+ )) {
27677
+ setMessages2((oldMessages) => [...oldMessages, message]);
28122
27678
  }
27679
+ } else {
27680
+ addToHistory(initialPrompt);
28123
27681
  }
28124
- setMessages2((_) => [..._, ...newMessages]);
27682
+ setHaveShownCostDialog(
27683
+ getGlobalConfig().hasAcknowledgedCostThreshold || false
27684
+ );
27685
+ } finally {
27686
+ setIsLoading(false);
27687
+ setAbortController(null);
27688
+ restoreSessionScope();
27689
+ }
27690
+ }
27691
+ async function onQuery(newMessages, passedAbortController) {
27692
+ const restoreSessionScope = beginReplSessionScope(conversationKey);
27693
+ const controllerToUse = passedAbortController || new AbortController();
27694
+ if (!passedAbortController) {
27695
+ setAbortController(controllerToUse);
27696
+ }
27697
+ try {
27698
+ const isPybRequest = newMessages.length > 0 && newMessages[0].type === "user" && "options" in newMessages[0] && newMessages[0].options?.isPybRequest === true;
27699
+ setMessages2((oldMessages) => [...oldMessages, ...newMessages]);
27700
+ markProjectOnboardingComplete();
28125
27701
  const lastMessage = newMessages[newMessages.length - 1];
27702
+ if (lastMessage.type === "user" && typeof lastMessage.message.content === "string") {
27703
+ }
28126
27704
  if (lastMessage.type === "assistant") {
28127
- setAbortController(null);
28128
- setIsLoading(false);
27705
+ if (!passedAbortController) {
27706
+ setAbortController(null);
27707
+ }
28129
27708
  return;
28130
27709
  }
28131
- const [systemPrompt, context, model2, maxThinkingTokens] = await Promise.all([
27710
+ const [systemPrompt, context, model, maxThinkingTokens] = await Promise.all([
28132
27711
  getSystemPrompt({ disableSlashCommands }),
28133
27712
  getContext(),
28134
27713
  new ModelManager(getGlobalConfig()).getModelName("main"),
28135
- getMaxThinkingTokens([...messages, ...newMessages])
27714
+ getMaxThinkingTokens([...messages, lastMessage])
28136
27715
  ]);
27716
+ let lastAssistantMessage = null;
28137
27717
  for await (const message of query(
28138
- [...messages, ...newMessages],
27718
+ [...messages, lastMessage],
28139
27719
  systemPrompt,
28140
27720
  context,
28141
27721
  canUseTool,
@@ -28149,136 +27729,77 @@ function REPL({
28149
27729
  verbose,
28150
27730
  safeMode,
28151
27731
  maxThinkingTokens,
27732
+ isPybRequest: isPybRequest || void 0,
28152
27733
  toolPermissionContext: getToolPermissionContextForConversationKey({
28153
- conversationKey: `${messageLogName}:${forkNumber}`,
27734
+ conversationKey,
28154
27735
  isBypassPermissionsModeAvailable: !(safeMode ?? false)
28155
27736
  })
28156
27737
  },
28157
- messageId: getLastAssistantMessageId([...messages, ...newMessages]),
27738
+ messageId: getLastAssistantMessageId([...messages, lastMessage]),
28158
27739
  readFileTimestamps: readFileTimestamps.current,
28159
- abortController: newAbortController,
28160
- setToolJSX
27740
+ abortController: controllerToUse,
27741
+ setToolJSX,
27742
+ conversationTracker: getConversationTrackerForKey(conversationKey)
28161
27743
  },
28162
27744
  getBinaryFeedbackResponse
28163
27745
  )) {
28164
27746
  setMessages2((oldMessages) => [...oldMessages, message]);
27747
+ if (message.type === "assistant") {
27748
+ lastAssistantMessage = message;
27749
+ }
28165
27750
  }
28166
- } else {
28167
- addToHistory(initialPrompt);
28168
- }
28169
- setHaveShownCostDialog(
28170
- getGlobalConfig().hasAcknowledgedCostThreshold || false
28171
- );
28172
- setIsLoading(false);
28173
- setAbortController(null);
28174
- }
28175
- async function onQuery(newMessages, passedAbortController) {
28176
- const controllerToUse = passedAbortController || new AbortController();
28177
- if (!passedAbortController) {
28178
- setAbortController(controllerToUse);
28179
- }
28180
- const isPybRequest = newMessages.length > 0 && newMessages[0].type === "user" && "options" in newMessages[0] && newMessages[0].options?.isPybRequest === true;
28181
- setMessages2((oldMessages) => [...oldMessages, ...newMessages]);
28182
- markProjectOnboardingComplete();
28183
- const lastMessage = newMessages[newMessages.length - 1];
28184
- if (lastMessage.type === "user" && typeof lastMessage.message.content === "string") {
28185
- }
28186
- if (lastMessage.type === "assistant") {
28187
- setAbortController(null);
28188
- setIsLoading(false);
28189
- return;
28190
- }
28191
- const [systemPrompt, context, model, maxThinkingTokens] = await Promise.all(
28192
- [
28193
- getSystemPrompt({ disableSlashCommands }),
28194
- getContext(),
28195
- new ModelManager(getGlobalConfig()).getModelName("main"),
28196
- getMaxThinkingTokens([...messages, lastMessage])
28197
- ]
28198
- );
28199
- let lastAssistantMessage = null;
28200
- for await (const message of query(
28201
- [...messages, lastMessage],
28202
- systemPrompt,
28203
- context,
28204
- canUseTool,
28205
- {
28206
- options: {
28207
- commands,
28208
- forkNumber,
28209
- messageLogName,
28210
- tools,
28211
- mcpClients,
28212
- verbose,
28213
- safeMode,
28214
- maxThinkingTokens,
28215
- isPybRequest: isPybRequest || void 0,
28216
- toolPermissionContext: getToolPermissionContextForConversationKey({
28217
- conversationKey: `${messageLogName}:${forkNumber}`,
28218
- isBypassPermissionsModeAvailable: !(safeMode ?? false)
28219
- })
28220
- },
28221
- messageId: getLastAssistantMessageId([...messages, lastMessage]),
28222
- readFileTimestamps: readFileTimestamps.current,
28223
- abortController: controllerToUse,
28224
- setToolJSX
28225
- },
28226
- getBinaryFeedbackResponse
28227
- )) {
28228
- setMessages2((oldMessages) => [...oldMessages, message]);
28229
- if (message.type === "assistant") {
28230
- lastAssistantMessage = message;
28231
- }
28232
- }
28233
- if (isPybRequest && lastAssistantMessage && lastAssistantMessage.type === "assistant") {
28234
- try {
28235
- const content = typeof lastAssistantMessage.message.content === "string" ? lastAssistantMessage.message.content : lastAssistantMessage.message.content.filter((block) => block.type === "text").map((block) => block.type === "text" ? block.text : "").join("\n");
28236
- if (content && content.trim().length > 0) {
28237
- handleHashCommand(content);
27751
+ if (isPybRequest && lastAssistantMessage && lastAssistantMessage.type === "assistant") {
27752
+ try {
27753
+ const content = typeof lastAssistantMessage.message.content === "string" ? lastAssistantMessage.message.content : lastAssistantMessage.message.content.filter((block) => block.type === "text").map((block) => block.type === "text" ? block.text : "").join("\n");
27754
+ if (content && content.trim().length > 0) {
27755
+ handleHashCommand(content);
27756
+ }
27757
+ } catch (error) {
27758
+ logError(error);
27759
+ debug.error("REPL_PYB_SAVE_PROJECT_DOCS_ERROR", { error });
28238
27760
  }
28239
- } catch (error) {
28240
- logError(error);
28241
- debug.error("REPL_PYB_SAVE_PROJECT_DOCS_ERROR", { error });
28242
27761
  }
27762
+ } finally {
27763
+ setIsLoading(false);
27764
+ restoreSessionScope();
28243
27765
  }
28244
- setIsLoading(false);
28245
27766
  }
28246
27767
  useCostSummary();
28247
- useEffect26(() => {
27768
+ useEffect25(() => {
28248
27769
  const getMessages2 = () => messages;
28249
27770
  setMessagesGetter(getMessages2);
28250
27771
  setMessagesSetter(setMessages2);
28251
27772
  }, [messages]);
28252
- useEffect26(() => {
27773
+ useEffect25(() => {
28253
27774
  setModelConfigChangeHandler(() => {
28254
27775
  setUiRefreshCounter((prev) => prev + 1);
28255
27776
  });
28256
27777
  }, []);
28257
27778
  useLogMessages(messages, messageLogName, forkNumber);
28258
27779
  useLogStartupTime();
28259
- useEffect26(() => {
27780
+ useEffect25(() => {
28260
27781
  onInit();
28261
27782
  }, []);
28262
- const normalizedMessages = useMemo26(
27783
+ const normalizedMessages = useMemo25(
28263
27784
  () => normalizeMessages(messages).filter(isNotEmptyMessage),
28264
27785
  [messages]
28265
27786
  );
28266
- const displayMessages = useMemo26(
27787
+ const displayMessages = useMemo25(
28267
27788
  () => filterProgressMessagesForTools(
28268
27789
  normalizedMessages,
28269
27790
  /* @__PURE__ */ new Set(["TaskCreate", "TaskUpdate", "TaskList", "TaskGet"])
28270
27791
  ),
28271
27792
  [normalizedMessages]
28272
27793
  );
28273
- const unresolvedToolUseIDs = useMemo26(
27794
+ const unresolvedToolUseIDs = useMemo25(
28274
27795
  () => getUnresolvedToolUseIDs(displayMessages),
28275
27796
  [displayMessages]
28276
27797
  );
28277
- const inProgressToolUseIDs = useMemo26(
27798
+ const inProgressToolUseIDs = useMemo25(
28278
27799
  () => getInProgressToolUseIDs(displayMessages),
28279
27800
  [displayMessages]
28280
27801
  );
28281
- const erroredToolUseIDs = useMemo26(
27802
+ const erroredToolUseIDs = useMemo25(
28282
27803
  () => new Set(
28283
27804
  getErroredToolUseMessages(displayMessages).map(
28284
27805
  (_) => _.message.content[0].id
@@ -28286,11 +27807,11 @@ function REPL({
28286
27807
  ),
28287
27808
  [displayMessages]
28288
27809
  );
28289
- const orderedMessages = useMemo26(
27810
+ const orderedMessages = useMemo25(
28290
27811
  () => reorderMessages(displayMessages),
28291
27812
  [displayMessages]
28292
27813
  );
28293
- const replStaticPrefixLength = useMemo26(
27814
+ const replStaticPrefixLength = useMemo25(
28294
27815
  () => getReplStaticPrefixLength(
28295
27816
  orderedMessages,
28296
27817
  normalizedMessages,
@@ -28298,10 +27819,10 @@ function REPL({
28298
27819
  ),
28299
27820
  [orderedMessages, normalizedMessages, unresolvedToolUseIDs]
28300
27821
  );
28301
- const messagesJSX = useMemo26(() => {
27822
+ const messagesJSX = useMemo25(() => {
28302
27823
  return orderedMessages.map((_, index) => {
28303
27824
  const toolUseID = getToolUseID(_);
28304
- const message = _.type === "progress" ? _.content.message.content[0]?.type === "text" && _.content.message.content[0].text === INTERRUPT_MESSAGE ? /* @__PURE__ */ React101.createElement(
27825
+ const message = _.type === "progress" ? _.content.message.content[0]?.type === "text" && _.content.message.content[0].text === INTERRUPT_MESSAGE ? /* @__PURE__ */ React97.createElement(
28305
27826
  Message,
28306
27827
  {
28307
27828
  message: _.content,
@@ -28316,10 +27837,10 @@ function REPL({
28316
27837
  shouldAnimate: false,
28317
27838
  shouldShowDot: false
28318
27839
  }
28319
- ) : /* @__PURE__ */ React101.createElement(
27840
+ ) : /* @__PURE__ */ React97.createElement(
28320
27841
  MessageResponse,
28321
27842
  {
28322
- children: /* @__PURE__ */ React101.createElement(
27843
+ children: /* @__PURE__ */ React97.createElement(
28323
27844
  Message,
28324
27845
  {
28325
27846
  message: _.content,
@@ -28338,7 +27859,7 @@ function REPL({
28338
27859
  }
28339
27860
  )
28340
27861
  }
28341
- ) : /* @__PURE__ */ React101.createElement(
27862
+ ) : /* @__PURE__ */ React97.createElement(
28342
27863
  Message,
28343
27864
  {
28344
27865
  message: _,
@@ -28357,8 +27878,8 @@ function REPL({
28357
27878
  const isInStaticPrefix = index < replStaticPrefixLength;
28358
27879
  if (debug2) {
28359
27880
  return {
28360
- jsx: /* @__PURE__ */ React101.createElement(
28361
- Box76,
27881
+ jsx: /* @__PURE__ */ React97.createElement(
27882
+ Box72,
28362
27883
  {
28363
27884
  borderStyle: "single",
28364
27885
  borderColor: isInStaticPrefix ? "green" : "red",
@@ -28370,7 +27891,7 @@ function REPL({
28370
27891
  };
28371
27892
  }
28372
27893
  return {
28373
- jsx: /* @__PURE__ */ React101.createElement(Box76, { key: _.uuid, width: "100%" }, message)
27894
+ jsx: /* @__PURE__ */ React97.createElement(Box72, { key: _.uuid, width: "100%" }, message)
28374
27895
  };
28375
27896
  });
28376
27897
  }, [
@@ -28390,10 +27911,10 @@ function REPL({
28390
27911
  isDefaultModel,
28391
27912
  replStaticPrefixLength
28392
27913
  ]);
28393
- const staticItems = useMemo26(
27914
+ const staticItems = useMemo25(
28394
27915
  () => [
28395
27916
  {
28396
- jsx: /* @__PURE__ */ React101.createElement(Box76, { flexDirection: "column", key: `logo${forkNumber}` }, /* @__PURE__ */ React101.createElement(
27917
+ jsx: /* @__PURE__ */ React97.createElement(Box72, { flexDirection: "column", key: `logo${forkNumber}` }, /* @__PURE__ */ React97.createElement(
28397
27918
  Logo,
28398
27919
  {
28399
27920
  mcpClients,
@@ -28401,7 +27922,7 @@ function REPL({
28401
27922
  updateBannerVersion: updateAvailableVersion,
28402
27923
  updateBannerCommands: updateCommands
28403
27924
  }
28404
- ), /* @__PURE__ */ React101.createElement(ProjectOnboarding, { workspaceDir: getOriginalCwd() }))
27925
+ ), /* @__PURE__ */ React97.createElement(ProjectOnboarding, { workspaceDir: getOriginalCwd() }))
28405
27926
  },
28406
27927
  ...messagesJSX.slice(0, replStaticPrefixLength)
28407
27928
  ],
@@ -28415,29 +27936,28 @@ function REPL({
28415
27936
  updateCommands
28416
27937
  ]
28417
27938
  );
28418
- const transientItems = useMemo26(
27939
+ const transientItems = useMemo25(
28419
27940
  () => messagesJSX.slice(replStaticPrefixLength),
28420
27941
  [messagesJSX, replStaticPrefixLength]
28421
27942
  );
28422
27943
  const showingCostDialog = !isLoading && showCostDialog;
28423
- const conversationKey = `${messageLogName}:${forkNumber}`;
28424
- return /* @__PURE__ */ React101.createElement(
27944
+ return /* @__PURE__ */ React97.createElement(
28425
27945
  PermissionProvider,
28426
27946
  {
28427
27947
  conversationKey,
28428
27948
  isBypassPermissionsModeAvailable: !safeMode
28429
27949
  },
28430
- /* @__PURE__ */ React101.createElement(React101.Fragment, null, /* @__PURE__ */ React101.createElement(React101.Fragment, { key: `static-messages-${forkNumber}` }, /* @__PURE__ */ React101.createElement(Static2, { items: staticItems, children: (item) => item.jsx })), /* @__PURE__ */ React101.createElement(TaskPanel, null), transientItems.map((_) => _.jsx), /* @__PURE__ */ React101.createElement(
28431
- Box76,
27950
+ /* @__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(
27951
+ Box72,
28432
27952
  {
28433
27953
  borderColor: "red",
28434
27954
  borderStyle: debug2 ? "single" : void 0,
28435
27955
  flexDirection: "column",
28436
27956
  width: "100%"
28437
27957
  },
28438
- !toolJSX && !toolUseConfirm && !binaryFeedbackContext && isLoading && /* @__PURE__ */ React101.createElement(RequestStatusIndicator, null),
27958
+ !toolJSX && !toolUseConfirm && !binaryFeedbackContext && isLoading && /* @__PURE__ */ React97.createElement(RequestStatusIndicator, null),
28439
27959
  toolJSX ? toolJSX.jsx : null,
28440
- !toolJSX && binaryFeedbackContext && !isMessageSelectorVisible && /* @__PURE__ */ React101.createElement(
27960
+ !toolJSX && binaryFeedbackContext && !isMessageSelectorVisible && /* @__PURE__ */ React97.createElement(
28441
27961
  BinaryFeedback,
28442
27962
  {
28443
27963
  m1: binaryFeedbackContext.m1,
@@ -28455,7 +27975,7 @@ function REPL({
28455
27975
  unresolvedToolUseIDs
28456
27976
  }
28457
27977
  ),
28458
- !toolJSX && toolUseConfirm && !isMessageSelectorVisible && !binaryFeedbackContext && /* @__PURE__ */ React101.createElement(
27978
+ !toolJSX && toolUseConfirm && !isMessageSelectorVisible && !binaryFeedbackContext && /* @__PURE__ */ React97.createElement(
28459
27979
  PermissionRequest,
28460
27980
  {
28461
27981
  toolUseConfirm,
@@ -28463,7 +27983,7 @@ function REPL({
28463
27983
  verbose
28464
27984
  }
28465
27985
  ),
28466
- !toolJSX && !toolUseConfirm && !isMessageSelectorVisible && !binaryFeedbackContext && showingCostDialog && /* @__PURE__ */ React101.createElement(
27986
+ !toolJSX && !toolUseConfirm && !isMessageSelectorVisible && !binaryFeedbackContext && showingCostDialog && /* @__PURE__ */ React97.createElement(
28467
27987
  CostThresholdDialog,
28468
27988
  {
28469
27989
  onDone: () => {
@@ -28477,7 +27997,7 @@ function REPL({
28477
27997
  }
28478
27998
  }
28479
27999
  ),
28480
- !toolUseConfirm && !toolJSX?.shouldHidePromptInput && shouldShowPromptInput && !isMessageSelectorVisible && !binaryFeedbackContext && !showingCostDialog && /* @__PURE__ */ React101.createElement(React101.Fragment, null, /* @__PURE__ */ React101.createElement(
28000
+ !toolUseConfirm && !toolJSX?.shouldHidePromptInput && shouldShowPromptInput && !isMessageSelectorVisible && !binaryFeedbackContext && !showingCostDialog && /* @__PURE__ */ React97.createElement(React97.Fragment, null, /* @__PURE__ */ React97.createElement(
28481
28001
  PromptInput_default,
28482
28002
  {
28483
28003
  commands,
@@ -28507,7 +28027,7 @@ function REPL({
28507
28027
  abortController
28508
28028
  }
28509
28029
  ))
28510
- ), isMessageSelectorVisible && /* @__PURE__ */ React101.createElement(
28030
+ ), isMessageSelectorVisible && /* @__PURE__ */ React97.createElement(
28511
28031
  MessageSelector,
28512
28032
  {
28513
28033
  erroredToolUseIDs,
@@ -28533,13 +28053,13 @@ function REPL({
28533
28053
  onEscape: () => setIsMessageSelectorVisible(false),
28534
28054
  tools
28535
28055
  }
28536
- ), /* @__PURE__ */ React101.createElement(Newline4, null))
28056
+ ), /* @__PURE__ */ React97.createElement(Newline4, null))
28537
28057
  );
28538
28058
  }
28539
28059
 
28540
28060
  // src/ui/components/SessionSelector.tsx
28541
- import React102 from "react";
28542
- import { Box as Box77, Text as Text81 } from "ink";
28061
+ import React98 from "react";
28062
+ import { Box as Box73, Text as Text77 } from "ink";
28543
28063
  function SessionSelector({
28544
28064
  sessions,
28545
28065
  onSelect
@@ -28567,14 +28087,14 @@ function SessionSelector({
28567
28087
  const truncated = labelTxt.length > columns - 2 ? `${labelTxt.slice(0, columns - 5)}...` : labelTxt;
28568
28088
  return { label: truncated, value: String(i) };
28569
28089
  });
28570
- return /* @__PURE__ */ React102.createElement(Box77, { flexDirection: "column", height: "100%", width: "100%" }, /* @__PURE__ */ React102.createElement(Box77, { paddingLeft: 9 }, /* @__PURE__ */ React102.createElement(Text81, { bold: true, color: getTheme().text }, "Modified"), /* @__PURE__ */ React102.createElement(Text81, null, " "), /* @__PURE__ */ React102.createElement(Text81, { bold: true, color: getTheme().text }, "Created"), /* @__PURE__ */ React102.createElement(Text81, null, " "), /* @__PURE__ */ React102.createElement(Text81, { bold: true, color: getTheme().text }, "Tag"), /* @__PURE__ */ React102.createElement(Text81, null, " "), /* @__PURE__ */ React102.createElement(Text81, { bold: true, color: getTheme().text }, "Session")), /* @__PURE__ */ React102.createElement(
28090
+ 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
28091
  Select,
28572
28092
  {
28573
28093
  options,
28574
28094
  onChange: (value) => onSelect(parseInt(value, 10)),
28575
28095
  visibleOptionCount: visibleCount
28576
28096
  }
28577
- ), hiddenCount > 0 && /* @__PURE__ */ React102.createElement(Box77, { paddingLeft: 2 }, /* @__PURE__ */ React102.createElement(Text81, { color: getTheme().secondaryText }, "and ", hiddenCount, " more\u2026")));
28097
+ ), hiddenCount > 0 && /* @__PURE__ */ React98.createElement(Box73, { paddingLeft: 2 }, /* @__PURE__ */ React98.createElement(Text77, { color: getTheme().secondaryText }, "and ", hiddenCount, " more\u2026")));
28578
28098
  }
28579
28099
 
28580
28100
  // src/ui/screens/ResumeConversation.tsx
@@ -28610,7 +28130,7 @@ function ResumeConversation({
28610
28130
  });
28611
28131
  const isDefaultModel = await isDefaultSlowAndCapableModel();
28612
28132
  render(
28613
- /* @__PURE__ */ React103.createElement(
28133
+ /* @__PURE__ */ React99.createElement(
28614
28134
  REPL,
28615
28135
  {
28616
28136
  commands,
@@ -28638,7 +28158,7 @@ function ResumeConversation({
28638
28158
  throw e;
28639
28159
  }
28640
28160
  }
28641
- return /* @__PURE__ */ React103.createElement(SessionSelector, { sessions, onSelect });
28161
+ return /* @__PURE__ */ React99.createElement(SessionSelector, { sessions, onSelect });
28642
28162
  }
28643
28163
 
28644
28164
  // src/commands/resume.tsx
@@ -28661,7 +28181,7 @@ var resume_default = {
28661
28181
  return null;
28662
28182
  }
28663
28183
  render2(
28664
- /* @__PURE__ */ React104.createElement(
28184
+ /* @__PURE__ */ React100.createElement(
28665
28185
  ResumeConversation,
28666
28186
  {
28667
28187
  cwd,
@@ -28678,11 +28198,11 @@ var resume_default = {
28678
28198
  };
28679
28199
 
28680
28200
  // src/commands/agents.tsx
28681
- import React106 from "react";
28201
+ import React102 from "react";
28682
28202
 
28683
28203
  // src/commands/agents/ui.tsx
28684
- import React105, { useCallback as useCallback17, useEffect as useEffect27, useMemo as useMemo27, useRef as useRef14, useState as useState29 } from "react";
28685
- import { Box as Box78, Text as Text82, useInput as useInput30 } from "ink";
28204
+ import React101, { useCallback as useCallback17, useEffect as useEffect26, useMemo as useMemo26, useRef as useRef14, useState as useState28 } from "react";
28205
+ import { Box as Box74, Text as Text78, useInput as useInput28 } from "ink";
28686
28206
  import figures9 from "figures";
28687
28207
  import chalk15 from "chalk";
28688
28208
  import { join as join13 } from "path";
@@ -28744,7 +28264,7 @@ import {
28744
28264
  mkdirSync as mkdirSync7,
28745
28265
  renameSync as renameSync3,
28746
28266
  unlinkSync as unlinkSync2,
28747
- writeFileSync as writeFileSync7
28267
+ writeFileSync as writeFileSync6
28748
28268
  } from "fs";
28749
28269
  import { join as join12 } from "path";
28750
28270
  import { homedir as homedir8 } from "os";
@@ -28752,7 +28272,7 @@ import { homedir as homedir8 } from "os";
28752
28272
  // src/commands/agents/generation.ts
28753
28273
  import { randomUUID as randomUUID6 } from "crypto";
28754
28274
  async function generateAgentWithClaude(prompt) {
28755
- const { queryModel } = await import("./llm-C6QFJQ42.js");
28275
+ const { queryModel } = await import("./llm-AR66BS2U.js");
28756
28276
  const systemPrompt = `You are an expert at creating AI agent configurations. Based on the user's description, generate a specialized agent configuration.
28757
28277
 
28758
28278
  Return your response as a JSON object with exactly these fields:
@@ -28977,7 +28497,7 @@ async function saveAgent(location, agentType, description3, tools, systemPrompt,
28977
28497
  color
28978
28498
  );
28979
28499
  try {
28980
- writeFileSync7(tempFile, content, { encoding: "utf-8", flag: "wx" });
28500
+ writeFileSync6(tempFile, content, { encoding: "utf-8", flag: "wx" });
28981
28501
  if (throwIfExists && (existsSync15(filePath) || existsSync15(legacyPath))) {
28982
28502
  try {
28983
28503
  unlinkSync2(tempFile);
@@ -29018,7 +28538,7 @@ async function updateAgent(agent, description3, tools, systemPrompt, color, mode
29018
28538
  const legacyPath = getLegacyAgentFilePath(location, agent.agentType);
29019
28539
  const filePath = existsSync15(primaryPath) ? primaryPath : existsSync15(legacyPath) ? legacyPath : primaryPath;
29020
28540
  ensureDirectoryExists(location);
29021
- writeFileSync7(filePath, content, { encoding: "utf-8", flag: "w" });
28541
+ writeFileSync6(filePath, content, { encoding: "utf-8", flag: "w" });
29022
28542
  }
29023
28543
  async function deleteAgent(agent) {
29024
28544
  if (agent.location === "built-in" || agent.location === "plugin") {
@@ -29134,21 +28654,21 @@ function panelBorderColor(kind) {
29134
28654
  }
29135
28655
  function Panel(props) {
29136
28656
  const theme = getTheme();
29137
- return /* @__PURE__ */ React105.createElement(
29138
- Box78,
28657
+ return /* @__PURE__ */ React101.createElement(
28658
+ Box74,
29139
28659
  {
29140
28660
  borderStyle: "round",
29141
28661
  borderColor: props.borderColor ?? theme.suggestion,
29142
28662
  flexDirection: "column"
29143
28663
  },
29144
- /* @__PURE__ */ React105.createElement(Box78, { flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React105.createElement(Text82, { bold: true, color: props.titleColor ?? theme.text }, props.title), props.subtitle ? /* @__PURE__ */ React105.createElement(Text82, { dimColor: true }, props.subtitle) : null),
29145
- /* @__PURE__ */ React105.createElement(Box78, { paddingX: 1, flexDirection: "column" }, props.children)
28664
+ /* @__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),
28665
+ /* @__PURE__ */ React101.createElement(Box74, { paddingX: 1, flexDirection: "column" }, props.children)
29146
28666
  );
29147
28667
  }
29148
28668
  function Instructions({
29149
28669
  instructions = "Press \u2191\u2193 to navigate \xB7 Enter to select \xB7 Esc to go back"
29150
28670
  }) {
29151
- return /* @__PURE__ */ React105.createElement(Box78, { marginLeft: 3 }, /* @__PURE__ */ React105.createElement(Text82, { dimColor: true }, instructions));
28671
+ return /* @__PURE__ */ React101.createElement(Box74, { marginLeft: 3 }, /* @__PURE__ */ React101.createElement(Text78, { dimColor: true }, instructions));
29152
28672
  }
29153
28673
  function computeOverrides(args) {
29154
28674
  const activeByType = /* @__PURE__ */ new Map();
@@ -29161,7 +28681,7 @@ function computeOverrides(args) {
29161
28681
  }
29162
28682
  function AgentsListView(props) {
29163
28683
  const theme = getTheme();
29164
- const selectableAgents = useMemo27(() => {
28684
+ const selectableAgents = useMemo26(() => {
29165
28685
  const nonBuiltIn = props.agents.filter((a) => a.source !== "built-in");
29166
28686
  if (props.source === "all") {
29167
28687
  return [
@@ -29174,11 +28694,11 @@ function AgentsListView(props) {
29174
28694
  }
29175
28695
  return nonBuiltIn;
29176
28696
  }, [props.agents, props.source]);
29177
- const [selectedAgent, setSelectedAgent] = useState29(
28697
+ const [selectedAgent, setSelectedAgent] = useState28(
29178
28698
  null
29179
28699
  );
29180
- const [onCreateOption, setOnCreateOption] = useState29(true);
29181
- useEffect27(() => {
28700
+ const [onCreateOption, setOnCreateOption] = useState28(true);
28701
+ useEffect26(() => {
29182
28702
  if (props.onCreateNew) {
29183
28703
  setOnCreateOption(true);
29184
28704
  setSelectedAgent(null);
@@ -29188,7 +28708,7 @@ function AgentsListView(props) {
29188
28708
  setSelectedAgent(selectableAgents[0] ?? null);
29189
28709
  }
29190
28710
  }, [props.source]);
29191
- useInput30((_input, key) => {
28711
+ useInput28((_input, key) => {
29192
28712
  if (key.escape) {
29193
28713
  props.onBack();
29194
28714
  return;
@@ -29227,38 +28747,38 @@ function AgentsListView(props) {
29227
28747
  setSelectedAgent(nextAgent);
29228
28748
  }
29229
28749
  });
29230
- const renderCreateNew = () => /* @__PURE__ */ React105.createElement(Box78, null, /* @__PURE__ */ React105.createElement(Text82, { color: onCreateOption ? theme.suggestion : void 0 }, onCreateOption ? `${figures9.pointer} ` : " "), /* @__PURE__ */ React105.createElement(Text82, { color: onCreateOption ? theme.suggestion : void 0 }, "Create new agent"));
28750
+ 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
28751
  const renderAgentRow = (agent) => {
29232
28752
  const isBuiltIn = agent.source === "built-in";
29233
28753
  const isSelected = !isBuiltIn && !onCreateOption && selectedAgent?.agentType === agent.agentType && selectedAgent?.source === agent.source;
29234
28754
  const dimmed = Boolean(isBuiltIn || agent.overriddenBy);
29235
28755
  const rowColor = isSelected ? theme.suggestion : void 0;
29236
28756
  const pointer = isBuiltIn ? "" : isSelected ? `${figures9.pointer} ` : " ";
29237
- return /* @__PURE__ */ React105.createElement(Box78, { key: `${agent.agentType}-${agent.source}`, flexDirection: "row" }, /* @__PURE__ */ React105.createElement(Text82, { dimColor: dimmed && !isSelected, color: rowColor }, pointer), /* @__PURE__ */ React105.createElement(Text82, { dimColor: dimmed && !isSelected, color: rowColor }, agent.agentType), /* @__PURE__ */ React105.createElement(Text82, { dimColor: true, color: rowColor }, " \xB7 ", formatModelShort(agent.model)), agent.overriddenBy ? /* @__PURE__ */ React105.createElement(Text82, { dimColor: !isSelected, color: isSelected ? theme.warning : void 0 }, " ", figures9.warning, " overridden by ", agent.overriddenBy) : null);
28757
+ 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
28758
  };
29239
28759
  const group = (label, agents) => {
29240
28760
  if (agents.length === 0) return null;
29241
28761
  const baseDir = agents[0]?.baseDir;
29242
- return /* @__PURE__ */ React105.createElement(Box78, { flexDirection: "column", marginBottom: 1 }, /* @__PURE__ */ React105.createElement(Box78, { paddingLeft: 2 }, /* @__PURE__ */ React105.createElement(Text82, { bold: true, dimColor: true }, label), baseDir ? /* @__PURE__ */ React105.createElement(Text82, { dimColor: true }, " ", "(", baseDir, ")") : null), agents.map(renderAgentRow));
28762
+ 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
28763
  };
29244
28764
  const builtInSection = (label = "Built-in (always available):") => {
29245
28765
  const builtIn = props.agents.filter((a) => a.source === "built-in");
29246
28766
  if (builtIn.length === 0) return null;
29247
- return /* @__PURE__ */ React105.createElement(Box78, { flexDirection: "column", marginBottom: 1, paddingLeft: 2 }, /* @__PURE__ */ React105.createElement(Text82, { bold: true, dimColor: true }, label), builtIn.map(renderAgentRow));
28767
+ return /* @__PURE__ */ React101.createElement(Box74, { flexDirection: "column", marginBottom: 1, paddingLeft: 2 }, /* @__PURE__ */ React101.createElement(Text78, { bold: true, dimColor: true }, label), builtIn.map(renderAgentRow));
29248
28768
  };
29249
28769
  const notOverriddenCount = props.agents.filter((a) => !a.overriddenBy).length;
29250
28770
  const title = titleForSource(props.source);
29251
28771
  if (props.agents.length === 0 || props.source !== "built-in" && !props.agents.some((a) => a.source !== "built-in")) {
29252
- return /* @__PURE__ */ React105.createElement(React105.Fragment, null, /* @__PURE__ */ React105.createElement(Panel, { title, subtitle: "No agents found" }, props.onCreateNew ? /* @__PURE__ */ React105.createElement(Box78, { marginY: 1 }, renderCreateNew()) : null, /* @__PURE__ */ React105.createElement(Text82, { dimColor: true }, "No agents found. Create specialized subagents that Claude can delegate to."), /* @__PURE__ */ React105.createElement(Text82, { dimColor: true }, "Each subagent has its own context window, custom system prompt, and specific tools."), /* @__PURE__ */ React105.createElement(Text82, { 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__ */ React105.createElement(React105.Fragment, null, /* @__PURE__ */ React105.createElement(Box78, { marginTop: 1 }, /* @__PURE__ */ React105.createElement(Text82, { dimColor: true }, "\u2500".repeat(40))), builtInSection()) : null), /* @__PURE__ */ React105.createElement(Instructions, null));
28772
+ 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
28773
  }
29254
- return /* @__PURE__ */ React105.createElement(React105.Fragment, null, /* @__PURE__ */ React105.createElement(
28774
+ return /* @__PURE__ */ React101.createElement(React101.Fragment, null, /* @__PURE__ */ React101.createElement(
29255
28775
  Panel,
29256
28776
  {
29257
28777
  title,
29258
28778
  subtitle: `${notOverriddenCount} agents`
29259
28779
  },
29260
- props.changes.length > 0 ? /* @__PURE__ */ React105.createElement(Box78, { marginTop: 1 }, /* @__PURE__ */ React105.createElement(Text82, { dimColor: true }, props.changes[props.changes.length - 1])) : null,
29261
- /* @__PURE__ */ React105.createElement(Box78, { flexDirection: "column", marginTop: 1 }, props.onCreateNew ? /* @__PURE__ */ React105.createElement(Box78, { marginBottom: 1 }, renderCreateNew()) : null, props.source === "all" ? /* @__PURE__ */ React105.createElement(React105.Fragment, null, group(
28780
+ props.changes.length > 0 ? /* @__PURE__ */ React101.createElement(Box74, { marginTop: 1 }, /* @__PURE__ */ React101.createElement(Text78, { dimColor: true }, props.changes[props.changes.length - 1])) : null,
28781
+ /* @__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
28782
  "User agents",
29263
28783
  props.agents.filter((a) => a.source === "userSettings")
29264
28784
  ), group(
@@ -29273,8 +28793,8 @@ function AgentsListView(props) {
29273
28793
  ), group(
29274
28794
  "CLI arg agents",
29275
28795
  props.agents.filter((a) => a.source === "flagSettings")
29276
- ), builtInSection("Built-in agents (always available)")) : props.source === "built-in" ? /* @__PURE__ */ React105.createElement(React105.Fragment, null, /* @__PURE__ */ React105.createElement(Text82, { dimColor: true, italic: true }, "Built-in agents are provided by default and cannot be modified."), /* @__PURE__ */ React105.createElement(Box78, { marginTop: 1, flexDirection: "column" }, props.agents.map(renderAgentRow))) : /* @__PURE__ */ React105.createElement(Box78, { flexDirection: "column" }, props.agents.filter((a) => a.source !== "built-in").map(renderAgentRow)))
29277
- ), /* @__PURE__ */ React105.createElement(Instructions, null));
28796
+ ), 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)))
28797
+ ), /* @__PURE__ */ React101.createElement(Instructions, null));
29278
28798
  }
29279
28799
  function wizardLocationToStorageLocation(location) {
29280
28800
  return location === "projectSettings" ? "project" : "user";
@@ -29310,9 +28830,9 @@ function modelOptions() {
29310
28830
  ];
29311
28831
  }
29312
28832
  function Wizard(props) {
29313
- const [stepIndex, setStepIndex] = useState29(0);
29314
- const [data, setData] = useState29(props.initialData ?? {});
29315
- const [history, setHistory] = useState29([]);
28833
+ const [stepIndex, setStepIndex] = useState28(0);
28834
+ const [data, setData] = useState28(props.initialData ?? {});
28835
+ const [history, setHistory] = useState28([]);
29316
28836
  const goNext = useCallback17(() => {
29317
28837
  setHistory((prev) => [...prev, stepIndex]);
29318
28838
  setStepIndex((prev) => Math.min(prev + 1, props.steps.length - 1));
@@ -29341,7 +28861,7 @@ function Wizard(props) {
29341
28861
  }, []);
29342
28862
  const cancel = useCallback17(() => props.onCancel(), [props.onCancel]);
29343
28863
  const done = useCallback17(() => props.onDone(data), [props, data]);
29344
- const ctx = useMemo27(
28864
+ const ctx = useMemo26(
29345
28865
  () => ({
29346
28866
  stepIndex,
29347
28867
  totalSteps: props.steps.length,
@@ -29365,16 +28885,16 @@ function Wizard(props) {
29365
28885
  cancel
29366
28886
  ]
29367
28887
  );
29368
- return /* @__PURE__ */ React105.createElement(React105.Fragment, null, props.steps[stepIndex]?.(ctx) ?? null);
28888
+ return /* @__PURE__ */ React101.createElement(React101.Fragment, null, props.steps[stepIndex]?.(ctx) ?? null);
29369
28889
  }
29370
28890
  function WizardPanel(props) {
29371
- return /* @__PURE__ */ React105.createElement(React105.Fragment, null, /* @__PURE__ */ React105.createElement(Panel, { title: "Create new agent", subtitle: props.subtitle }, props.children), /* @__PURE__ */ React105.createElement(Instructions, { instructions: props.footerText }));
28891
+ 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
28892
  }
29373
28893
  function StepChooseLocation({ ctx }) {
29374
- useInput30((_input, key) => {
28894
+ useInput28((_input, key) => {
29375
28895
  if (key.escape) ctx.cancel();
29376
28896
  });
29377
- return /* @__PURE__ */ React105.createElement(WizardPanel, { subtitle: "Choose location", footerText: "Press \u2191\u2193 to navigate \xB7 Enter to select \xB7 Esc to cancel" }, /* @__PURE__ */ React105.createElement(Box78, { marginTop: 1 }, /* @__PURE__ */ React105.createElement(
28897
+ 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
28898
  Select,
29379
28899
  {
29380
28900
  options: [
@@ -29390,10 +28910,10 @@ function StepChooseLocation({ ctx }) {
29390
28910
  )));
29391
28911
  }
29392
28912
  function StepChooseMethod({ ctx }) {
29393
- useInput30((_input, key) => {
28913
+ useInput28((_input, key) => {
29394
28914
  if (key.escape) ctx.goBack();
29395
28915
  });
29396
- return /* @__PURE__ */ React105.createElement(WizardPanel, { subtitle: "Creation method" }, /* @__PURE__ */ React105.createElement(Box78, { marginTop: 1 }, /* @__PURE__ */ React105.createElement(
28916
+ return /* @__PURE__ */ React101.createElement(WizardPanel, { subtitle: "Creation method" }, /* @__PURE__ */ React101.createElement(Box74, { marginTop: 1 }, /* @__PURE__ */ React101.createElement(
29397
28917
  Select,
29398
28918
  {
29399
28919
  options: [
@@ -29411,13 +28931,13 @@ function StepChooseMethod({ ctx }) {
29411
28931
  }
29412
28932
  function StepGenerationPrompt(props) {
29413
28933
  const { ctx } = props;
29414
- const [value, setValue] = useState29(ctx.wizardData.generationPrompt ?? "");
29415
- const [cursorOffset, setCursorOffset] = useState29(value.length);
29416
- const [isGenerating, setIsGenerating] = useState29(false);
29417
- const [error, setError] = useState29(null);
28934
+ const [value, setValue] = useState28(ctx.wizardData.generationPrompt ?? "");
28935
+ const [cursorOffset, setCursorOffset] = useState28(value.length);
28936
+ const [isGenerating, setIsGenerating] = useState28(false);
28937
+ const [error, setError] = useState28(null);
29418
28938
  const abortRef = useRef14(null);
29419
28939
  const columns = Math.min(80, process.stdout.columns ?? 80);
29420
- useInput30((_input, key) => {
28940
+ useInput28((_input, key) => {
29421
28941
  if (!key.escape) return;
29422
28942
  if (isGenerating && abortRef.current) {
29423
28943
  abortRef.current.abort();
@@ -29477,7 +28997,7 @@ function StepGenerationPrompt(props) {
29477
28997
  abortRef.current = null;
29478
28998
  }
29479
28999
  };
29480
- return /* @__PURE__ */ React105.createElement(WizardPanel, { subtitle: "Describe the agent you want" }, /* @__PURE__ */ React105.createElement(Box78, { flexDirection: "column", marginTop: 1, gap: 1 }, /* @__PURE__ */ React105.createElement(Text82, null, "What should this agent do?"), /* @__PURE__ */ React105.createElement(Text82, { dimColor: true }, "Describe a role like \u201Ccode reviewer\u201D, \u201Csecurity auditor\u201D, or \u201Ctech lead\u201D."), /* @__PURE__ */ React105.createElement(
29000
+ 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
29001
  TextInput,
29482
29002
  {
29483
29003
  value,
@@ -29488,7 +29008,7 @@ function StepGenerationPrompt(props) {
29488
29008
  cursorOffset,
29489
29009
  onChangeCursorOffset: setCursorOffset
29490
29010
  }
29491
- ), error ? /* @__PURE__ */ React105.createElement(Text82, { color: themeColor("error") }, error) : null, isGenerating ? /* @__PURE__ */ React105.createElement(Text82, { dimColor: true }, "Generating\u2026") : null));
29011
+ ), error ? /* @__PURE__ */ React101.createElement(Text78, { color: themeColor("error") }, error) : null, isGenerating ? /* @__PURE__ */ React101.createElement(Text78, { dimColor: true }, "Generating\u2026") : null));
29492
29012
  }
29493
29013
  function themeColor(kind) {
29494
29014
  const theme = getTheme();
@@ -29506,11 +29026,11 @@ function themeColor(kind) {
29506
29026
  }
29507
29027
  function StepAgentType(props) {
29508
29028
  const { ctx } = props;
29509
- const [value, setValue] = useState29(ctx.wizardData.agentType ?? "");
29510
- const [cursorOffset, setCursorOffset] = useState29(value.length);
29511
- const [error, setError] = useState29(null);
29029
+ const [value, setValue] = useState28(ctx.wizardData.agentType ?? "");
29030
+ const [cursorOffset, setCursorOffset] = useState28(value.length);
29031
+ const [error, setError] = useState28(null);
29512
29032
  const columns = 60;
29513
- useInput30((_input, key) => {
29033
+ useInput28((_input, key) => {
29514
29034
  if (key.escape) ctx.goBack();
29515
29035
  });
29516
29036
  const onSubmit = (next) => {
@@ -29524,13 +29044,13 @@ function StepAgentType(props) {
29524
29044
  ctx.updateWizardData({ agentType: trimmed });
29525
29045
  ctx.goNext();
29526
29046
  };
29527
- return /* @__PURE__ */ React105.createElement(
29047
+ return /* @__PURE__ */ React101.createElement(
29528
29048
  WizardPanel,
29529
29049
  {
29530
29050
  subtitle: "Agent type (identifier)",
29531
29051
  footerText: "Press Enter to continue \xB7 Esc to go back"
29532
29052
  },
29533
- /* @__PURE__ */ React105.createElement(Box78, { flexDirection: "column", marginTop: 1, gap: 1 }, /* @__PURE__ */ React105.createElement(Text82, null, "Enter a unique identifier for your agent:"), /* @__PURE__ */ React105.createElement(
29053
+ /* @__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
29054
  TextInput,
29535
29055
  {
29536
29056
  value,
@@ -29540,15 +29060,15 @@ function StepAgentType(props) {
29540
29060
  cursorOffset,
29541
29061
  onChangeCursorOffset: setCursorOffset
29542
29062
  }
29543
- ), /* @__PURE__ */ React105.createElement(Text82, { dimColor: true }, "e.g., code-reviewer, tech-lead, etc"), error ? /* @__PURE__ */ React105.createElement(Text82, { color: themeColor("error") }, error) : null)
29063
+ ), /* @__PURE__ */ React101.createElement(Text78, { dimColor: true }, "e.g., code-reviewer, tech-lead, etc"), error ? /* @__PURE__ */ React101.createElement(Text78, { color: themeColor("error") }, error) : null)
29544
29064
  );
29545
29065
  }
29546
29066
  function StepSystemPrompt({ ctx }) {
29547
- const [value, setValue] = useState29(ctx.wizardData.systemPrompt ?? "");
29548
- const [cursorOffset, setCursorOffset] = useState29(value.length);
29549
- const [error, setError] = useState29(null);
29067
+ const [value, setValue] = useState28(ctx.wizardData.systemPrompt ?? "");
29068
+ const [cursorOffset, setCursorOffset] = useState28(value.length);
29069
+ const [error, setError] = useState28(null);
29550
29070
  const columns = Math.min(80, process.stdout.columns ?? 80);
29551
- useInput30((_input, key) => {
29071
+ useInput28((_input, key) => {
29552
29072
  if (key.escape) ctx.goBack();
29553
29073
  });
29554
29074
  const onSubmit = (next) => {
@@ -29561,13 +29081,13 @@ function StepSystemPrompt({ ctx }) {
29561
29081
  ctx.updateWizardData({ systemPrompt: trimmed });
29562
29082
  ctx.goNext();
29563
29083
  };
29564
- return /* @__PURE__ */ React105.createElement(
29084
+ return /* @__PURE__ */ React101.createElement(
29565
29085
  WizardPanel,
29566
29086
  {
29567
29087
  subtitle: "System prompt",
29568
29088
  footerText: "Press Enter to continue \xB7 Esc to go back"
29569
29089
  },
29570
- /* @__PURE__ */ React105.createElement(Box78, { flexDirection: "column", marginTop: 1, gap: 1 }, /* @__PURE__ */ React105.createElement(Text82, null, "Enter the system prompt for your agent:"), /* @__PURE__ */ React105.createElement(Text82, { dimColor: true }, "Be comprehensive for best results"), /* @__PURE__ */ React105.createElement(
29090
+ /* @__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
29091
  TextInput,
29572
29092
  {
29573
29093
  value,
@@ -29578,15 +29098,15 @@ function StepSystemPrompt({ ctx }) {
29578
29098
  cursorOffset,
29579
29099
  onChangeCursorOffset: setCursorOffset
29580
29100
  }
29581
- ), error ? /* @__PURE__ */ React105.createElement(Text82, { color: themeColor("error") }, error) : null)
29101
+ ), error ? /* @__PURE__ */ React101.createElement(Text78, { color: themeColor("error") }, error) : null)
29582
29102
  );
29583
29103
  }
29584
29104
  function StepDescription({ ctx }) {
29585
- const [value, setValue] = useState29(ctx.wizardData.whenToUse ?? "");
29586
- const [cursorOffset, setCursorOffset] = useState29(value.length);
29587
- const [error, setError] = useState29(null);
29105
+ const [value, setValue] = useState28(ctx.wizardData.whenToUse ?? "");
29106
+ const [cursorOffset, setCursorOffset] = useState28(value.length);
29107
+ const [error, setError] = useState28(null);
29588
29108
  const columns = Math.min(80, process.stdout.columns ?? 80);
29589
- useInput30((_input, key) => {
29109
+ useInput28((_input, key) => {
29590
29110
  if (key.escape) ctx.goBack();
29591
29111
  });
29592
29112
  const onSubmit = (next) => {
@@ -29599,13 +29119,13 @@ function StepDescription({ ctx }) {
29599
29119
  ctx.updateWizardData({ whenToUse: trimmed });
29600
29120
  ctx.goNext();
29601
29121
  };
29602
- return /* @__PURE__ */ React105.createElement(
29122
+ return /* @__PURE__ */ React101.createElement(
29603
29123
  WizardPanel,
29604
29124
  {
29605
29125
  subtitle: "Description (tell Claude when to use this agent)",
29606
29126
  footerText: "Press Enter to continue \xB7 Esc to go back"
29607
29127
  },
29608
- /* @__PURE__ */ React105.createElement(Box78, { flexDirection: "column", marginTop: 1, gap: 1 }, /* @__PURE__ */ React105.createElement(Text82, null, "When should Claude use this agent?"), /* @__PURE__ */ React105.createElement(
29128
+ /* @__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
29129
  TextInput,
29610
29130
  {
29611
29131
  value,
@@ -29616,11 +29136,11 @@ function StepDescription({ ctx }) {
29616
29136
  cursorOffset,
29617
29137
  onChangeCursorOffset: setCursorOffset
29618
29138
  }
29619
- ), error ? /* @__PURE__ */ React105.createElement(Text82, { color: themeColor("error") }, error) : null)
29139
+ ), error ? /* @__PURE__ */ React101.createElement(Text78, { color: themeColor("error") }, error) : null)
29620
29140
  );
29621
29141
  }
29622
29142
  function ToolPicker(props) {
29623
- const normalizedTools = useMemo27(() => {
29143
+ const normalizedTools = useMemo26(() => {
29624
29144
  const unique = /* @__PURE__ */ new Map();
29625
29145
  for (const tool of props.tools) {
29626
29146
  if (!tool?.name) continue;
@@ -29628,20 +29148,20 @@ function ToolPicker(props) {
29628
29148
  }
29629
29149
  return Array.from(unique.values()).sort((a, b) => a.name.localeCompare(b.name));
29630
29150
  }, [props.tools]);
29631
- const allToolNames = useMemo27(
29151
+ const allToolNames = useMemo26(
29632
29152
  () => normalizedTools.map((t) => t.name),
29633
29153
  [normalizedTools]
29634
29154
  );
29635
- const initialSelectedNames = useMemo27(() => {
29155
+ const initialSelectedNames = useMemo26(() => {
29636
29156
  if (!props.initialTools) return allToolNames;
29637
29157
  if (props.initialTools.includes("*")) return allToolNames;
29638
29158
  const available = new Set(allToolNames);
29639
29159
  return props.initialTools.filter((t) => available.has(t));
29640
29160
  }, [props.initialTools, allToolNames]);
29641
- const [selected, setSelected] = useState29(initialSelectedNames);
29642
- const [cursorIndex, setCursorIndex] = useState29(0);
29643
- const [showAdvanced, setShowAdvanced] = useState29(false);
29644
- const selectedSet = useMemo27(() => new Set(selected), [selected]);
29161
+ const [selected, setSelected] = useState28(initialSelectedNames);
29162
+ const [cursorIndex, setCursorIndex] = useState28(0);
29163
+ const [showAdvanced, setShowAdvanced] = useState28(false);
29164
+ const selectedSet = useMemo26(() => new Set(selected), [selected]);
29645
29165
  const isAllSelected = selected.length === allToolNames.length && allToolNames.length > 0;
29646
29166
  const toggleOne = (name3) => {
29647
29167
  setSelected(
@@ -29661,7 +29181,7 @@ function ToolPicker(props) {
29661
29181
  const next = selected.length === allToolNames.length && allToolNames.every((n) => selected.includes(n)) ? void 0 : selected;
29662
29182
  props.onComplete(next);
29663
29183
  };
29664
- const categorized = useMemo27(() => {
29184
+ const categorized = useMemo26(() => {
29665
29185
  const readOnly = /* @__PURE__ */ new Set(["Read", "Glob", "Grep", "LS"]);
29666
29186
  const edit = /* @__PURE__ */ new Set(["Edit", "MultiEdit", "Write", "NotebookEdit"]);
29667
29187
  const execution = /* @__PURE__ */ new Set(["Bash", "BashOutput", "KillBash"]);
@@ -29676,7 +29196,7 @@ function ToolPicker(props) {
29676
29196
  }
29677
29197
  return buckets;
29678
29198
  }, [normalizedTools]);
29679
- const mcpServers = useMemo27(() => {
29199
+ const mcpServers = useMemo26(() => {
29680
29200
  const byServer = /* @__PURE__ */ new Map();
29681
29201
  for (const name3 of categorized.mcp) {
29682
29202
  const parsed = parseMcpToolName(name3);
@@ -29687,7 +29207,7 @@ function ToolPicker(props) {
29687
29207
  }
29688
29208
  return Array.from(byServer.entries()).map(([serverName, toolNames]) => ({ serverName, toolNames })).sort((a, b) => a.serverName.localeCompare(b.serverName));
29689
29209
  }, [categorized.mcp]);
29690
- const items = useMemo27(() => {
29210
+ const items = useMemo26(() => {
29691
29211
  const out = [];
29692
29212
  out.push({ id: "continue", label: "[ Continue ]", action: complete });
29693
29213
  out.push({
@@ -29752,7 +29272,7 @@ function ToolPicker(props) {
29752
29272
  selectedSet,
29753
29273
  showAdvanced
29754
29274
  ]);
29755
- useInput30((_input, key) => {
29275
+ useInput28((_input, key) => {
29756
29276
  if (key.escape) {
29757
29277
  props.onCancel();
29758
29278
  return;
@@ -29775,12 +29295,12 @@ function ToolPicker(props) {
29775
29295
  return;
29776
29296
  }
29777
29297
  });
29778
- return /* @__PURE__ */ React105.createElement(Box78, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React105.createElement(Text82, { color: cursorIndex === 0 ? themeColor("suggestion") : void 0, bold: cursorIndex === 0 }, cursorIndex === 0 ? `${figures9.pointer} ` : " ", "[ Continue ]"), /* @__PURE__ */ React105.createElement(Text82, { dimColor: true }, "\u2500".repeat(40)), items.slice(1).map((item, idx) => {
29298
+ 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
29299
  const index = idx + 1;
29780
29300
  const focused = index === cursorIndex;
29781
29301
  const prefix = item.isHeader ? "" : focused ? `${figures9.pointer} ` : " ";
29782
- return /* @__PURE__ */ React105.createElement(React105.Fragment, { key: item.id }, item.isToggle ? /* @__PURE__ */ React105.createElement(Text82, { dimColor: true }, "\u2500".repeat(40)) : null, /* @__PURE__ */ React105.createElement(
29783
- Text82,
29302
+ return /* @__PURE__ */ React101.createElement(React101.Fragment, { key: item.id }, item.isToggle ? /* @__PURE__ */ React101.createElement(Text78, { dimColor: true }, "\u2500".repeat(40)) : null, /* @__PURE__ */ React101.createElement(
29303
+ Text78,
29784
29304
  {
29785
29305
  dimColor: item.isHeader,
29786
29306
  color: !item.isHeader && focused ? themeColor("suggestion") : void 0,
@@ -29788,12 +29308,12 @@ function ToolPicker(props) {
29788
29308
  },
29789
29309
  item.isToggle ? `${prefix}[ ${item.label} ]` : `${prefix}${item.label}`
29790
29310
  ));
29791
- }), /* @__PURE__ */ React105.createElement(Box78, { marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React105.createElement(Text82, { dimColor: true }, isAllSelected ? "All tools selected" : `${selectedSet.size} of ${allToolNames.length} tools selected`)));
29311
+ }), /* @__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
29312
  }
29793
29313
  function StepSelectTools(props) {
29794
29314
  const { ctx } = props;
29795
29315
  const initialTools = ctx.wizardData.selectedTools;
29796
- return /* @__PURE__ */ React105.createElement(React105.Fragment, null, /* @__PURE__ */ React105.createElement(Panel, { title: "Create new agent", subtitle: "Select tools" }, /* @__PURE__ */ React105.createElement(
29316
+ return /* @__PURE__ */ React101.createElement(React101.Fragment, null, /* @__PURE__ */ React101.createElement(Panel, { title: "Create new agent", subtitle: "Select tools" }, /* @__PURE__ */ React101.createElement(
29797
29317
  ToolPicker,
29798
29318
  {
29799
29319
  tools: props.tools,
@@ -29804,15 +29324,15 @@ function StepSelectTools(props) {
29804
29324
  },
29805
29325
  onCancel: ctx.goBack
29806
29326
  }
29807
- )), /* @__PURE__ */ React105.createElement(Instructions, { instructions: "Press Enter to toggle selection \xB7 \u2191\u2193 Navigate \xB7 Esc to go back" }));
29327
+ )), /* @__PURE__ */ React101.createElement(Instructions, { instructions: "Press Enter to toggle selection \xB7 \u2191\u2193 Navigate \xB7 Esc to go back" }));
29808
29328
  }
29809
29329
  function StepSelectModel({ ctx }) {
29810
- useInput30((_input, key) => {
29330
+ useInput28((_input, key) => {
29811
29331
  if (key.escape) ctx.goBack();
29812
29332
  });
29813
29333
  const options = modelOptions();
29814
29334
  const defaultValue = ctx.wizardData.selectedModel ?? DEFAULT_AGENT_MODEL;
29815
- return /* @__PURE__ */ React105.createElement(WizardPanel, { subtitle: "Select model", footerText: "Press \u2191\u2193 to navigate \xB7 Enter to select \xB7 Esc to go back" }, /* @__PURE__ */ React105.createElement(Box78, { flexDirection: "column", marginTop: 1, gap: 1 }, /* @__PURE__ */ React105.createElement(Text82, { dimColor: true }, "Model determines the agent's reasoning capabilities and speed."), /* @__PURE__ */ React105.createElement(
29335
+ 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
29336
  Select,
29817
29337
  {
29818
29338
  options,
@@ -29825,20 +29345,20 @@ function StepSelectModel({ ctx }) {
29825
29345
  )));
29826
29346
  }
29827
29347
  function ColorPicker(props) {
29828
- const [index, setIndex] = useState29(
29348
+ const [index, setIndex] = useState28(
29829
29349
  Math.max(0, COLOR_OPTIONS.findIndex((c) => c === props.currentColor))
29830
29350
  );
29831
- useInput30((_input, key) => {
29351
+ useInput28((_input, key) => {
29832
29352
  if (key.upArrow) setIndex((i) => i > 0 ? i - 1 : COLOR_OPTIONS.length - 1);
29833
29353
  else if (key.downArrow) setIndex((i) => i < COLOR_OPTIONS.length - 1 ? i + 1 : 0);
29834
29354
  else if (key.return) props.onConfirm(COLOR_OPTIONS[index] ?? "automatic");
29835
29355
  });
29836
- return /* @__PURE__ */ React105.createElement(Box78, { flexDirection: "column", gap: 1 }, COLOR_OPTIONS.map((color, i) => {
29356
+ return /* @__PURE__ */ React101.createElement(Box74, { flexDirection: "column", gap: 1 }, COLOR_OPTIONS.map((color, i) => {
29837
29357
  const focused = i === index;
29838
29358
  const prefix = focused ? figures9.pointer : " ";
29839
29359
  const label = color === "automatic" ? "Automatic color" : color.charAt(0).toUpperCase() + color.slice(1);
29840
- return /* @__PURE__ */ React105.createElement(React105.Fragment, { key: color }, /* @__PURE__ */ React105.createElement(
29841
- Text82,
29360
+ return /* @__PURE__ */ React101.createElement(React101.Fragment, { key: color }, /* @__PURE__ */ React101.createElement(
29361
+ Text78,
29842
29362
  {
29843
29363
  color: focused ? themeColor("suggestion") : void 0,
29844
29364
  bold: focused
@@ -29850,7 +29370,7 @@ function ColorPicker(props) {
29850
29370
  }));
29851
29371
  }
29852
29372
  function StepChooseColor({ ctx }) {
29853
- useInput30((_input, key) => {
29373
+ useInput28((_input, key) => {
29854
29374
  if (key.escape) ctx.goBack();
29855
29375
  });
29856
29376
  const agentType = ctx.wizardData.agentType ?? "agent";
@@ -29871,7 +29391,7 @@ function StepChooseColor({ ctx }) {
29871
29391
  });
29872
29392
  ctx.goNext();
29873
29393
  };
29874
- return /* @__PURE__ */ React105.createElement(WizardPanel, { subtitle: "Choose background color", footerText: "Press \u2191\u2193 to navigate \xB7 Enter to select \xB7 Esc to go back" }, /* @__PURE__ */ React105.createElement(Box78, { marginTop: 1 }, /* @__PURE__ */ React105.createElement(ColorPicker, { agentName: agentType, currentColor: "automatic", onConfirm })));
29394
+ 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
29395
  }
29876
29396
  function validateFinalAgent(args) {
29877
29397
  const errors = [];
@@ -29898,8 +29418,8 @@ function validateFinalAgent(args) {
29898
29418
  function StepConfirm(props) {
29899
29419
  const { ctx } = props;
29900
29420
  const finalAgent = ctx.wizardData.finalAgent;
29901
- const [error, setError] = useState29(null);
29902
- useInput30((input, key) => {
29421
+ const [error, setError] = useState28(null);
29422
+ useInput28((input, key) => {
29903
29423
  if (key.escape) ctx.goBack();
29904
29424
  else if (input === "e") void doSave(true);
29905
29425
  else if (input === "s" || key.return) void doSave(false);
@@ -29936,28 +29456,28 @@ function StepConfirm(props) {
29936
29456
  });
29937
29457
  const locationPath = finalAgent.source === "projectSettings" ? getPrimaryAgentFilePath("project", finalAgent.agentType) : getPrimaryAgentFilePath("user", finalAgent.agentType);
29938
29458
  const truncate = (text) => text.length > 240 ? `${text.slice(0, 240)}\u2026` : text;
29939
- return /* @__PURE__ */ React105.createElement(
29459
+ return /* @__PURE__ */ React101.createElement(
29940
29460
  WizardPanel,
29941
29461
  {
29942
29462
  subtitle: "Confirm and save",
29943
29463
  footerText: "Press s/Enter to save \xB7 e to edit in your editor \xB7 Esc to cancel"
29944
29464
  },
29945
- /* @__PURE__ */ React105.createElement(Box78, { flexDirection: "column", marginTop: 1, gap: 1 }, /* @__PURE__ */ React105.createElement(Text82, null, /* @__PURE__ */ React105.createElement(Text82, { bold: true }, "Name"), ": ", finalAgent.agentType), /* @__PURE__ */ React105.createElement(Text82, null, /* @__PURE__ */ React105.createElement(Text82, { bold: true }, "Location"), ": ", locationPath), /* @__PURE__ */ React105.createElement(Text82, null, /* @__PURE__ */ React105.createElement(Text82, { bold: true }, "Tools"), ": ", toolSummary(finalAgent.tools)), /* @__PURE__ */ React105.createElement(Text82, null, /* @__PURE__ */ React105.createElement(Text82, { bold: true }, "Model"), ": ", formatModelLong(finalAgent.model)), /* @__PURE__ */ React105.createElement(Box78, { marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React105.createElement(Text82, null, /* @__PURE__ */ React105.createElement(Text82, { bold: true }, "Description"), " (tells Claude when to use this agent):"), /* @__PURE__ */ React105.createElement(Box78, { marginLeft: 2, marginTop: 1 }, /* @__PURE__ */ React105.createElement(Text82, null, truncate(finalAgent.whenToUse)))), /* @__PURE__ */ React105.createElement(Box78, { marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React105.createElement(Text82, null, /* @__PURE__ */ React105.createElement(Text82, { bold: true }, "System prompt"), ":"), /* @__PURE__ */ React105.createElement(Box78, { marginLeft: 2, marginTop: 1 }, /* @__PURE__ */ React105.createElement(Text82, null, truncate(finalAgent.systemPrompt)))), validation.warnings.length > 0 ? /* @__PURE__ */ React105.createElement(Box78, { marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React105.createElement(Text82, { color: themeColor("warning") }, "Warnings:"), validation.warnings.map((w, i) => /* @__PURE__ */ React105.createElement(React105.Fragment, { key: i }, /* @__PURE__ */ React105.createElement(Text82, { dimColor: true }, " ", "\u2022 ", w)))) : null, validation.errors.length > 0 ? /* @__PURE__ */ React105.createElement(Box78, { marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React105.createElement(Text82, { color: themeColor("error") }, "Errors:"), validation.errors.map((e, i) => /* @__PURE__ */ React105.createElement(React105.Fragment, { key: i }, /* @__PURE__ */ React105.createElement(Text82, { color: themeColor("error") }, " ", "\u2022 ", e)))) : null, error ? /* @__PURE__ */ React105.createElement(Box78, { marginTop: 1 }, /* @__PURE__ */ React105.createElement(Text82, { color: themeColor("error") }, error)) : null)
29465
+ /* @__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
29466
  );
29947
29467
  }
29948
29468
  function CreateAgentWizard(props) {
29949
- const steps = useMemo27(() => {
29469
+ const steps = useMemo26(() => {
29950
29470
  return [
29951
- (ctx) => /* @__PURE__ */ React105.createElement(StepChooseLocation, { ctx }),
29952
- (ctx) => /* @__PURE__ */ React105.createElement(StepChooseMethod, { ctx }),
29953
- (ctx) => /* @__PURE__ */ React105.createElement(StepGenerationPrompt, { ctx, existingAgents: props.existingAgents }),
29954
- (ctx) => /* @__PURE__ */ React105.createElement(StepAgentType, { ctx, existingAgents: props.existingAgents }),
29955
- (ctx) => /* @__PURE__ */ React105.createElement(StepSystemPrompt, { ctx }),
29956
- (ctx) => /* @__PURE__ */ React105.createElement(StepDescription, { ctx }),
29957
- (ctx) => /* @__PURE__ */ React105.createElement(StepSelectTools, { ctx, tools: props.tools }),
29958
- (ctx) => /* @__PURE__ */ React105.createElement(StepSelectModel, { ctx }),
29959
- (ctx) => /* @__PURE__ */ React105.createElement(StepChooseColor, { ctx }),
29960
- (ctx) => /* @__PURE__ */ React105.createElement(
29471
+ (ctx) => /* @__PURE__ */ React101.createElement(StepChooseLocation, { ctx }),
29472
+ (ctx) => /* @__PURE__ */ React101.createElement(StepChooseMethod, { ctx }),
29473
+ (ctx) => /* @__PURE__ */ React101.createElement(StepGenerationPrompt, { ctx, existingAgents: props.existingAgents }),
29474
+ (ctx) => /* @__PURE__ */ React101.createElement(StepAgentType, { ctx, existingAgents: props.existingAgents }),
29475
+ (ctx) => /* @__PURE__ */ React101.createElement(StepSystemPrompt, { ctx }),
29476
+ (ctx) => /* @__PURE__ */ React101.createElement(StepDescription, { ctx }),
29477
+ (ctx) => /* @__PURE__ */ React101.createElement(StepSelectTools, { ctx, tools: props.tools }),
29478
+ (ctx) => /* @__PURE__ */ React101.createElement(StepSelectModel, { ctx }),
29479
+ (ctx) => /* @__PURE__ */ React101.createElement(StepChooseColor, { ctx }),
29480
+ (ctx) => /* @__PURE__ */ React101.createElement(
29961
29481
  StepConfirm,
29962
29482
  {
29963
29483
  ctx,
@@ -29990,7 +29510,7 @@ function CreateAgentWizard(props) {
29990
29510
  )
29991
29511
  ];
29992
29512
  }, [props]);
29993
- return /* @__PURE__ */ React105.createElement(
29513
+ return /* @__PURE__ */ React101.createElement(
29994
29514
  Wizard,
29995
29515
  {
29996
29516
  steps,
@@ -30001,7 +29521,7 @@ function CreateAgentWizard(props) {
30001
29521
  );
30002
29522
  }
30003
29523
  function AgentMenu(props) {
30004
- useInput30((_input, key) => {
29524
+ useInput28((_input, key) => {
30005
29525
  if (key.escape) props.onCancel();
30006
29526
  });
30007
29527
  const isBuiltIn = props.agent.source === "built-in";
@@ -30013,16 +29533,16 @@ function AgentMenu(props) {
30013
29533
  ],
30014
29534
  { label: "Back", value: "back" }
30015
29535
  ];
30016
- return /* @__PURE__ */ React105.createElement(React105.Fragment, null, /* @__PURE__ */ React105.createElement(Panel, { title: props.agent.agentType }, /* @__PURE__ */ React105.createElement(Box78, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React105.createElement(
29536
+ 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
29537
  Select,
30018
29538
  {
30019
29539
  options,
30020
29540
  onChange: (value) => props.onChoose(value)
30021
29541
  }
30022
- ))), /* @__PURE__ */ React105.createElement(Instructions, null));
29542
+ ))), /* @__PURE__ */ React101.createElement(Instructions, null));
30023
29543
  }
30024
29544
  function ViewAgent(props) {
30025
- useInput30((_input, key) => {
29545
+ useInput28((_input, key) => {
30026
29546
  if (key.escape || key.return) props.onBack();
30027
29547
  });
30028
29548
  const toolNames = new Set(props.tools.map((t) => t.name));
@@ -30055,15 +29575,15 @@ function ViewAgent(props) {
30055
29575
  const toolsSummary = () => {
30056
29576
  if (parsedTools.hasWildcard) return "All tools";
30057
29577
  if (!props.agent.tools || props.agent.tools === "*" || props.agent.tools.length === 0) return "None";
30058
- return /* @__PURE__ */ React105.createElement(React105.Fragment, null, parsedTools.valid.length > 0 ? parsedTools.valid.join(", ") : null, parsedTools.invalid.length > 0 ? /* @__PURE__ */ React105.createElement(React105.Fragment, null, /* @__PURE__ */ React105.createElement(Text82, { color: themeColor("warning") }, " ", figures9.warning, " Unrecognized: ", parsedTools.invalid.join(", "))) : null);
29578
+ 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
29579
  };
30060
- return /* @__PURE__ */ React105.createElement(React105.Fragment, null, /* @__PURE__ */ React105.createElement(Panel, { title: props.agent.agentType }, /* @__PURE__ */ React105.createElement(Box78, { flexDirection: "column", gap: 1 }, /* @__PURE__ */ React105.createElement(Text82, { dimColor: true }, sourceLine), /* @__PURE__ */ React105.createElement(Box78, { flexDirection: "column" }, /* @__PURE__ */ React105.createElement(Text82, null, /* @__PURE__ */ React105.createElement(Text82, { bold: true }, "Description"), " (tells Claude when to use this agent):"), /* @__PURE__ */ React105.createElement(Box78, { marginLeft: 2 }, /* @__PURE__ */ React105.createElement(Text82, null, props.agent.whenToUse))), /* @__PURE__ */ React105.createElement(Text82, null, /* @__PURE__ */ React105.createElement(Text82, { bold: true }, "Tools"), ": ", toolsSummary()), /* @__PURE__ */ React105.createElement(Text82, null, /* @__PURE__ */ React105.createElement(Text82, { bold: true }, "Model"), ": ", formatModelLong(props.agent.model)), props.agent.color ? /* @__PURE__ */ React105.createElement(Text82, null, /* @__PURE__ */ React105.createElement(Text82, { bold: true }, "Color"), ": ", props.agent.color) : null, props.agent.systemPrompt ? /* @__PURE__ */ React105.createElement(React105.Fragment, null, /* @__PURE__ */ React105.createElement(Text82, null, /* @__PURE__ */ React105.createElement(Text82, { bold: true }, "System prompt"), ":"), /* @__PURE__ */ React105.createElement(Box78, { marginLeft: 2, marginRight: 2 }, /* @__PURE__ */ React105.createElement(Text82, null, props.agent.systemPrompt))) : null)), /* @__PURE__ */ React105.createElement(Instructions, { instructions: "Press Enter or Esc to go back" }));
29580
+ 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
29581
  }
30062
29582
  function EditAgent(props) {
30063
- const [mode, setMode] = useState29("menu");
30064
- const [selectedIndex, setSelectedIndex] = useState29(0);
30065
- const [error, setError] = useState29(null);
30066
- const menuItems = useMemo27(
29583
+ const [mode, setMode] = useState28("menu");
29584
+ const [selectedIndex, setSelectedIndex] = useState28(0);
29585
+ const [error, setError] = useState28(null);
29586
+ const menuItems = useMemo26(
30067
29587
  () => [
30068
29588
  { label: "Open in editor", action: "open" },
30069
29589
  { label: "Edit tools", action: "edit-tools" },
@@ -30100,7 +29620,7 @@ function EditAgent(props) {
30100
29620
  setError(err instanceof Error ? err.message : String(err));
30101
29621
  }
30102
29622
  };
30103
- useInput30((_input, key) => {
29623
+ useInput28((_input, key) => {
30104
29624
  if (mode === "edit-model") {
30105
29625
  if (key.escape) setMode("menu");
30106
29626
  return;
@@ -30122,7 +29642,7 @@ function EditAgent(props) {
30122
29642
  }
30123
29643
  });
30124
29644
  if (mode === "edit-tools") {
30125
- return /* @__PURE__ */ React105.createElement(React105.Fragment, null, /* @__PURE__ */ React105.createElement(Panel, { title: `Edit agent: ${props.agent.agentType}` }, /* @__PURE__ */ React105.createElement(
29645
+ return /* @__PURE__ */ React101.createElement(React101.Fragment, null, /* @__PURE__ */ React101.createElement(Panel, { title: `Edit agent: ${props.agent.agentType}` }, /* @__PURE__ */ React101.createElement(
30126
29646
  ToolPicker,
30127
29647
  {
30128
29648
  tools: props.tools,
@@ -30134,10 +29654,10 @@ function EditAgent(props) {
30134
29654
  },
30135
29655
  onCancel: () => setMode("menu")
30136
29656
  }
30137
- ), error ? /* @__PURE__ */ React105.createElement(Box78, { marginTop: 1 }, /* @__PURE__ */ React105.createElement(Text82, { color: themeColor("error") }, error)) : null), /* @__PURE__ */ React105.createElement(Instructions, { instructions: "Press Enter to toggle selection \xB7 \u2191\u2193 Navigate \xB7 Esc to go back" }));
29657
+ ), 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
29658
  }
30139
29659
  if (mode === "edit-model") {
30140
- return /* @__PURE__ */ React105.createElement(React105.Fragment, null, /* @__PURE__ */ React105.createElement(Panel, { title: `Edit agent: ${props.agent.agentType}` }, /* @__PURE__ */ React105.createElement(Box78, { flexDirection: "column", gap: 1, marginTop: 1 }, /* @__PURE__ */ React105.createElement(Text82, { dimColor: true }, "Model determines the agent's reasoning capabilities and speed."), /* @__PURE__ */ React105.createElement(
29660
+ 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
29661
  Select,
30142
29662
  {
30143
29663
  options: modelOptions(),
@@ -30147,10 +29667,10 @@ function EditAgent(props) {
30147
29667
  setMode("menu");
30148
29668
  }
30149
29669
  }
30150
- )), error ? /* @__PURE__ */ React105.createElement(Box78, { marginTop: 1 }, /* @__PURE__ */ React105.createElement(Text82, { color: themeColor("error") }, error)) : null), /* @__PURE__ */ React105.createElement(Instructions, null));
29670
+ )), error ? /* @__PURE__ */ React101.createElement(Box74, { marginTop: 1 }, /* @__PURE__ */ React101.createElement(Text78, { color: themeColor("error") }, error)) : null), /* @__PURE__ */ React101.createElement(Instructions, null));
30151
29671
  }
30152
29672
  if (mode === "edit-color") {
30153
- return /* @__PURE__ */ React105.createElement(React105.Fragment, null, /* @__PURE__ */ React105.createElement(Panel, { title: `Edit agent: ${props.agent.agentType}` }, /* @__PURE__ */ React105.createElement(Box78, { marginTop: 1 }, /* @__PURE__ */ React105.createElement(
29673
+ 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
29674
  ColorPicker,
30155
29675
  {
30156
29676
  agentName: props.agent.agentType,
@@ -30160,29 +29680,29 @@ function EditAgent(props) {
30160
29680
  setMode("menu");
30161
29681
  }
30162
29682
  }
30163
- )), error ? /* @__PURE__ */ React105.createElement(Box78, { marginTop: 1 }, /* @__PURE__ */ React105.createElement(Text82, { color: themeColor("error") }, error)) : null), /* @__PURE__ */ React105.createElement(Instructions, null));
29683
+ )), error ? /* @__PURE__ */ React101.createElement(Box74, { marginTop: 1 }, /* @__PURE__ */ React101.createElement(Text78, { color: themeColor("error") }, error)) : null), /* @__PURE__ */ React101.createElement(Instructions, null));
30164
29684
  }
30165
- return /* @__PURE__ */ React105.createElement(React105.Fragment, null, /* @__PURE__ */ React105.createElement(Panel, { title: `Edit agent: ${props.agent.agentType}` }, /* @__PURE__ */ React105.createElement(Box78, { flexDirection: "column" }, /* @__PURE__ */ React105.createElement(Text82, { dimColor: true }, "Source: ", titleForSource(props.agent.source)), /* @__PURE__ */ React105.createElement(Box78, { marginTop: 1, flexDirection: "column" }, menuItems.map((item, idx) => /* @__PURE__ */ React105.createElement(React105.Fragment, { key: item.label }, /* @__PURE__ */ React105.createElement(
30166
- Text82,
29685
+ 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(
29686
+ Text78,
30167
29687
  {
30168
29688
  color: idx === selectedIndex ? themeColor("suggestion") : void 0
30169
29689
  },
30170
29690
  idx === selectedIndex ? `${figures9.pointer} ` : " ",
30171
29691
  item.label
30172
- )))), error ? /* @__PURE__ */ React105.createElement(Box78, { marginTop: 1 }, /* @__PURE__ */ React105.createElement(Text82, { color: themeColor("error") }, error)) : null)), /* @__PURE__ */ React105.createElement(Instructions, null));
29692
+ )))), error ? /* @__PURE__ */ React101.createElement(Box74, { marginTop: 1 }, /* @__PURE__ */ React101.createElement(Text78, { color: themeColor("error") }, error)) : null)), /* @__PURE__ */ React101.createElement(Instructions, null));
30173
29693
  }
30174
29694
  function DeleteConfirm(props) {
30175
- useInput30((_input, key) => {
29695
+ useInput28((_input, key) => {
30176
29696
  if (key.escape) props.onCancel();
30177
29697
  });
30178
- return /* @__PURE__ */ React105.createElement(React105.Fragment, null, /* @__PURE__ */ React105.createElement(
29698
+ return /* @__PURE__ */ React101.createElement(React101.Fragment, null, /* @__PURE__ */ React101.createElement(
30179
29699
  Panel,
30180
29700
  {
30181
29701
  title: "Delete agent",
30182
29702
  borderColor: panelBorderColor("error"),
30183
29703
  titleColor: themeColor("error")
30184
29704
  },
30185
- /* @__PURE__ */ React105.createElement(Box78, { flexDirection: "column", gap: 1 }, /* @__PURE__ */ React105.createElement(Text82, null, "Are you sure you want to delete the agent ", /* @__PURE__ */ React105.createElement(Text82, { bold: true }, props.agent.agentType), "?"), /* @__PURE__ */ React105.createElement(Box78, { marginTop: 1 }, /* @__PURE__ */ React105.createElement(Text82, { dimColor: true }, "Source: ", props.agent.source)), /* @__PURE__ */ React105.createElement(Box78, { marginTop: 1 }, /* @__PURE__ */ React105.createElement(
29705
+ /* @__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
29706
  Select,
30187
29707
  {
30188
29708
  options: [
@@ -30195,22 +29715,22 @@ function DeleteConfirm(props) {
30195
29715
  }
30196
29716
  }
30197
29717
  )))
30198
- ), /* @__PURE__ */ React105.createElement(Instructions, { instructions: "Press \u2191\u2193 to navigate, Enter to select, Esc to cancel" }));
29718
+ ), /* @__PURE__ */ React101.createElement(Instructions, { instructions: "Press \u2191\u2193 to navigate, Enter to select, Esc to cancel" }));
30199
29719
  }
30200
29720
  function AgentsUI({ onExit }) {
30201
- const [mode, setMode] = useState29({ mode: "list-agents", source: "all" });
30202
- const [loading, setLoading] = useState29(true);
30203
- const [allAgents, setAllAgents] = useState29([]);
30204
- const [activeAgents, setActiveAgents] = useState29([]);
30205
- const [tools, setTools] = useState29([]);
30206
- const [changes, setChanges] = useState29([]);
29721
+ const [mode, setMode] = useState28({ mode: "list-agents", source: "all" });
29722
+ const [loading, setLoading] = useState28(true);
29723
+ const [allAgents, setAllAgents] = useState28([]);
29724
+ const [activeAgents, setActiveAgents] = useState28([]);
29725
+ const [tools, setTools] = useState28([]);
29726
+ const [changes, setChanges] = useState28([]);
30207
29727
  const refresh = useCallback17(async () => {
30208
29728
  clearAgentCache();
30209
29729
  const [all, active2] = await Promise.all([getAllAgents(), getActiveAgents()]);
30210
29730
  setAllAgents(all);
30211
29731
  setActiveAgents(active2);
30212
29732
  }, []);
30213
- useEffect27(() => {
29733
+ useEffect26(() => {
30214
29734
  let mounted = true;
30215
29735
  (async () => {
30216
29736
  try {
@@ -30225,11 +29745,11 @@ function AgentsUI({ onExit }) {
30225
29745
  mounted = false;
30226
29746
  };
30227
29747
  }, [refresh]);
30228
- const agentsWithOverride = useMemo27(
29748
+ const agentsWithOverride = useMemo26(
30229
29749
  () => computeOverrides({ allAgents, activeAgents }),
30230
29750
  [allAgents, activeAgents]
30231
29751
  );
30232
- const listAgentsForSource = useMemo27(() => {
29752
+ const listAgentsForSource = useMemo26(() => {
30233
29753
  const bySource = {
30234
29754
  "built-in": agentsWithOverride.filter((a) => a.source === "built-in"),
30235
29755
  userSettings: agentsWithOverride.filter((a) => a.source === "userSettings"),
@@ -30266,10 +29786,10 @@ ${changes.join("\n")}`);
30266
29786
  onExit("Agents dialog dismissed");
30267
29787
  }, [changes, onExit]);
30268
29788
  if (loading) {
30269
- return /* @__PURE__ */ React105.createElement(React105.Fragment, null, /* @__PURE__ */ React105.createElement(Panel, { title: "Agents", subtitle: "Loading\u2026" }, /* @__PURE__ */ React105.createElement(Text82, { dimColor: true }, "Loading agents\u2026")), /* @__PURE__ */ React105.createElement(Instructions, null));
29789
+ 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
29790
  }
30271
29791
  if (mode.mode === "list-agents") {
30272
- return /* @__PURE__ */ React105.createElement(
29792
+ return /* @__PURE__ */ React101.createElement(
30273
29793
  AgentsListView,
30274
29794
  {
30275
29795
  source: mode.source,
@@ -30282,7 +29802,7 @@ ${changes.join("\n")}`);
30282
29802
  );
30283
29803
  }
30284
29804
  if (mode.mode === "create-agent") {
30285
- return /* @__PURE__ */ React105.createElement(
29805
+ return /* @__PURE__ */ React101.createElement(
30286
29806
  CreateAgentWizard,
30287
29807
  {
30288
29808
  tools,
@@ -30297,7 +29817,7 @@ ${changes.join("\n")}`);
30297
29817
  );
30298
29818
  }
30299
29819
  if (mode.mode === "agent-menu") {
30300
- return /* @__PURE__ */ React105.createElement(
29820
+ return /* @__PURE__ */ React101.createElement(
30301
29821
  AgentMenu,
30302
29822
  {
30303
29823
  agent: mode.agent,
@@ -30312,7 +29832,7 @@ ${changes.join("\n")}`);
30312
29832
  );
30313
29833
  }
30314
29834
  if (mode.mode === "view-agent") {
30315
- return /* @__PURE__ */ React105.createElement(
29835
+ return /* @__PURE__ */ React101.createElement(
30316
29836
  ViewAgent,
30317
29837
  {
30318
29838
  agent: mode.agent,
@@ -30322,7 +29842,7 @@ ${changes.join("\n")}`);
30322
29842
  );
30323
29843
  }
30324
29844
  if (mode.mode === "edit-agent") {
30325
- return /* @__PURE__ */ React105.createElement(
29845
+ return /* @__PURE__ */ React101.createElement(
30326
29846
  EditAgent,
30327
29847
  {
30328
29848
  agent: mode.agent,
@@ -30337,7 +29857,7 @@ ${changes.join("\n")}`);
30337
29857
  );
30338
29858
  }
30339
29859
  if (mode.mode === "delete-confirm") {
30340
- return /* @__PURE__ */ React105.createElement(
29860
+ return /* @__PURE__ */ React101.createElement(
30341
29861
  DeleteConfirm,
30342
29862
  {
30343
29863
  agent: mode.agent,
@@ -30362,7 +29882,7 @@ var agents_default = {
30362
29882
  isEnabled: true,
30363
29883
  isHidden: false,
30364
29884
  async call(onExit) {
30365
- return /* @__PURE__ */ React106.createElement(AgentsUI, { onExit });
29885
+ return /* @__PURE__ */ React102.createElement(AgentsUI, { onExit });
30366
29886
  },
30367
29887
  userFacingName() {
30368
29888
  return "agents";
@@ -30434,8 +29954,8 @@ function getCommand(commandName, commands) {
30434
29954
  var TOOL_NAME_FOR_PROMPT7 = "SlashCommand";
30435
29955
 
30436
29956
  // src/tools/interaction/SlashCommandTool/SlashCommandTool.tsx
30437
- var inputSchema14 = z13.strictObject({
30438
- command: z13.string().describe(
29957
+ var inputSchema12 = z11.strictObject({
29958
+ command: z11.string().describe(
30439
29959
  'The slash command to execute with its arguments, e.g., "/review-pr 123"'
30440
29960
  )
30441
29961
  });
@@ -30460,7 +29980,7 @@ var SlashCommandTool = {
30460
29980
  userFacingName() {
30461
29981
  return "SlashCommand";
30462
29982
  },
30463
- inputSchema: inputSchema14,
29983
+ inputSchema: inputSchema12,
30464
29984
  isReadOnly() {
30465
29985
  return false;
30466
29986
  },
@@ -30523,7 +30043,7 @@ ${availableLines}${truncatedNotice}
30523
30043
  return command4 || "";
30524
30044
  },
30525
30045
  renderToolUseRejectedMessage() {
30526
- return /* @__PURE__ */ React107.createElement(FallbackToolUseRejectedMessage, null);
30046
+ return /* @__PURE__ */ React103.createElement(FallbackToolUseRejectedMessage, null);
30527
30047
  },
30528
30048
  renderResultForAssistant(output) {
30529
30049
  return `Launching command: /${output.commandName}`;
@@ -30679,9 +30199,9 @@ function parseMcpToolName2(name3) {
30679
30199
  }
30680
30200
 
30681
30201
  // src/tools/system/KillShellTool/KillShellTool.tsx
30682
- import { Box as Box79, Text as Text83 } from "ink";
30683
- import React108 from "react";
30684
- import { z as z14 } from "zod";
30202
+ import { Box as Box75, Text as Text79 } from "ink";
30203
+ import React104 from "react";
30204
+ import { z as z12 } from "zod";
30685
30205
 
30686
30206
  // src/tools/system/KillShellTool/prompt.ts
30687
30207
  var TOOL_NAME_FOR_PROMPT8 = "KillShell";
@@ -30695,8 +30215,8 @@ var PROMPT7 = `
30695
30215
  `;
30696
30216
 
30697
30217
  // src/tools/system/KillShellTool/KillShellTool.tsx
30698
- var inputSchema15 = z14.strictObject({
30699
- shell_id: z14.string().describe("The ID of the background shell to kill")
30218
+ var inputSchema13 = z12.strictObject({
30219
+ shell_id: z12.string().describe("The ID of the background shell to kill")
30700
30220
  });
30701
30221
  var KillShellTool = {
30702
30222
  name: TOOL_NAME_FOR_PROMPT8,
@@ -30706,7 +30226,7 @@ var KillShellTool = {
30706
30226
  userFacingName() {
30707
30227
  return "Kill Shell";
30708
30228
  },
30709
- inputSchema: inputSchema15,
30229
+ inputSchema: inputSchema13,
30710
30230
  isReadOnly() {
30711
30231
  return false;
30712
30232
  },
@@ -30726,10 +30246,10 @@ var KillShellTool = {
30726
30246
  return `Kill shell: ${shell_id}`;
30727
30247
  },
30728
30248
  renderToolUseRejectedMessage() {
30729
- return /* @__PURE__ */ React108.createElement(FallbackToolUseRejectedMessage, null);
30249
+ return /* @__PURE__ */ React104.createElement(FallbackToolUseRejectedMessage, null);
30730
30250
  },
30731
30251
  renderToolResultMessage(output) {
30732
- return /* @__PURE__ */ React108.createElement(Box79, { flexDirection: "row" }, /* @__PURE__ */ React108.createElement(Text83, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React108.createElement(Text83, null, "Shell ", output.shell_id, " killed"));
30252
+ 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
30253
  },
30734
30254
  renderResultForAssistant(output) {
30735
30255
  return JSON.stringify(output);
@@ -30771,7 +30291,6 @@ var KillShellTool = {
30771
30291
 
30772
30292
  // src/core/permissions/rules/planMode.ts
30773
30293
  var PLAN_MODE_ALLOWED_NON_READONLY_TOOLS = /* @__PURE__ */ new Set([
30774
- ExitPlanModeTool.name,
30775
30294
  KillShellTool.name
30776
30295
  ]);
30777
30296
 
@@ -31027,7 +30546,7 @@ var hasPermissionsToUseTool = async (tool, input, context, _assistantMessage) =>
31027
30546
  const permissionResult = await (async () => {
31028
30547
  switch (tool) {
31029
30548
  case BashTool: {
31030
- const { command: command4, dangerouslyDisableSandbox } = inputSchema13.parse(input);
30549
+ const { command: command4, dangerouslyDisableSandbox } = inputSchema11.parse(input);
31031
30550
  const trimmed = command4.trim();
31032
30551
  if (isSafeBashCommand(trimmed)) {
31033
30552
  return { result: true };
@@ -31431,7 +30950,7 @@ function WebFetchPermissionRequest({
31431
30950
  verbose
31432
30951
  }) {
31433
30952
  const theme = getTheme();
31434
- const unaryEvent = useMemo28(
30953
+ const unaryEvent = useMemo27(
31435
30954
  () => ({ completion_type: "tool_use_single", language_name: "none" }),
31436
30955
  []
31437
30956
  );
@@ -31451,13 +30970,13 @@ function WebFetchPermissionRequest({
31451
30970
  toolUseConfirm.onReject();
31452
30971
  onDone();
31453
30972
  };
31454
- useInput31((_input, key) => {
30973
+ useInput29((_input, key) => {
31455
30974
  if (key.escape) {
31456
30975
  reject();
31457
30976
  }
31458
30977
  });
31459
- return /* @__PURE__ */ React109.createElement(
31460
- Box80,
30978
+ return /* @__PURE__ */ React105.createElement(
30979
+ Box76,
31461
30980
  {
31462
30981
  flexDirection: "column",
31463
30982
  borderStyle: "round",
@@ -31467,14 +30986,14 @@ function WebFetchPermissionRequest({
31467
30986
  paddingRight: 1,
31468
30987
  paddingBottom: 1
31469
30988
  },
31470
- /* @__PURE__ */ React109.createElement(
30989
+ /* @__PURE__ */ React105.createElement(
31471
30990
  PermissionRequestTitle,
31472
30991
  {
31473
30992
  title: "Network request outside of sandbox",
31474
30993
  riskScore: null
31475
30994
  }
31476
30995
  ),
31477
- /* @__PURE__ */ React109.createElement(Box80, { flexDirection: "column", paddingX: 2, paddingY: 1 }, /* @__PURE__ */ React109.createElement(Box80, null, /* @__PURE__ */ React109.createElement(Text84, { dimColor: true }, "Host:"), /* @__PURE__ */ React109.createElement(Text84, null, " ", hostLabel)), /* @__PURE__ */ React109.createElement(Box80, { marginTop: 1 }, /* @__PURE__ */ React109.createElement(Text84, null, "Do you want to allow this connection?")), /* @__PURE__ */ React109.createElement(Box80, { marginTop: 1 }, /* @__PURE__ */ React109.createElement(
30996
+ /* @__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
30997
  Select,
31479
30998
  {
31480
30999
  options: [
@@ -31679,13 +31198,13 @@ function countNewlines(text) {
31679
31198
  }
31680
31199
  return count;
31681
31200
  }
31682
- var inputSchema13 = z15.strictObject({
31683
- command: z15.string().describe("The command to execute"),
31684
- cwd: z15.string().optional().describe(
31201
+ var inputSchema11 = z13.strictObject({
31202
+ command: z13.string().describe("The command to execute"),
31203
+ cwd: z13.string().optional().describe(
31685
31204
  "The directory to execute the command in. Use absolute path or path relative to the project root."
31686
31205
  ),
31687
- timeout: z15.number().optional().describe("Optional timeout in milliseconds (max 600000)"),
31688
- description: z15.string().optional().describe(
31206
+ timeout: z13.number().optional().describe("Optional timeout in milliseconds (max 600000)"),
31207
+ description: z13.string().optional().describe(
31689
31208
  `Clear, concise description of what this command does in 5-10 words, in active voice. Examples:
31690
31209
  Input: ls
31691
31210
  Output: List files in current directory
@@ -31699,10 +31218,10 @@ Output: Install package dependencies
31699
31218
  Input: mkdir foo
31700
31219
  Output: Create directory 'foo'`
31701
31220
  ),
31702
- run_in_background: z15.boolean().optional().describe(
31221
+ run_in_background: z13.boolean().optional().describe(
31703
31222
  "Set to true to run this command in the background. Use TaskOutput to read the output later."
31704
31223
  ),
31705
- dangerouslyDisableSandbox: z15.boolean().optional().describe(
31224
+ dangerouslyDisableSandbox: z13.boolean().optional().describe(
31706
31225
  "Set this to true to dangerously override sandbox mode and run commands without sandboxing."
31707
31226
  )
31708
31227
  });
@@ -31722,7 +31241,7 @@ var BashTool = {
31722
31241
  isConcurrencySafe(input) {
31723
31242
  return this.isReadOnly(input);
31724
31243
  },
31725
- inputSchema: inputSchema13,
31244
+ inputSchema: inputSchema11,
31726
31245
  userFacingName(input) {
31727
31246
  if (!input) return "Bash";
31728
31247
  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 +31365,10 @@ var BashTool = {
31846
31365
  return withDescription(base.trim());
31847
31366
  },
31848
31367
  renderToolUseRejectedMessage() {
31849
- return /* @__PURE__ */ React110.createElement(FallbackToolUseRejectedMessage, null);
31368
+ return /* @__PURE__ */ React106.createElement(FallbackToolUseRejectedMessage, null);
31850
31369
  },
31851
31370
  renderToolResultMessage(content) {
31852
- return /* @__PURE__ */ React110.createElement(BashToolResultMessage_default, { content, verbose: false });
31371
+ return /* @__PURE__ */ React106.createElement(BashToolResultMessage_default, { content, verbose: false });
31853
31372
  },
31854
31373
  renderResultForAssistant({
31855
31374
  interrupted,
@@ -32090,7 +31609,7 @@ Did you mean "git ${cmdParts.slice(1).join(" ")}"?`;
32090
31609
  }
32091
31610
  };
32092
31611
  setToolJSX({
32093
- jsx: /* @__PURE__ */ React110.createElement(
31612
+ jsx: /* @__PURE__ */ React106.createElement(
32094
31613
  WebFetchPermissionRequest,
32095
31614
  {
32096
31615
  toolUseConfirm,
@@ -32286,7 +31805,7 @@ ${footerParts.join(" ")}`;
32286
31805
  if (!overlayShown && setToolJSX && Date.now() - startedAt >= PROGRESS_INITIAL_DELAY_MS) {
32287
31806
  overlayShown = true;
32288
31807
  setToolJSX({
32289
- jsx: /* @__PURE__ */ React110.createElement(
31808
+ jsx: /* @__PURE__ */ React106.createElement(
32290
31809
  BashToolRunInBackgroundOverlay,
32291
31810
  {
32292
31811
  onBackground: requestBackground
@@ -32476,7 +31995,7 @@ NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTAN
32476
31995
  ` : ""}
32477
31996
 
32478
31997
  # 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, you MUST prioritize using: (1) EnterPlanMode for structured exploration and planning workflow, OR (2) 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.
31998
+ - **Code Analysis & Exploration Priority**:For **complex** codebase exploration tasks (e.g., searching across 3+ directories, requiring multiple search iterations, or investigating cross-module patterns), prefer using the Task tool with Explore subagent. This isolates exploration context in a separate transcript.For simple tasks (reading known files, single-pattern searches), use Ls/Read/Glob/Grep directly for faster results.
32480
31999
  - **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
32000
  - **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
32001
  - 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 +32088,6 @@ export {
32569
32088
  WebSearchTool,
32570
32089
  SlashCommandTool,
32571
32090
  SkillTool,
32572
- ExitPlanModeTool,
32573
32091
  KillShellTool,
32574
32092
  hasPermissionsToUseTool,
32575
32093
  BashTool,
@@ -32597,7 +32115,6 @@ export {
32597
32115
  listTasks,
32598
32116
  updateTask,
32599
32117
  rebuildTaskBlocks,
32600
- EnterPlanModeTool,
32601
32118
  AskUserQuestionTool,
32602
32119
  addToHistory,
32603
32120
  countTokens,