pybao-cli 1.4.81 → 1.4.83

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 (163) hide show
  1. package/dist/REPL-KB5JZS6S.js +49 -0
  2. package/dist/{acp-YXMNP56B.js → acp-5G23YRZD.js} +79 -32
  3. package/dist/acp-5G23YRZD.js.map +7 -0
  4. package/dist/{agentsValidate-LQFWOCPZ.js → agentsValidate-Y3JGFZPX.js} +7 -7
  5. package/dist/ask-DNEJAFQM.js +143 -0
  6. package/dist/ask-DNEJAFQM.js.map +7 -0
  7. package/dist/{autoUpdater-DEH233RT.js → autoUpdater-NBXSZEKC.js} +3 -3
  8. package/dist/{chunk-MKNRYFQR.js → chunk-53LVQG4V.js} +6 -22
  9. package/dist/{chunk-MKNRYFQR.js.map → chunk-53LVQG4V.js.map} +3 -3
  10. package/dist/{chunk-KH3U5BR5.js → chunk-5KEKIQVC.js} +3 -3
  11. package/dist/{chunk-JVF6KNE3.js → chunk-5MEGIDN7.js} +1 -1
  12. package/dist/{chunk-2NFKKANF.js → chunk-5MZZCUQX.js} +2 -2
  13. package/dist/{chunk-HIZXCXUG.js → chunk-7UTUKVKM.js} +4 -4
  14. package/dist/{chunk-4NNDWUSZ.js → chunk-A5LLPMGS.js} +2 -2
  15. package/dist/{chunk-5KAIY3II.js → chunk-CFX5VEY5.js} +3 -3
  16. package/dist/{chunk-CLGB56HY.js → chunk-DHJEENK5.js} +36 -2
  17. package/dist/{chunk-CLGB56HY.js.map → chunk-DHJEENK5.js.map} +2 -2
  18. package/dist/{chunk-VW3NZKCP.js → chunk-EINLEUKA.js} +1 -1
  19. package/dist/{chunk-H44O47XJ.js → chunk-EUHKG6AJ.js} +11 -1
  20. package/dist/chunk-EUHKG6AJ.js.map +7 -0
  21. package/dist/chunk-F4AXICO7.js +28 -0
  22. package/dist/chunk-F4AXICO7.js.map +7 -0
  23. package/dist/{chunk-EYY3QDKX.js → chunk-FPCH7C5K.js} +2 -2
  24. package/dist/{chunk-FDGIVQNE.js → chunk-FQL6V43W.js} +1 -1
  25. package/dist/{chunk-BX6HNPWQ.js → chunk-FVR53MZY.js} +3 -3
  26. package/dist/{chunk-TVUG5GLX.js → chunk-GKBRHNMB.js} +383 -161
  27. package/dist/chunk-GKBRHNMB.js.map +7 -0
  28. package/dist/{chunk-CCF52HVZ.js → chunk-GRQ32HWG.js} +1 -1
  29. package/dist/{chunk-CCF52HVZ.js.map → chunk-GRQ32HWG.js.map} +1 -1
  30. package/dist/{chunk-4VUECEM6.js → chunk-IDJMJZP4.js} +2 -2
  31. package/dist/{chunk-4SWM6FWR.js → chunk-IIZXV4HL.js} +2 -2
  32. package/dist/{chunk-37ZXN5M4.js → chunk-KSCBNFN7.js} +1 -1
  33. package/dist/{chunk-AB3F7T5N.js → chunk-LIFJX3UL.js} +3 -3
  34. package/dist/{chunk-6XINCIUI.js → chunk-MBIKKOOW.js} +1 -1
  35. package/dist/{chunk-B3NR3UMC.js → chunk-MKSTJEGS.js} +4 -4
  36. package/dist/{chunk-Z73SPR4B.js → chunk-OCIKBYQ4.js} +3 -3
  37. package/dist/{chunk-BJMVIICS.js → chunk-OUOB2RBI.js} +4 -4
  38. package/dist/chunk-RMZABYAD.js +262 -0
  39. package/dist/chunk-RMZABYAD.js.map +7 -0
  40. package/dist/{chunk-HNHWG52B.js → chunk-SUHM4MYA.js} +1 -1
  41. package/dist/{chunk-GMKASRN7.js → chunk-TKPY5LGF.js} +1 -1
  42. package/dist/{chunk-PRRYL2E2.js → chunk-V37R5FE5.js} +16 -16
  43. package/dist/{chunk-UUS77RPP.js → chunk-VRRJXBF3.js} +1 -1
  44. package/dist/{chunk-7ANXEZRS.js → chunk-WGGELTRR.js} +3 -3
  45. package/dist/{chunk-ZE75JZFY.js → chunk-WSP4AYLZ.js} +3 -3
  46. package/dist/{chunk-GS4PRJHV.js → chunk-XHQMUJIS.js} +4 -4
  47. package/dist/chunk-XKYHFZEC.js +68 -0
  48. package/dist/chunk-XKYHFZEC.js.map +7 -0
  49. package/dist/{cli-VNT2RTPP.js → cli-7JVEUFE2.js} +399 -379
  50. package/dist/cli-7JVEUFE2.js.map +7 -0
  51. package/dist/commands-FPZREXUW.js +53 -0
  52. package/dist/{config-VK55G2IB.js → config-YGHZ7OZB.js} +4 -4
  53. package/dist/{context-QHTEENJ6.js → context-SNUVPSIW.js} +6 -6
  54. package/dist/conversationTracker-IXJWSKYY.js +17 -0
  55. package/dist/{customCommands-HRHE7ZIM.js → customCommands-2YZVCPNF.js} +4 -4
  56. package/dist/{env-GGYUE5V7.js → env-SPCTS7IU.js} +2 -2
  57. package/dist/{file-KHYC624L.js → file-MRX573XM.js} +4 -4
  58. package/dist/index.js +3 -3
  59. package/dist/{llm-A3S75CLF.js → llm-VAN6WS52.js} +32 -29
  60. package/dist/{llm-A3S75CLF.js.map → llm-VAN6WS52.js.map} +1 -1
  61. package/dist/{llmLazy-USVVGSVL.js → llmLazy-II5PXLQI.js} +1 -1
  62. package/dist/{loader-JPKYTFFC.js → loader-EV4REQWE.js} +4 -4
  63. package/dist/{lsp-B7QJVI2U.js → lsp-O2TLN3AD.js} +6 -6
  64. package/dist/{lspAnchor-JJJ2WKI7.js → lspAnchor-BLB7II5Y.js} +6 -6
  65. package/dist/{mcp-YOR7UMEZ.js → mcp-OJPHPVNM.js} +7 -7
  66. package/dist/{mentionProcessor-5CYA4NR4.js → mentionProcessor-BXCFLUXL.js} +5 -5
  67. package/dist/{messages-ICKAWGUW.js → messages-CUNARS37.js} +5 -1
  68. package/dist/{model-P33QONA2.js → model-OUTGOGMR.js} +5 -5
  69. package/dist/{openai-POLCH476.js → openai-WTOKA74W.js} +6 -5
  70. package/dist/{outputStyles-EZGCOEE2.js → outputStyles-K5O5RB33.js} +4 -4
  71. package/dist/{pluginRuntime-KJ3YFO2O.js → pluginRuntime-JEJXUSFZ.js} +6 -6
  72. package/dist/{pluginValidation-MR5GV7PL.js → pluginValidation-S4VSNYHJ.js} +6 -6
  73. package/dist/prompts-XUL3MGVE.js +55 -0
  74. package/dist/{pybAgentSessionLoad-TRSWA62U.js → pybAgentSessionLoad-I7MI2W5O.js} +4 -4
  75. package/dist/{pybAgentSessionResume-3IRNTCVI.js → pybAgentSessionResume-CMC5D4IX.js} +4 -4
  76. package/dist/{pybAgentStreamJsonSession-5IBYEXS5.js → pybAgentStreamJsonSession-FUT6NUZG.js} +3 -3
  77. package/dist/pybAgentStreamJsonSession-FUT6NUZG.js.map +7 -0
  78. package/dist/{pybHooks-HFAKEYDS.js → pybHooks-I4C2HCMR.js} +4 -4
  79. package/dist/query-HKFFVARD.js +57 -0
  80. package/dist/{registry-LOKL3JBE.js → registry-HA4GULY4.js} +5 -5
  81. package/dist/replSessionBridge-EBXNFUAD.js +10 -0
  82. package/dist/{ripgrep-X4LOQHA7.js → ripgrep-4F2VOLSN.js} +3 -3
  83. package/dist/{skillMarketplace-UITGQNZD.js → skillMarketplace-73JWYMAT.js} +3 -3
  84. package/dist/{state-I7LIGIFJ.js → state-WVRITIDZ.js} +2 -2
  85. package/dist/{theme-RVIXXPSQ.js → theme-BPZWU5M7.js} +5 -5
  86. package/dist/{toolPermissionSettings-TALALPH3.js → toolPermissionSettings-UOQTLVV5.js} +6 -6
  87. package/dist/toolPermissionSettings-UOQTLVV5.js.map +7 -0
  88. package/dist/tools-3OMW2SOR.js +54 -0
  89. package/dist/tools-3OMW2SOR.js.map +7 -0
  90. package/dist/{userInput-WFPUGJ4L.js → userInput-TQYQIWBV.js} +40 -36
  91. package/dist/userInput-TQYQIWBV.js.map +7 -0
  92. package/package.json +1 -1
  93. package/dist/REPL-WXPYXBW2.js +0 -46
  94. package/dist/acp-YXMNP56B.js.map +0 -7
  95. package/dist/ask-CUR6IJ2W.js +0 -129
  96. package/dist/ask-CUR6IJ2W.js.map +0 -7
  97. package/dist/chunk-H44O47XJ.js.map +0 -7
  98. package/dist/chunk-TVUG5GLX.js.map +0 -7
  99. package/dist/cli-VNT2RTPP.js.map +0 -7
  100. package/dist/commands-LAZD5O4M.js +0 -50
  101. package/dist/prompts-P4JU57HZ.js +0 -52
  102. package/dist/pybAgentStreamJsonSession-5IBYEXS5.js.map +0 -7
  103. package/dist/query-NHQFKSCC.js +0 -54
  104. package/dist/tools-HVGZBEHZ.js +0 -51
  105. package/dist/userInput-WFPUGJ4L.js.map +0 -7
  106. /package/dist/{REPL-WXPYXBW2.js.map → REPL-KB5JZS6S.js.map} +0 -0
  107. /package/dist/{agentsValidate-LQFWOCPZ.js.map → agentsValidate-Y3JGFZPX.js.map} +0 -0
  108. /package/dist/{autoUpdater-DEH233RT.js.map → autoUpdater-NBXSZEKC.js.map} +0 -0
  109. /package/dist/{chunk-KH3U5BR5.js.map → chunk-5KEKIQVC.js.map} +0 -0
  110. /package/dist/{chunk-JVF6KNE3.js.map → chunk-5MEGIDN7.js.map} +0 -0
  111. /package/dist/{chunk-2NFKKANF.js.map → chunk-5MZZCUQX.js.map} +0 -0
  112. /package/dist/{chunk-HIZXCXUG.js.map → chunk-7UTUKVKM.js.map} +0 -0
  113. /package/dist/{chunk-4NNDWUSZ.js.map → chunk-A5LLPMGS.js.map} +0 -0
  114. /package/dist/{chunk-5KAIY3II.js.map → chunk-CFX5VEY5.js.map} +0 -0
  115. /package/dist/{chunk-VW3NZKCP.js.map → chunk-EINLEUKA.js.map} +0 -0
  116. /package/dist/{chunk-EYY3QDKX.js.map → chunk-FPCH7C5K.js.map} +0 -0
  117. /package/dist/{chunk-FDGIVQNE.js.map → chunk-FQL6V43W.js.map} +0 -0
  118. /package/dist/{chunk-BX6HNPWQ.js.map → chunk-FVR53MZY.js.map} +0 -0
  119. /package/dist/{chunk-4VUECEM6.js.map → chunk-IDJMJZP4.js.map} +0 -0
  120. /package/dist/{chunk-4SWM6FWR.js.map → chunk-IIZXV4HL.js.map} +0 -0
  121. /package/dist/{chunk-37ZXN5M4.js.map → chunk-KSCBNFN7.js.map} +0 -0
  122. /package/dist/{chunk-AB3F7T5N.js.map → chunk-LIFJX3UL.js.map} +0 -0
  123. /package/dist/{chunk-6XINCIUI.js.map → chunk-MBIKKOOW.js.map} +0 -0
  124. /package/dist/{chunk-B3NR3UMC.js.map → chunk-MKSTJEGS.js.map} +0 -0
  125. /package/dist/{chunk-Z73SPR4B.js.map → chunk-OCIKBYQ4.js.map} +0 -0
  126. /package/dist/{chunk-BJMVIICS.js.map → chunk-OUOB2RBI.js.map} +0 -0
  127. /package/dist/{chunk-HNHWG52B.js.map → chunk-SUHM4MYA.js.map} +0 -0
  128. /package/dist/{chunk-GMKASRN7.js.map → chunk-TKPY5LGF.js.map} +0 -0
  129. /package/dist/{chunk-PRRYL2E2.js.map → chunk-V37R5FE5.js.map} +0 -0
  130. /package/dist/{chunk-UUS77RPP.js.map → chunk-VRRJXBF3.js.map} +0 -0
  131. /package/dist/{chunk-7ANXEZRS.js.map → chunk-WGGELTRR.js.map} +0 -0
  132. /package/dist/{chunk-ZE75JZFY.js.map → chunk-WSP4AYLZ.js.map} +0 -0
  133. /package/dist/{chunk-GS4PRJHV.js.map → chunk-XHQMUJIS.js.map} +0 -0
  134. /package/dist/{commands-LAZD5O4M.js.map → commands-FPZREXUW.js.map} +0 -0
  135. /package/dist/{config-VK55G2IB.js.map → config-YGHZ7OZB.js.map} +0 -0
  136. /package/dist/{context-QHTEENJ6.js.map → context-SNUVPSIW.js.map} +0 -0
  137. /package/dist/{customCommands-HRHE7ZIM.js.map → conversationTracker-IXJWSKYY.js.map} +0 -0
  138. /package/dist/{env-GGYUE5V7.js.map → customCommands-2YZVCPNF.js.map} +0 -0
  139. /package/dist/{file-KHYC624L.js.map → env-SPCTS7IU.js.map} +0 -0
  140. /package/dist/{llmLazy-USVVGSVL.js.map → file-MRX573XM.js.map} +0 -0
  141. /package/dist/{loader-JPKYTFFC.js.map → llmLazy-II5PXLQI.js.map} +0 -0
  142. /package/dist/{lsp-B7QJVI2U.js.map → loader-EV4REQWE.js.map} +0 -0
  143. /package/dist/{mcp-YOR7UMEZ.js.map → lsp-O2TLN3AD.js.map} +0 -0
  144. /package/dist/{lspAnchor-JJJ2WKI7.js.map → lspAnchor-BLB7II5Y.js.map} +0 -0
  145. /package/dist/{messages-ICKAWGUW.js.map → mcp-OJPHPVNM.js.map} +0 -0
  146. /package/dist/{mentionProcessor-5CYA4NR4.js.map → mentionProcessor-BXCFLUXL.js.map} +0 -0
  147. /package/dist/{model-P33QONA2.js.map → messages-CUNARS37.js.map} +0 -0
  148. /package/dist/{openai-POLCH476.js.map → model-OUTGOGMR.js.map} +0 -0
  149. /package/dist/{outputStyles-EZGCOEE2.js.map → openai-WTOKA74W.js.map} +0 -0
  150. /package/dist/{pluginValidation-MR5GV7PL.js.map → outputStyles-K5O5RB33.js.map} +0 -0
  151. /package/dist/{pluginRuntime-KJ3YFO2O.js.map → pluginRuntime-JEJXUSFZ.js.map} +0 -0
  152. /package/dist/{prompts-P4JU57HZ.js.map → pluginValidation-S4VSNYHJ.js.map} +0 -0
  153. /package/dist/{pybAgentSessionLoad-TRSWA62U.js.map → prompts-XUL3MGVE.js.map} +0 -0
  154. /package/dist/{pybAgentSessionResume-3IRNTCVI.js.map → pybAgentSessionLoad-I7MI2W5O.js.map} +0 -0
  155. /package/dist/{pybHooks-HFAKEYDS.js.map → pybAgentSessionResume-CMC5D4IX.js.map} +0 -0
  156. /package/dist/{query-NHQFKSCC.js.map → pybHooks-I4C2HCMR.js.map} +0 -0
  157. /package/dist/{registry-LOKL3JBE.js.map → query-HKFFVARD.js.map} +0 -0
  158. /package/dist/{ripgrep-X4LOQHA7.js.map → registry-HA4GULY4.js.map} +0 -0
  159. /package/dist/{skillMarketplace-UITGQNZD.js.map → replSessionBridge-EBXNFUAD.js.map} +0 -0
  160. /package/dist/{state-I7LIGIFJ.js.map → ripgrep-4F2VOLSN.js.map} +0 -0
  161. /package/dist/{theme-RVIXXPSQ.js.map → skillMarketplace-73JWYMAT.js.map} +0 -0
  162. /package/dist/{toolPermissionSettings-TALALPH3.js.map → state-WVRITIDZ.js.map} +0 -0
  163. /package/dist/{tools-HVGZBEHZ.js.map → theme-BPZWU5M7.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-EINLEUKA.js";
3
6
  import {
4
7
  formatValidationResult,
5
8
  validatePluginOrMarketplacePath
6
- } from "./chunk-7ANXEZRS.js";
9
+ } from "./chunk-WGGELTRR.js";
7
10
  import {
8
- loadPybAgentSessionMessages
9
- } from "./chunk-FDGIVQNE.js";
11
+ ConversationTracker,
12
+ appendFinishState,
13
+ findNaturalUserMessageForParent,
14
+ getConversationTrackerForContext,
15
+ isFinishComplete,
16
+ mapFinishReason
17
+ } from "./chunk-RMZABYAD.js";
10
18
  import {
11
- listPybAgentSessions
12
- } from "./chunk-VW3NZKCP.js";
19
+ beginReplSessionScope
20
+ } from "./chunk-F4AXICO7.js";
21
+ import {
22
+ loadPybAgentSessionMessages
23
+ } from "./chunk-FQL6V43W.js";
13
24
  import {
14
25
  appendSessionCustomTitleRecord,
15
26
  appendSessionJsonlFromMessage,
16
27
  appendSessionTagRecord
17
- } from "./chunk-4NNDWUSZ.js";
28
+ } from "./chunk-A5LLPMGS.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-KH3U5BR5.js";
40
+ } from "./chunk-5KEKIQVC.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-4VUECEM6.js";
49
+ } from "./chunk-IDJMJZP4.js";
39
50
  import {
40
51
  fetchCustomModels,
41
- getModelFeatures,
52
+ getModelFeatures
53
+ } from "./chunk-53LVQG4V.js";
54
+ import {
42
55
  getSessionState
43
- } from "./chunk-MKNRYFQR.js";
56
+ } from "./chunk-XKYHFZEC.js";
44
57
  import {
45
58
  queryLLM,
46
59
  queryQuick,
47
60
  verifyApiKey
48
- } from "./chunk-BJMVIICS.js";
61
+ } from "./chunk-OUOB2RBI.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-HIZXCXUG.js";
75
+ } from "./chunk-7UTUKVKM.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-HNHWG52B.js";
88
+ } from "./chunk-SUHM4MYA.js";
76
89
  import {
77
90
  loadToolPermissionContextFromDisk,
78
91
  persistToolPermissionUpdateToDisk
79
- } from "./chunk-BX6HNPWQ.js";
92
+ } from "./chunk-FVR53MZY.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-2NFKKANF.js";
103
+ } from "./chunk-5MZZCUQX.js";
91
104
  import {
92
105
  clearAgentCache,
93
106
  getActiveAgents,
94
107
  getAgentByType,
95
108
  getAllAgents
96
- } from "./chunk-CLGB56HY.js";
109
+ } from "./chunk-DHJEENK5.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-H44O47XJ.js";
140
+ } from "./chunk-EUHKG6AJ.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-EYY3QDKX.js";
170
+ } from "./chunk-FPCH7C5K.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-GS4PRJHV.js";
180
+ } from "./chunk-XHQMUJIS.js";
168
181
  import {
169
182
  getSettingsFileCandidates,
170
183
  loadSettingsWithLegacyFallback,
171
184
  readSettingsFile
172
- } from "./chunk-JVF6KNE3.js";
185
+ } from "./chunk-5MEGIDN7.js";
173
186
  import {
174
187
  getCustomCommandDirectories,
175
188
  hasCustomCommands,
176
189
  loadCustomCommands,
177
190
  reloadCustomCommands
178
- } from "./chunk-4SWM6FWR.js";
191
+ } from "./chunk-IIZXV4HL.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-Z73SPR4B.js";
199
+ } from "./chunk-OCIKBYQ4.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-B3NR3UMC.js";
207
+ } from "./chunk-MKSTJEGS.js";
195
208
  import {
196
209
  ripGrep
197
- } from "./chunk-37ZXN5M4.js";
210
+ } from "./chunk-KSCBNFN7.js";
198
211
  import {
199
212
  getTheme
200
- } from "./chunk-GMKASRN7.js";
213
+ } from "./chunk-TKPY5LGF.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-ZE75JZFY.js";
226
+ } from "./chunk-WSP4AYLZ.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-6XINCIUI.js";
235
+ } from "./chunk-MBIKKOOW.js";
223
236
  import {
224
237
  ASCII_LOGO,
225
238
  BunShell,
@@ -258,10 +271,10 @@ import {
258
271
  setCwd,
259
272
  shouldApplyToolOutputTruncation,
260
273
  truncateToolOutput
261
- } from "./chunk-UUS77RPP.js";
274
+ } from "./chunk-VRRJXBF3.js";
262
275
  import {
263
276
  MACRO
264
- } from "./chunk-CCF52HVZ.js";
277
+ } from "./chunk-GRQ32HWG.js";
265
278
  import {
266
279
  __export
267
280
  } from "./chunk-I3J4JYES.js";
@@ -442,7 +455,7 @@ var getCommandSubcommandPrefix = memoize(
442
455
  var getCommandPrefix = memoize(
443
456
  async (command4, abortSignal) => {
444
457
  const { systemPrompt, userPrompt } = buildBashCommandPrefixDetectionPrompt(command4);
445
- const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryQuick: queryQuick2 } = await import("./llm-A3S75CLF.js");
458
+ const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryQuick: queryQuick2 } = await import("./llm-VAN6WS52.js");
446
459
  const response = await queryQuick2({
447
460
  systemPrompt,
448
461
  userPrompt,
@@ -4244,7 +4257,7 @@ function formatParseError(error) {
4244
4257
  return error instanceof Error ? error.message : String(error);
4245
4258
  }
4246
4259
  async function defaultGateQuery(args) {
4247
- const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryLLM: queryLLM2 } = await import("./llm-A3S75CLF.js");
4260
+ const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryLLM: queryLLM2 } = await import("./llm-VAN6WS52.js");
4248
4261
  const queryLLMFn = args.queryLLMOverride ?? queryLLM2;
4249
4262
  const messages = [
4250
4263
  {
@@ -6641,7 +6654,7 @@ var FileEditTool = {
6641
6654
  const originalFileContent = currentFileContent;
6642
6655
  let totalPatch = [];
6643
6656
  const { SmartEdit } = await import("./smart-edit-AWHJDSU6.js");
6644
- const { findLspAnchor } = await import("./lspAnchor-JJJ2WKI7.js");
6657
+ const { findLspAnchor } = await import("./lspAnchor-BLB7II5Y.js");
6645
6658
  for (const op of editOperations) {
6646
6659
  const normalizedSearch = normalizeLineEndings(op.search);
6647
6660
  const normalizedReplace = normalizeLineEndings(op.replace);
@@ -11345,7 +11358,7 @@ async function createAndStoreApiKey(accessToken) {
11345
11358
  }
11346
11359
  saveGlobalConfig(config2);
11347
11360
  try {
11348
- const { resetAnthropicClient } = await import("./llm-A3S75CLF.js");
11361
+ const { resetAnthropicClient } = await import("./llm-VAN6WS52.js");
11349
11362
  resetAnthropicClient();
11350
11363
  } catch {
11351
11364
  }
@@ -15712,7 +15725,7 @@ async function refreshPluginRuntimeFromInstalls() {
15712
15725
  const existingRoots = getSessionPlugins().map((p) => p.rootDir);
15713
15726
  const dirs = Array.from(/* @__PURE__ */ new Set([...existingRoots, ...installedRoots]));
15714
15727
  if (dirs.length === 0) return [];
15715
- const { configureSessionPlugins } = await import("./pluginRuntime-KJ3YFO2O.js");
15728
+ const { configureSessionPlugins } = await import("./pluginRuntime-JEJXUSFZ.js");
15716
15729
  const { errors } = await configureSessionPlugins({ pluginDirs: dirs });
15717
15730
  return errors;
15718
15731
  }
@@ -16381,7 +16394,7 @@ async function call(onDone, context) {
16381
16394
  ModelConfig,
16382
16395
  {
16383
16396
  onClose: () => {
16384
- import("./model-P33QONA2.js").then(({ reloadModelManager: reloadModelManager2 }) => {
16397
+ import("./model-OUTGOGMR.js").then(({ reloadModelManager: reloadModelManager2 }) => {
16385
16398
  reloadModelManager2();
16386
16399
  triggerModelConfigChange();
16387
16400
  onDone();
@@ -24585,7 +24598,7 @@ function useStatusLine() {
24585
24598
  // src/ui/components/PromptInput.tsx
24586
24599
  async function interpretHashCommand(input) {
24587
24600
  try {
24588
- const { queryQuick: queryQuick2 } = await import("./llm-A3S75CLF.js");
24601
+ const { queryQuick: queryQuick2 } = await import("./llm-VAN6WS52.js");
24589
24602
  const systemPrompt = [
24590
24603
  "You're helping the user structure notes that will be added to their PYB.md file.",
24591
24604
  "Format the user's input into a well-structured note that will be useful for later reference.",
@@ -24898,7 +24911,7 @@ function PromptInput({
24898
24911
  if (messages2.length) {
24899
24912
  if (mode === "bash") {
24900
24913
  onQuery(messages2, newAbortController).then(async () => {
24901
- const { getCwd: getCwd2 } = await import("./state-I7LIGIFJ.js");
24914
+ const { getCwd: getCwd2 } = await import("./state-WVRITIDZ.js");
24902
24915
  setCurrentPwd(getCwd2());
24903
24916
  });
24904
24917
  } else {
@@ -25537,11 +25550,70 @@ if (process.env.NODE_ENV !== "test") {
25537
25550
  }, 0);
25538
25551
  }
25539
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
+
25540
25612
  // src/services/system/systemPrompt.ts
25541
25613
  function isGPT5Model(modelName) {
25542
25614
  return modelName.startsWith("gpt-5");
25543
25615
  }
25544
- function formatSystemPromptWithContext(systemPrompt, context, agentId, skipContextReminders = false) {
25616
+ function formatSystemPromptWithContext(systemPrompt, context, agentId, skipContextReminders = false, options) {
25545
25617
  const enhancedPrompt = [...systemPrompt];
25546
25618
  let reminders = "";
25547
25619
  const modelManager = getModelManager();
@@ -25589,6 +25661,19 @@ As you answer the user's questions, you can use the following context:
25589
25661
  )
25590
25662
  );
25591
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
+ }
25592
25677
  return { systemPrompt: enhancedPrompt, reminders };
25593
25678
  }
25594
25679
 
@@ -25886,6 +25971,12 @@ Important technical decisions made and their rationale. Alternative approaches c
25886
25971
  Focus on information essential for continuing the conversation effectively, including specific details about code, files, errors, and plans.`;
25887
25972
  var AUTO_COMPACT_NOTICE = "Context automatically compressed due to token limit.";
25888
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;
25889
25980
  function getMessageText(message) {
25890
25981
  if (!message || typeof message !== "object") return null;
25891
25982
  if (message.type !== "user" && message.type !== "assistant") return null;
@@ -25935,12 +26026,45 @@ async function shouldAutoCompact(messages) {
25935
26026
  const { isAboveAutoCompactThreshold } = await calculateThresholds(tokenCount);
25936
26027
  return isAboveAutoCompactThreshold;
25937
26028
  }
26029
+ function getSummaryContentDiagnostics(content) {
26030
+ if (typeof content === "string") {
26031
+ return {
26032
+ contentKind: "string",
26033
+ stringLength: content.length,
26034
+ preview: content.slice(0, 120)
26035
+ };
26036
+ }
26037
+ if (Array.isArray(content)) {
26038
+ return {
26039
+ contentKind: "array",
26040
+ blockCount: content.length,
26041
+ blockTypes: content.map(
26042
+ (block) => block && typeof block === "object" ? String(block.type ?? "unknown") : typeof block
26043
+ ),
26044
+ firstBlock: content[0]
26045
+ };
26046
+ }
26047
+ return {
26048
+ contentKind: typeof content,
26049
+ value: content
26050
+ };
26051
+ }
25938
26052
  async function checkAutoCompact(messages, toolUseContext) {
25939
26053
  if (!await shouldAutoCompact(messages)) {
25940
26054
  return { messages, wasCompacted: false };
25941
26055
  }
25942
26056
  try {
25943
- const compactedMessages = await executeAutoCompact(messages, toolUseContext);
26057
+ const tracker = getConversationTrackerForContext(toolUseContext);
26058
+ const completedQueryIds = tracker.getCompletedQueries().map((item) => item.queryId).slice(-MAX_COMPACTED_QUERY_IDS);
26059
+ const preservedSummary = tracker.generateConversationSummary(
26060
+ CONVERSATION_SUMMARY_LIMITS
26061
+ );
26062
+ const compactedMessages = await executeAutoCompact(messages, toolUseContext, {
26063
+ preservedSummary,
26064
+ compactedQueryIds: completedQueryIds
26065
+ });
26066
+ tracker.reset();
26067
+ tracker.persist();
25944
26068
  return {
25945
26069
  messages: compactedMessages,
25946
26070
  wasCompacted: true
@@ -25953,7 +26077,7 @@ async function checkAutoCompact(messages, toolUseContext) {
25953
26077
  return { messages, wasCompacted: false };
25954
26078
  }
25955
26079
  }
25956
- async function executeAutoCompact(messages, toolUseContext) {
26080
+ async function executeAutoCompact(messages, toolUseContext, options) {
25957
26081
  const previousSummary = findLatestAutoCompactSummary(messages);
25958
26082
  const summaryRequestContent = previousSummary ? `We already have an existing conversation summary:
25959
26083
 
@@ -26006,6 +26130,10 @@ ${COMPRESSION_PROMPT2}` : COMPRESSION_PROMPT2;
26006
26130
  const content = summaryResponse.message.content;
26007
26131
  const summary = typeof content === "string" ? content : content.length > 0 && content[0]?.type === "text" ? content[0].text : null;
26008
26132
  if (!summary) {
26133
+ debug.warn("AUTO_COMPACT_SUMMARY_CONTENT_INVALID", {
26134
+ model: compressionModelPointer,
26135
+ diagnostics: getSummaryContentDiagnostics(content)
26136
+ });
26009
26137
  throw new Error(
26010
26138
  "Failed to generate conversation summary - response did not contain valid text content"
26011
26139
  );
@@ -26023,6 +26151,23 @@ ${COMPRESSION_PROMPT2}` : COMPRESSION_PROMPT2;
26023
26151
  ),
26024
26152
  summaryResponse
26025
26153
  ];
26154
+ compactedMessages[1].compaction = {
26155
+ type: "compaction",
26156
+ auto: true,
26157
+ compactedQueryIds: (options?.compactedQueryIds ?? []).slice(
26158
+ -MAX_COMPACTED_QUERY_IDS
26159
+ ),
26160
+ timestamp: Date.now()
26161
+ };
26162
+ if (options?.preservedSummary) {
26163
+ compactedMessages.push(
26164
+ createAssistantMessage(
26165
+ `<conversation-summary>
26166
+ ${options.preservedSummary}
26167
+ </conversation-summary>`
26168
+ )
26169
+ );
26170
+ }
26026
26171
  if (recoveredFiles.length > 0) {
26027
26172
  for (const file of recoveredFiles) {
26028
26173
  const contentWithLines = addLineNumbers({
@@ -26352,13 +26497,28 @@ async function* queryCore(messages, systemPrompt, context, canUseTool, toolUseCo
26352
26497
  );
26353
26498
  };
26354
26499
  const currentRequest = getCurrentRequest();
26500
+ const conversationTrackingConfig = getConversationTrackingConfig();
26355
26501
  markPhase("QUERY_INIT");
26502
+ logConversationTrackingBaseline({
26503
+ stage: "query_init",
26504
+ agentId: toolUseContext.agentId || "main",
26505
+ messageCount: messages.length,
26506
+ systemPromptCount: systemPrompt.length,
26507
+ requestId: currentRequest?.id,
26508
+ config: conversationTrackingConfig
26509
+ });
26356
26510
  const stopHookActive = hookState?.stopHookActive === true;
26357
26511
  const stopHookAttempts = hookState?.stopHookAttempts ?? 0;
26358
26512
  const { messages: processedMessages, wasCompacted } = await checkAutoCompact(messages, toolUseContext);
26359
26513
  if (wasCompacted) {
26360
26514
  messages = processedMessages;
26361
26515
  }
26516
+ const tracker = getConversationTrackerForContext(toolUseContext);
26517
+ const activeNaturalUserMessage = findNaturalUserMessageForParent(messages);
26518
+ const activeQueryId = activeNaturalUserMessage?.queryId || activeNaturalUserMessage?.uuid;
26519
+ if (conversationTrackingConfig.enabled && activeNaturalUserMessage && activeQueryId) {
26520
+ tracker.startQuery(activeQueryId, activeNaturalUserMessage);
26521
+ }
26362
26522
  if (toolUseContext.agentId === "main") {
26363
26523
  const shell = BunShell.getInstance();
26364
26524
  const notifications = shell.flushBashNotifications();
@@ -26425,7 +26585,9 @@ async function* queryCore(messages, systemPrompt, context, canUseTool, toolUseCo
26425
26585
  const { systemPrompt: fullSystemPrompt, reminders } = formatSystemPromptWithContext(
26426
26586
  systemPrompt,
26427
26587
  context,
26428
- toolUseContext.agentId
26588
+ toolUseContext.agentId,
26589
+ false,
26590
+ { conversationTracker: tracker }
26429
26591
  );
26430
26592
  const planModeAdditions = getPlanModeSystemPromptAdditions(
26431
26593
  messages,
@@ -26444,6 +26606,14 @@ async function* queryCore(messages, systemPrompt, context, canUseTool, toolUseCo
26444
26606
  fullSystemPrompt.push(...outputStyleAdditions);
26445
26607
  }
26446
26608
  }
26609
+ logConversationTrackingBaseline({
26610
+ stage: "system_prompt_built",
26611
+ agentId: toolUseContext.agentId || "main",
26612
+ messageCount: messages.length,
26613
+ systemPromptCount: fullSystemPrompt.length,
26614
+ requestId: currentRequest?.id,
26615
+ config: conversationTrackingConfig
26616
+ });
26447
26617
  emitReminderEvent("session:startup", {
26448
26618
  agentId: toolUseContext.agentId,
26449
26619
  messages: messages.length,
@@ -26487,10 +26657,12 @@ async function* queryCore(messages, systemPrompt, context, canUseTool, toolUseCo
26487
26657
  }
26488
26658
  const assistantMessage = result.message;
26489
26659
  const shouldSkipPermissionCheck = result.shouldSkipPermissionCheck;
26660
+ const parentUserMessage = findNaturalUserMessageForParent(messages);
26490
26661
  const toolUseMessages = assistantMessage.message.content.filter(isToolUseLikeBlock);
26491
26662
  if (!toolUseMessages.length) {
26492
26663
  const stopHookEvent = toolUseContext.agentId && toolUseContext.agentId !== "main" ? "SubagentStop" : "Stop";
26493
26664
  const stopReason = assistantMessage.message?.stop_reason || assistantMessage.message?.stopReason || "end_turn";
26665
+ const finish = mapFinishReason(stopReason);
26494
26666
  const stopOutcome = await runStopHooks({
26495
26667
  hookEvent: stopHookEvent,
26496
26668
  reason: String(stopReason ?? ""),
@@ -26530,10 +26702,38 @@ async function* queryCore(messages, systemPrompt, context, canUseTool, toolUseCo
26530
26702
  return;
26531
26703
  }
26532
26704
  }
26533
- yield assistantMessage;
26705
+ if (!parentUserMessage?.uuid) {
26706
+ yield assistantMessage;
26707
+ return;
26708
+ }
26709
+ const enrichedAssistantMessage = appendFinishState(assistantMessage, {
26710
+ finish,
26711
+ parentID: parentUserMessage.uuid,
26712
+ ...isFinishComplete(finish) ? { completedAt: Date.now() } : {}
26713
+ });
26714
+ const completedQueryId = parentUserMessage.queryId || parentUserMessage.uuid;
26715
+ if (conversationTrackingConfig.enabled && conversationTrackingConfig.markCompletion && isFinishComplete(enrichedAssistantMessage.finish) && completedQueryId) {
26716
+ const completed = tracker.completeQuery(
26717
+ completedQueryId,
26718
+ enrichedAssistantMessage,
26719
+ parentUserMessage
26720
+ );
26721
+ if (completed) {
26722
+ tracker.persist();
26723
+ }
26724
+ }
26725
+ yield enrichedAssistantMessage;
26534
26726
  return;
26535
26727
  }
26536
- yield assistantMessage;
26728
+ if (!parentUserMessage?.uuid) {
26729
+ yield assistantMessage;
26730
+ } else {
26731
+ const enrichedAssistantMessage = appendFinishState(assistantMessage, {
26732
+ finish: "tool_calls",
26733
+ parentID: parentUserMessage.uuid
26734
+ });
26735
+ yield enrichedAssistantMessage;
26736
+ }
26537
26737
  const siblingToolUseIDs = new Set(toolUseMessages.map((_) => _.id));
26538
26738
  const toolQueue = new ToolUseQueue({
26539
26739
  toolDefinitions: toolUseContext.options.tools,
@@ -27357,6 +27557,20 @@ function REPL({
27357
27557
  []
27358
27558
  );
27359
27559
  const readFileTimestamps = useRef13({});
27560
+ const conversationTrackersRef = useRef13(
27561
+ /* @__PURE__ */ new Map()
27562
+ );
27563
+ const getConversationTrackerForKey = useCallback16(
27564
+ (conversationKey2) => {
27565
+ const existing = conversationTrackersRef.current.get(conversationKey2);
27566
+ if (existing) return existing;
27567
+ const created = new ConversationTracker();
27568
+ conversationTrackersRef.current.set(conversationKey2, created);
27569
+ return created;
27570
+ },
27571
+ []
27572
+ );
27573
+ const conversationKey = `${messageLogName}:${forkNumber}`;
27360
27574
  const { status: apiKeyStatus, reverify } = useApiKeyVerification();
27361
27575
  function onCancel() {
27362
27576
  if (!isLoading) {
@@ -27411,56 +27625,124 @@ function REPL({
27411
27625
  if (!initialPrompt) {
27412
27626
  return;
27413
27627
  }
27628
+ const restoreSessionScope = beginReplSessionScope(conversationKey);
27414
27629
  setIsLoading(true);
27415
27630
  const newAbortController = new AbortController();
27416
27631
  setAbortController(newAbortController);
27417
- const model = new ModelManager(getGlobalConfig()).getModelName("main");
27418
- const newMessages = await processUserInput(
27419
- initialPrompt,
27420
- "prompt",
27421
- setToolJSX,
27422
- {
27423
- abortController: newAbortController,
27424
- options: {
27425
- commands,
27426
- forkNumber,
27427
- messageLogName,
27428
- tools,
27429
- mcpClients,
27430
- verbose,
27431
- maxThinkingTokens: 0,
27432
- toolPermissionContext: getToolPermissionContextForConversationKey({
27433
- conversationKey: `${messageLogName}:${forkNumber}`,
27434
- isBypassPermissionsModeAvailable: !(safeMode ?? false)
27435
- })
27632
+ try {
27633
+ const model = new ModelManager(getGlobalConfig()).getModelName("main");
27634
+ const newMessages = await processUserInput(
27635
+ initialPrompt,
27636
+ "prompt",
27637
+ setToolJSX,
27638
+ {
27639
+ abortController: newAbortController,
27640
+ options: {
27641
+ commands,
27642
+ forkNumber,
27643
+ messageLogName,
27644
+ tools,
27645
+ mcpClients,
27646
+ verbose,
27647
+ maxThinkingTokens: 0,
27648
+ toolPermissionContext: getToolPermissionContextForConversationKey({
27649
+ conversationKey,
27650
+ isBypassPermissionsModeAvailable: !(safeMode ?? false)
27651
+ })
27652
+ },
27653
+ messageId: getLastAssistantMessageId(messages),
27654
+ setForkConvoWithMessagesOnTheNextRender,
27655
+ readFileTimestamps: readFileTimestamps.current
27436
27656
  },
27437
- messageId: getLastAssistantMessageId(messages),
27438
- setForkConvoWithMessagesOnTheNextRender,
27439
- readFileTimestamps: readFileTimestamps.current
27440
- },
27441
- null
27442
- );
27443
- if (newMessages.length) {
27444
- for (const message of newMessages) {
27445
- if (message.type === "user") {
27446
- addToHistory(initialPrompt);
27657
+ null
27658
+ );
27659
+ if (newMessages.length) {
27660
+ for (const message of newMessages) {
27661
+ if (message.type === "user") {
27662
+ addToHistory(initialPrompt);
27663
+ }
27664
+ }
27665
+ setMessages2((_) => [..._, ...newMessages]);
27666
+ const lastMessage = newMessages[newMessages.length - 1];
27667
+ if (lastMessage.type === "assistant") {
27668
+ return;
27447
27669
  }
27670
+ const [systemPrompt, context, model2, maxThinkingTokens] = await Promise.all([
27671
+ getSystemPrompt({ disableSlashCommands }),
27672
+ getContext(),
27673
+ new ModelManager(getGlobalConfig()).getModelName("main"),
27674
+ getMaxThinkingTokens([...messages, ...newMessages])
27675
+ ]);
27676
+ for await (const message of query(
27677
+ [...messages, ...newMessages],
27678
+ systemPrompt,
27679
+ context,
27680
+ canUseTool,
27681
+ {
27682
+ options: {
27683
+ commands,
27684
+ forkNumber,
27685
+ messageLogName,
27686
+ tools,
27687
+ mcpClients,
27688
+ verbose,
27689
+ safeMode,
27690
+ maxThinkingTokens,
27691
+ toolPermissionContext: getToolPermissionContextForConversationKey({
27692
+ conversationKey,
27693
+ isBypassPermissionsModeAvailable: !(safeMode ?? false)
27694
+ })
27695
+ },
27696
+ messageId: getLastAssistantMessageId([...messages, ...newMessages]),
27697
+ readFileTimestamps: readFileTimestamps.current,
27698
+ abortController: newAbortController,
27699
+ setToolJSX,
27700
+ conversationTracker: getConversationTrackerForKey(conversationKey)
27701
+ },
27702
+ getBinaryFeedbackResponse
27703
+ )) {
27704
+ setMessages2((oldMessages) => [...oldMessages, message]);
27705
+ }
27706
+ } else {
27707
+ addToHistory(initialPrompt);
27448
27708
  }
27449
- setMessages2((_) => [..._, ...newMessages]);
27709
+ setHaveShownCostDialog(
27710
+ getGlobalConfig().hasAcknowledgedCostThreshold || false
27711
+ );
27712
+ } finally {
27713
+ setIsLoading(false);
27714
+ setAbortController(null);
27715
+ restoreSessionScope();
27716
+ }
27717
+ }
27718
+ async function onQuery(newMessages, passedAbortController) {
27719
+ const restoreSessionScope = beginReplSessionScope(conversationKey);
27720
+ const controllerToUse = passedAbortController || new AbortController();
27721
+ if (!passedAbortController) {
27722
+ setAbortController(controllerToUse);
27723
+ }
27724
+ try {
27725
+ const isPybRequest = newMessages.length > 0 && newMessages[0].type === "user" && "options" in newMessages[0] && newMessages[0].options?.isPybRequest === true;
27726
+ setMessages2((oldMessages) => [...oldMessages, ...newMessages]);
27727
+ markProjectOnboardingComplete();
27450
27728
  const lastMessage = newMessages[newMessages.length - 1];
27729
+ if (lastMessage.type === "user" && typeof lastMessage.message.content === "string") {
27730
+ }
27451
27731
  if (lastMessage.type === "assistant") {
27452
- setAbortController(null);
27453
- setIsLoading(false);
27732
+ if (!passedAbortController) {
27733
+ setAbortController(null);
27734
+ }
27454
27735
  return;
27455
27736
  }
27456
- const [systemPrompt, context, model2, maxThinkingTokens] = await Promise.all([
27737
+ const [systemPrompt, context, model, maxThinkingTokens] = await Promise.all([
27457
27738
  getSystemPrompt({ disableSlashCommands }),
27458
27739
  getContext(),
27459
27740
  new ModelManager(getGlobalConfig()).getModelName("main"),
27460
- getMaxThinkingTokens([...messages, ...newMessages])
27741
+ getMaxThinkingTokens([...messages, lastMessage])
27461
27742
  ]);
27743
+ let lastAssistantMessage = null;
27462
27744
  for await (const message of query(
27463
- [...messages, ...newMessages],
27745
+ [...messages, lastMessage],
27464
27746
  systemPrompt,
27465
27747
  context,
27466
27748
  canUseTool,
@@ -27474,99 +27756,40 @@ function REPL({
27474
27756
  verbose,
27475
27757
  safeMode,
27476
27758
  maxThinkingTokens,
27759
+ isPybRequest: isPybRequest || void 0,
27477
27760
  toolPermissionContext: getToolPermissionContextForConversationKey({
27478
- conversationKey: `${messageLogName}:${forkNumber}`,
27761
+ conversationKey,
27479
27762
  isBypassPermissionsModeAvailable: !(safeMode ?? false)
27480
27763
  })
27481
27764
  },
27482
- messageId: getLastAssistantMessageId([...messages, ...newMessages]),
27765
+ messageId: getLastAssistantMessageId([...messages, lastMessage]),
27483
27766
  readFileTimestamps: readFileTimestamps.current,
27484
- abortController: newAbortController,
27485
- setToolJSX
27767
+ abortController: controllerToUse,
27768
+ setToolJSX,
27769
+ conversationTracker: getConversationTrackerForKey(conversationKey)
27486
27770
  },
27487
27771
  getBinaryFeedbackResponse
27488
27772
  )) {
27489
27773
  setMessages2((oldMessages) => [...oldMessages, message]);
27774
+ if (message.type === "assistant") {
27775
+ lastAssistantMessage = message;
27776
+ }
27490
27777
  }
27491
- } else {
27492
- addToHistory(initialPrompt);
27493
- }
27494
- setHaveShownCostDialog(
27495
- getGlobalConfig().hasAcknowledgedCostThreshold || false
27496
- );
27497
- setIsLoading(false);
27498
- setAbortController(null);
27499
- }
27500
- async function onQuery(newMessages, passedAbortController) {
27501
- const controllerToUse = passedAbortController || new AbortController();
27502
- if (!passedAbortController) {
27503
- setAbortController(controllerToUse);
27504
- }
27505
- const isPybRequest = newMessages.length > 0 && newMessages[0].type === "user" && "options" in newMessages[0] && newMessages[0].options?.isPybRequest === true;
27506
- setMessages2((oldMessages) => [...oldMessages, ...newMessages]);
27507
- markProjectOnboardingComplete();
27508
- const lastMessage = newMessages[newMessages.length - 1];
27509
- if (lastMessage.type === "user" && typeof lastMessage.message.content === "string") {
27510
- }
27511
- if (lastMessage.type === "assistant") {
27512
- setAbortController(null);
27513
- setIsLoading(false);
27514
- return;
27515
- }
27516
- const [systemPrompt, context, model, maxThinkingTokens] = await Promise.all(
27517
- [
27518
- getSystemPrompt({ disableSlashCommands }),
27519
- getContext(),
27520
- new ModelManager(getGlobalConfig()).getModelName("main"),
27521
- getMaxThinkingTokens([...messages, lastMessage])
27522
- ]
27523
- );
27524
- let lastAssistantMessage = null;
27525
- for await (const message of query(
27526
- [...messages, lastMessage],
27527
- systemPrompt,
27528
- context,
27529
- canUseTool,
27530
- {
27531
- options: {
27532
- commands,
27533
- forkNumber,
27534
- messageLogName,
27535
- tools,
27536
- mcpClients,
27537
- verbose,
27538
- safeMode,
27539
- maxThinkingTokens,
27540
- isPybRequest: isPybRequest || void 0,
27541
- toolPermissionContext: getToolPermissionContextForConversationKey({
27542
- conversationKey: `${messageLogName}:${forkNumber}`,
27543
- isBypassPermissionsModeAvailable: !(safeMode ?? false)
27544
- })
27545
- },
27546
- messageId: getLastAssistantMessageId([...messages, lastMessage]),
27547
- readFileTimestamps: readFileTimestamps.current,
27548
- abortController: controllerToUse,
27549
- setToolJSX
27550
- },
27551
- getBinaryFeedbackResponse
27552
- )) {
27553
- setMessages2((oldMessages) => [...oldMessages, message]);
27554
- if (message.type === "assistant") {
27555
- lastAssistantMessage = message;
27556
- }
27557
- }
27558
- if (isPybRequest && lastAssistantMessage && lastAssistantMessage.type === "assistant") {
27559
- try {
27560
- 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");
27561
- if (content && content.trim().length > 0) {
27562
- handleHashCommand(content);
27778
+ if (isPybRequest && lastAssistantMessage && lastAssistantMessage.type === "assistant") {
27779
+ try {
27780
+ 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");
27781
+ if (content && content.trim().length > 0) {
27782
+ handleHashCommand(content);
27783
+ }
27784
+ } catch (error) {
27785
+ logError(error);
27786
+ debug.error("REPL_PYB_SAVE_PROJECT_DOCS_ERROR", { error });
27563
27787
  }
27564
- } catch (error) {
27565
- logError(error);
27566
- debug.error("REPL_PYB_SAVE_PROJECT_DOCS_ERROR", { error });
27567
27788
  }
27789
+ } finally {
27790
+ setIsLoading(false);
27791
+ restoreSessionScope();
27568
27792
  }
27569
- setIsLoading(false);
27570
27793
  }
27571
27794
  useCostSummary();
27572
27795
  useEffect25(() => {
@@ -27745,7 +27968,6 @@ function REPL({
27745
27968
  [messagesJSX, replStaticPrefixLength]
27746
27969
  );
27747
27970
  const showingCostDialog = !isLoading && showCostDialog;
27748
- const conversationKey = `${messageLogName}:${forkNumber}`;
27749
27971
  return /* @__PURE__ */ React97.createElement(
27750
27972
  PermissionProvider,
27751
27973
  {
@@ -28077,7 +28299,7 @@ import { homedir as homedir8 } from "os";
28077
28299
  // src/commands/agents/generation.ts
28078
28300
  import { randomUUID as randomUUID6 } from "crypto";
28079
28301
  async function generateAgentWithClaude(prompt) {
28080
- const { queryModel } = await import("./llm-A3S75CLF.js");
28302
+ const { queryModel } = await import("./llm-VAN6WS52.js");
28081
28303
  const systemPrompt = `You are an expert at creating AI agent configurations. Based on the user's description, generate a specialized agent configuration.
28082
28304
 
28083
28305
  Return your response as a JSON object with exactly these fields:
@@ -31800,7 +32022,7 @@ NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTAN
31800
32022
  ` : ""}
31801
32023
 
31802
32024
  # Tool usage policy
31803
- - **Code Analysis & Exploration Priority**: When analyzing OR exploring code blocks, codebases (especially complex multi-repo projects) to understand functionality, mechanisms, logic, OR to locate features, modules, patterns, architecture, prefer to use the Task tool with Explore subagent for thorough multi-step analysis. This reduces context consumption by delegating exploration to specialized agents. For broad analysis scope, launch multiple Explore agents in parallel with different focus areas to maximize efficiency.
32025
+ - **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.
31804
32026
  - **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.
31805
32027
  - **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.
31806
32028
  - 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.