pybao-cli 1.4.81 → 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 (163) hide show
  1. package/dist/REPL-VOJCD6X6.js +49 -0
  2. package/dist/{acp-YXMNP56B.js → acp-ASRH57AF.js} +79 -32
  3. package/dist/acp-ASRH57AF.js.map +7 -0
  4. package/dist/{agentsValidate-LQFWOCPZ.js → agentsValidate-35AHZXNB.js} +7 -7
  5. package/dist/ask-TI3ITWN7.js +143 -0
  6. package/dist/ask-TI3ITWN7.js.map +7 -0
  7. package/dist/{autoUpdater-DEH233RT.js → autoUpdater-MRK5BD2L.js} +3 -3
  8. package/dist/{chunk-JVF6KNE3.js → chunk-2AG4BTRV.js} +1 -1
  9. package/dist/{chunk-PRRYL2E2.js → chunk-2S2V2ZI7.js} +16 -16
  10. package/dist/{chunk-ZE75JZFY.js → chunk-2WIUQUTU.js} +3 -3
  11. package/dist/{chunk-5KAIY3II.js → chunk-2YM35XWE.js} +3 -3
  12. package/dist/{chunk-H44O47XJ.js → chunk-AUGXOUTX.js} +11 -1
  13. package/dist/chunk-AUGXOUTX.js.map +7 -0
  14. package/dist/{chunk-FDGIVQNE.js → chunk-AYVB6VUF.js} +1 -1
  15. package/dist/{chunk-6XINCIUI.js → chunk-DYJD66YF.js} +1 -1
  16. package/dist/{chunk-EYY3QDKX.js → chunk-DZTZPEPA.js} +2 -2
  17. package/dist/chunk-F4AXICO7.js +28 -0
  18. package/dist/chunk-F4AXICO7.js.map +7 -0
  19. package/dist/{chunk-HNHWG52B.js → chunk-GSAG6WNQ.js} +1 -1
  20. package/dist/{chunk-CLGB56HY.js → chunk-GUTLXPN6.js} +36 -2
  21. package/dist/{chunk-CLGB56HY.js.map → chunk-GUTLXPN6.js.map} +2 -2
  22. package/dist/{chunk-VW3NZKCP.js → chunk-GZT2DWED.js} +1 -1
  23. package/dist/{chunk-BJMVIICS.js → chunk-HJWUPFGF.js} +4 -4
  24. package/dist/{chunk-KH3U5BR5.js → chunk-IIVG2SHE.js} +3 -3
  25. package/dist/{chunk-GS4PRJHV.js → chunk-JQVZNIKI.js} +4 -4
  26. package/dist/{chunk-MKNRYFQR.js → chunk-JT3RE7UH.js} +6 -22
  27. package/dist/{chunk-MKNRYFQR.js.map → chunk-JT3RE7UH.js.map} +3 -3
  28. package/dist/{chunk-4SWM6FWR.js → chunk-KNWW4HGV.js} +2 -2
  29. package/dist/chunk-LM665HND.js +262 -0
  30. package/dist/chunk-LM665HND.js.map +7 -0
  31. package/dist/{chunk-Z73SPR4B.js → chunk-NTL5PKCX.js} +3 -3
  32. package/dist/{chunk-2NFKKANF.js → chunk-PXPTGNYH.js} +2 -2
  33. package/dist/{chunk-HIZXCXUG.js → chunk-QUWUFGZF.js} +4 -4
  34. package/dist/{chunk-BX6HNPWQ.js → chunk-SZEYDC6A.js} +3 -3
  35. package/dist/{chunk-AB3F7T5N.js → chunk-TWWQYBVK.js} +3 -3
  36. package/dist/{chunk-UUS77RPP.js → chunk-U265OPSO.js} +1 -1
  37. package/dist/{chunk-4NNDWUSZ.js → chunk-UBX7JQR2.js} +2 -2
  38. package/dist/{chunk-4VUECEM6.js → chunk-UXVOYFKL.js} +2 -2
  39. package/dist/{chunk-37ZXN5M4.js → chunk-VMWEFYQB.js} +1 -1
  40. package/dist/{chunk-CCF52HVZ.js → chunk-WBBMOYXK.js} +1 -1
  41. package/dist/{chunk-CCF52HVZ.js.map → chunk-WBBMOYXK.js.map} +1 -1
  42. package/dist/{chunk-B3NR3UMC.js → chunk-WVYIFMLG.js} +4 -4
  43. package/dist/chunk-XKYHFZEC.js +68 -0
  44. package/dist/chunk-XKYHFZEC.js.map +7 -0
  45. package/dist/{chunk-TVUG5GLX.js → chunk-XOOHCC63.js} +356 -161
  46. package/dist/chunk-XOOHCC63.js.map +7 -0
  47. package/dist/{chunk-GMKASRN7.js → chunk-Y5JPSTQ4.js} +1 -1
  48. package/dist/{chunk-7ANXEZRS.js → chunk-ZW25QNXS.js} +3 -3
  49. package/dist/{cli-VNT2RTPP.js → cli-ECB4WYUZ.js} +399 -379
  50. package/dist/cli-ECB4WYUZ.js.map +7 -0
  51. package/dist/commands-3B77L2SI.js +53 -0
  52. package/dist/{config-VK55G2IB.js → config-KZHPV37P.js} +4 -4
  53. package/dist/{context-QHTEENJ6.js → context-ZZI53BPM.js} +6 -6
  54. package/dist/conversationTracker-SC6NCQHL.js +17 -0
  55. package/dist/{customCommands-HRHE7ZIM.js → customCommands-MX6OENKO.js} +4 -4
  56. package/dist/{env-GGYUE5V7.js → env-76WAAGI6.js} +2 -2
  57. package/dist/{file-KHYC624L.js → file-LCS77XWE.js} +4 -4
  58. package/dist/index.js +3 -3
  59. package/dist/{llm-A3S75CLF.js → llm-AR66BS2U.js} +32 -29
  60. package/dist/{llm-A3S75CLF.js.map → llm-AR66BS2U.js.map} +1 -1
  61. package/dist/{llmLazy-USVVGSVL.js → llmLazy-5W6E5BCB.js} +1 -1
  62. package/dist/{loader-JPKYTFFC.js → loader-OWZ3WD2X.js} +4 -4
  63. package/dist/{lsp-B7QJVI2U.js → lsp-NLPSJYH4.js} +6 -6
  64. package/dist/{lspAnchor-JJJ2WKI7.js → lspAnchor-MWASWGQD.js} +6 -6
  65. package/dist/{mcp-YOR7UMEZ.js → mcp-T2UB74Y2.js} +7 -7
  66. package/dist/{mentionProcessor-5CYA4NR4.js → mentionProcessor-KIBWOHEC.js} +5 -5
  67. package/dist/{messages-ICKAWGUW.js → messages-6BHCXDWR.js} +5 -1
  68. package/dist/{model-P33QONA2.js → model-5NDSZPIL.js} +5 -5
  69. package/dist/{openai-POLCH476.js → openai-7XPWH2G7.js} +6 -5
  70. package/dist/{outputStyles-EZGCOEE2.js → outputStyles-QUE4ALJQ.js} +4 -4
  71. package/dist/{pluginRuntime-KJ3YFO2O.js → pluginRuntime-PQ3VZRX7.js} +6 -6
  72. package/dist/{pluginValidation-MR5GV7PL.js → pluginValidation-RQ34XQY3.js} +6 -6
  73. package/dist/prompts-5576MRUX.js +55 -0
  74. package/dist/{pybAgentSessionLoad-TRSWA62U.js → pybAgentSessionLoad-5MWAY2A4.js} +4 -4
  75. package/dist/{pybAgentSessionResume-3IRNTCVI.js → pybAgentSessionResume-NZGSUGGS.js} +4 -4
  76. package/dist/{pybAgentStreamJsonSession-5IBYEXS5.js → pybAgentStreamJsonSession-UP4WOINX.js} +3 -3
  77. package/dist/pybAgentStreamJsonSession-UP4WOINX.js.map +7 -0
  78. package/dist/{pybHooks-HFAKEYDS.js → pybHooks-HILU7ZB4.js} +4 -4
  79. package/dist/query-LMPE4HBF.js +57 -0
  80. package/dist/{registry-LOKL3JBE.js → registry-4MWYBUFA.js} +5 -5
  81. package/dist/replSessionBridge-EBXNFUAD.js +10 -0
  82. package/dist/{ripgrep-X4LOQHA7.js → ripgrep-J74GL455.js} +3 -3
  83. package/dist/{skillMarketplace-UITGQNZD.js → skillMarketplace-ATLDIEEX.js} +3 -3
  84. package/dist/{state-I7LIGIFJ.js → state-Y2Q4MPY5.js} +2 -2
  85. package/dist/{theme-RVIXXPSQ.js → theme-3L66ZU5Z.js} +5 -5
  86. package/dist/{toolPermissionSettings-TALALPH3.js → toolPermissionSettings-PDGMFGN2.js} +6 -6
  87. package/dist/toolPermissionSettings-PDGMFGN2.js.map +7 -0
  88. package/dist/tools-45UHHM5S.js +54 -0
  89. package/dist/tools-45UHHM5S.js.map +7 -0
  90. package/dist/{userInput-WFPUGJ4L.js → userInput-GBXOUS4W.js} +40 -36
  91. package/dist/userInput-GBXOUS4W.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-VOJCD6X6.js.map} +0 -0
  107. /package/dist/{agentsValidate-LQFWOCPZ.js.map → agentsValidate-35AHZXNB.js.map} +0 -0
  108. /package/dist/{autoUpdater-DEH233RT.js.map → autoUpdater-MRK5BD2L.js.map} +0 -0
  109. /package/dist/{chunk-JVF6KNE3.js.map → chunk-2AG4BTRV.js.map} +0 -0
  110. /package/dist/{chunk-PRRYL2E2.js.map → chunk-2S2V2ZI7.js.map} +0 -0
  111. /package/dist/{chunk-ZE75JZFY.js.map → chunk-2WIUQUTU.js.map} +0 -0
  112. /package/dist/{chunk-5KAIY3II.js.map → chunk-2YM35XWE.js.map} +0 -0
  113. /package/dist/{chunk-FDGIVQNE.js.map → chunk-AYVB6VUF.js.map} +0 -0
  114. /package/dist/{chunk-6XINCIUI.js.map → chunk-DYJD66YF.js.map} +0 -0
  115. /package/dist/{chunk-EYY3QDKX.js.map → chunk-DZTZPEPA.js.map} +0 -0
  116. /package/dist/{chunk-HNHWG52B.js.map → chunk-GSAG6WNQ.js.map} +0 -0
  117. /package/dist/{chunk-VW3NZKCP.js.map → chunk-GZT2DWED.js.map} +0 -0
  118. /package/dist/{chunk-BJMVIICS.js.map → chunk-HJWUPFGF.js.map} +0 -0
  119. /package/dist/{chunk-KH3U5BR5.js.map → chunk-IIVG2SHE.js.map} +0 -0
  120. /package/dist/{chunk-GS4PRJHV.js.map → chunk-JQVZNIKI.js.map} +0 -0
  121. /package/dist/{chunk-4SWM6FWR.js.map → chunk-KNWW4HGV.js.map} +0 -0
  122. /package/dist/{chunk-Z73SPR4B.js.map → chunk-NTL5PKCX.js.map} +0 -0
  123. /package/dist/{chunk-2NFKKANF.js.map → chunk-PXPTGNYH.js.map} +0 -0
  124. /package/dist/{chunk-HIZXCXUG.js.map → chunk-QUWUFGZF.js.map} +0 -0
  125. /package/dist/{chunk-BX6HNPWQ.js.map → chunk-SZEYDC6A.js.map} +0 -0
  126. /package/dist/{chunk-AB3F7T5N.js.map → chunk-TWWQYBVK.js.map} +0 -0
  127. /package/dist/{chunk-UUS77RPP.js.map → chunk-U265OPSO.js.map} +0 -0
  128. /package/dist/{chunk-4NNDWUSZ.js.map → chunk-UBX7JQR2.js.map} +0 -0
  129. /package/dist/{chunk-4VUECEM6.js.map → chunk-UXVOYFKL.js.map} +0 -0
  130. /package/dist/{chunk-37ZXN5M4.js.map → chunk-VMWEFYQB.js.map} +0 -0
  131. /package/dist/{chunk-B3NR3UMC.js.map → chunk-WVYIFMLG.js.map} +0 -0
  132. /package/dist/{chunk-GMKASRN7.js.map → chunk-Y5JPSTQ4.js.map} +0 -0
  133. /package/dist/{chunk-7ANXEZRS.js.map → chunk-ZW25QNXS.js.map} +0 -0
  134. /package/dist/{commands-LAZD5O4M.js.map → commands-3B77L2SI.js.map} +0 -0
  135. /package/dist/{config-VK55G2IB.js.map → config-KZHPV37P.js.map} +0 -0
  136. /package/dist/{context-QHTEENJ6.js.map → context-ZZI53BPM.js.map} +0 -0
  137. /package/dist/{customCommands-HRHE7ZIM.js.map → conversationTracker-SC6NCQHL.js.map} +0 -0
  138. /package/dist/{env-GGYUE5V7.js.map → customCommands-MX6OENKO.js.map} +0 -0
  139. /package/dist/{file-KHYC624L.js.map → env-76WAAGI6.js.map} +0 -0
  140. /package/dist/{llmLazy-USVVGSVL.js.map → file-LCS77XWE.js.map} +0 -0
  141. /package/dist/{loader-JPKYTFFC.js.map → llmLazy-5W6E5BCB.js.map} +0 -0
  142. /package/dist/{lsp-B7QJVI2U.js.map → loader-OWZ3WD2X.js.map} +0 -0
  143. /package/dist/{mcp-YOR7UMEZ.js.map → lsp-NLPSJYH4.js.map} +0 -0
  144. /package/dist/{lspAnchor-JJJ2WKI7.js.map → lspAnchor-MWASWGQD.js.map} +0 -0
  145. /package/dist/{messages-ICKAWGUW.js.map → mcp-T2UB74Y2.js.map} +0 -0
  146. /package/dist/{mentionProcessor-5CYA4NR4.js.map → mentionProcessor-KIBWOHEC.js.map} +0 -0
  147. /package/dist/{model-P33QONA2.js.map → messages-6BHCXDWR.js.map} +0 -0
  148. /package/dist/{openai-POLCH476.js.map → model-5NDSZPIL.js.map} +0 -0
  149. /package/dist/{outputStyles-EZGCOEE2.js.map → openai-7XPWH2G7.js.map} +0 -0
  150. /package/dist/{pluginValidation-MR5GV7PL.js.map → outputStyles-QUE4ALJQ.js.map} +0 -0
  151. /package/dist/{pluginRuntime-KJ3YFO2O.js.map → pluginRuntime-PQ3VZRX7.js.map} +0 -0
  152. /package/dist/{prompts-P4JU57HZ.js.map → pluginValidation-RQ34XQY3.js.map} +0 -0
  153. /package/dist/{pybAgentSessionLoad-TRSWA62U.js.map → prompts-5576MRUX.js.map} +0 -0
  154. /package/dist/{pybAgentSessionResume-3IRNTCVI.js.map → pybAgentSessionLoad-5MWAY2A4.js.map} +0 -0
  155. /package/dist/{pybHooks-HFAKEYDS.js.map → pybAgentSessionResume-NZGSUGGS.js.map} +0 -0
  156. /package/dist/{query-NHQFKSCC.js.map → pybHooks-HILU7ZB4.js.map} +0 -0
  157. /package/dist/{registry-LOKL3JBE.js.map → query-LMPE4HBF.js.map} +0 -0
  158. /package/dist/{ripgrep-X4LOQHA7.js.map → registry-4MWYBUFA.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-J74GL455.js.map} +0 -0
  161. /package/dist/{theme-RVIXXPSQ.js.map → skillMarketplace-ATLDIEEX.js.map} +0 -0
  162. /package/dist/{toolPermissionSettings-TALALPH3.js.map → state-Y2Q4MPY5.js.map} +0 -0
  163. /package/dist/{tools-HVGZBEHZ.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-7ANXEZRS.js";
9
+ } from "./chunk-ZW25QNXS.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-LM665HND.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-AYVB6VUF.js";
13
24
  import {
14
25
  appendSessionCustomTitleRecord,
15
26
  appendSessionJsonlFromMessage,
16
27
  appendSessionTagRecord
17
- } from "./chunk-4NNDWUSZ.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-KH3U5BR5.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-4VUECEM6.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-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-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-HIZXCXUG.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-HNHWG52B.js";
88
+ } from "./chunk-GSAG6WNQ.js";
76
89
  import {
77
90
  loadToolPermissionContextFromDisk,
78
91
  persistToolPermissionUpdateToDisk
79
- } from "./chunk-BX6HNPWQ.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-2NFKKANF.js";
103
+ } from "./chunk-PXPTGNYH.js";
91
104
  import {
92
105
  clearAgentCache,
93
106
  getActiveAgents,
94
107
  getAgentByType,
95
108
  getAllAgents
96
- } from "./chunk-CLGB56HY.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-H44O47XJ.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-EYY3QDKX.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-GS4PRJHV.js";
180
+ } from "./chunk-JQVZNIKI.js";
168
181
  import {
169
182
  getSettingsFileCandidates,
170
183
  loadSettingsWithLegacyFallback,
171
184
  readSettingsFile
172
- } from "./chunk-JVF6KNE3.js";
185
+ } from "./chunk-2AG4BTRV.js";
173
186
  import {
174
187
  getCustomCommandDirectories,
175
188
  hasCustomCommands,
176
189
  loadCustomCommands,
177
190
  reloadCustomCommands
178
- } from "./chunk-4SWM6FWR.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-Z73SPR4B.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-B3NR3UMC.js";
207
+ } from "./chunk-WVYIFMLG.js";
195
208
  import {
196
209
  ripGrep
197
- } from "./chunk-37ZXN5M4.js";
210
+ } from "./chunk-VMWEFYQB.js";
198
211
  import {
199
212
  getTheme
200
- } from "./chunk-GMKASRN7.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-ZE75JZFY.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-6XINCIUI.js";
235
+ } from "./chunk-DYJD66YF.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-U265OPSO.js";
262
275
  import {
263
276
  MACRO
264
- } from "./chunk-CCF52HVZ.js";
277
+ } from "./chunk-WBBMOYXK.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-AR66BS2U.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-AR66BS2U.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-MWASWGQD.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-AR66BS2U.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-PQ3VZRX7.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-5NDSZPIL.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-AR66BS2U.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-Y2Q4MPY5.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;
@@ -25940,7 +26031,17 @@ async function checkAutoCompact(messages, toolUseContext) {
25940
26031
  return { messages, wasCompacted: false };
25941
26032
  }
25942
26033
  try {
25943
- 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();
25944
26045
  return {
25945
26046
  messages: compactedMessages,
25946
26047
  wasCompacted: true
@@ -25953,7 +26054,7 @@ async function checkAutoCompact(messages, toolUseContext) {
25953
26054
  return { messages, wasCompacted: false };
25954
26055
  }
25955
26056
  }
25956
- async function executeAutoCompact(messages, toolUseContext) {
26057
+ async function executeAutoCompact(messages, toolUseContext, options) {
25957
26058
  const previousSummary = findLatestAutoCompactSummary(messages);
25958
26059
  const summaryRequestContent = previousSummary ? `We already have an existing conversation summary:
25959
26060
 
@@ -26023,6 +26124,23 @@ ${COMPRESSION_PROMPT2}` : COMPRESSION_PROMPT2;
26023
26124
  ),
26024
26125
  summaryResponse
26025
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
+ }
26026
26144
  if (recoveredFiles.length > 0) {
26027
26145
  for (const file of recoveredFiles) {
26028
26146
  const contentWithLines = addLineNumbers({
@@ -26352,13 +26470,28 @@ async function* queryCore(messages, systemPrompt, context, canUseTool, toolUseCo
26352
26470
  );
26353
26471
  };
26354
26472
  const currentRequest = getCurrentRequest();
26473
+ const conversationTrackingConfig = getConversationTrackingConfig();
26355
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
+ });
26356
26483
  const stopHookActive = hookState?.stopHookActive === true;
26357
26484
  const stopHookAttempts = hookState?.stopHookAttempts ?? 0;
26358
26485
  const { messages: processedMessages, wasCompacted } = await checkAutoCompact(messages, toolUseContext);
26359
26486
  if (wasCompacted) {
26360
26487
  messages = processedMessages;
26361
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
+ }
26362
26495
  if (toolUseContext.agentId === "main") {
26363
26496
  const shell = BunShell.getInstance();
26364
26497
  const notifications = shell.flushBashNotifications();
@@ -26425,7 +26558,9 @@ async function* queryCore(messages, systemPrompt, context, canUseTool, toolUseCo
26425
26558
  const { systemPrompt: fullSystemPrompt, reminders } = formatSystemPromptWithContext(
26426
26559
  systemPrompt,
26427
26560
  context,
26428
- toolUseContext.agentId
26561
+ toolUseContext.agentId,
26562
+ false,
26563
+ { conversationTracker: tracker }
26429
26564
  );
26430
26565
  const planModeAdditions = getPlanModeSystemPromptAdditions(
26431
26566
  messages,
@@ -26444,6 +26579,14 @@ async function* queryCore(messages, systemPrompt, context, canUseTool, toolUseCo
26444
26579
  fullSystemPrompt.push(...outputStyleAdditions);
26445
26580
  }
26446
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
+ });
26447
26590
  emitReminderEvent("session:startup", {
26448
26591
  agentId: toolUseContext.agentId,
26449
26592
  messages: messages.length,
@@ -26487,10 +26630,12 @@ async function* queryCore(messages, systemPrompt, context, canUseTool, toolUseCo
26487
26630
  }
26488
26631
  const assistantMessage = result.message;
26489
26632
  const shouldSkipPermissionCheck = result.shouldSkipPermissionCheck;
26633
+ const parentUserMessage = findNaturalUserMessageForParent(messages);
26490
26634
  const toolUseMessages = assistantMessage.message.content.filter(isToolUseLikeBlock);
26491
26635
  if (!toolUseMessages.length) {
26492
26636
  const stopHookEvent = toolUseContext.agentId && toolUseContext.agentId !== "main" ? "SubagentStop" : "Stop";
26493
26637
  const stopReason = assistantMessage.message?.stop_reason || assistantMessage.message?.stopReason || "end_turn";
26638
+ const finish = mapFinishReason(stopReason);
26494
26639
  const stopOutcome = await runStopHooks({
26495
26640
  hookEvent: stopHookEvent,
26496
26641
  reason: String(stopReason ?? ""),
@@ -26530,10 +26675,38 @@ async function* queryCore(messages, systemPrompt, context, canUseTool, toolUseCo
26530
26675
  return;
26531
26676
  }
26532
26677
  }
26533
- 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;
26534
26699
  return;
26535
26700
  }
26536
- 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
+ }
26537
26710
  const siblingToolUseIDs = new Set(toolUseMessages.map((_) => _.id));
26538
26711
  const toolQueue = new ToolUseQueue({
26539
26712
  toolDefinitions: toolUseContext.options.tools,
@@ -27357,6 +27530,20 @@ function REPL({
27357
27530
  []
27358
27531
  );
27359
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}`;
27360
27547
  const { status: apiKeyStatus, reverify } = useApiKeyVerification();
27361
27548
  function onCancel() {
27362
27549
  if (!isLoading) {
@@ -27411,56 +27598,124 @@ function REPL({
27411
27598
  if (!initialPrompt) {
27412
27599
  return;
27413
27600
  }
27601
+ const restoreSessionScope = beginReplSessionScope(conversationKey);
27414
27602
  setIsLoading(true);
27415
27603
  const newAbortController = new AbortController();
27416
27604
  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
- })
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
27436
27629
  },
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);
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;
27447
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]);
27678
+ }
27679
+ } else {
27680
+ addToHistory(initialPrompt);
27448
27681
  }
27449
- 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();
27450
27701
  const lastMessage = newMessages[newMessages.length - 1];
27702
+ if (lastMessage.type === "user" && typeof lastMessage.message.content === "string") {
27703
+ }
27451
27704
  if (lastMessage.type === "assistant") {
27452
- setAbortController(null);
27453
- setIsLoading(false);
27705
+ if (!passedAbortController) {
27706
+ setAbortController(null);
27707
+ }
27454
27708
  return;
27455
27709
  }
27456
- const [systemPrompt, context, model2, maxThinkingTokens] = await Promise.all([
27710
+ const [systemPrompt, context, model, maxThinkingTokens] = await Promise.all([
27457
27711
  getSystemPrompt({ disableSlashCommands }),
27458
27712
  getContext(),
27459
27713
  new ModelManager(getGlobalConfig()).getModelName("main"),
27460
- getMaxThinkingTokens([...messages, ...newMessages])
27714
+ getMaxThinkingTokens([...messages, lastMessage])
27461
27715
  ]);
27716
+ let lastAssistantMessage = null;
27462
27717
  for await (const message of query(
27463
- [...messages, ...newMessages],
27718
+ [...messages, lastMessage],
27464
27719
  systemPrompt,
27465
27720
  context,
27466
27721
  canUseTool,
@@ -27474,99 +27729,40 @@ function REPL({
27474
27729
  verbose,
27475
27730
  safeMode,
27476
27731
  maxThinkingTokens,
27732
+ isPybRequest: isPybRequest || void 0,
27477
27733
  toolPermissionContext: getToolPermissionContextForConversationKey({
27478
- conversationKey: `${messageLogName}:${forkNumber}`,
27734
+ conversationKey,
27479
27735
  isBypassPermissionsModeAvailable: !(safeMode ?? false)
27480
27736
  })
27481
27737
  },
27482
- messageId: getLastAssistantMessageId([...messages, ...newMessages]),
27738
+ messageId: getLastAssistantMessageId([...messages, lastMessage]),
27483
27739
  readFileTimestamps: readFileTimestamps.current,
27484
- abortController: newAbortController,
27485
- setToolJSX
27740
+ abortController: controllerToUse,
27741
+ setToolJSX,
27742
+ conversationTracker: getConversationTrackerForKey(conversationKey)
27486
27743
  },
27487
27744
  getBinaryFeedbackResponse
27488
27745
  )) {
27489
27746
  setMessages2((oldMessages) => [...oldMessages, message]);
27747
+ if (message.type === "assistant") {
27748
+ lastAssistantMessage = message;
27749
+ }
27490
27750
  }
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);
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 });
27563
27760
  }
27564
- } catch (error) {
27565
- logError(error);
27566
- debug.error("REPL_PYB_SAVE_PROJECT_DOCS_ERROR", { error });
27567
27761
  }
27762
+ } finally {
27763
+ setIsLoading(false);
27764
+ restoreSessionScope();
27568
27765
  }
27569
- setIsLoading(false);
27570
27766
  }
27571
27767
  useCostSummary();
27572
27768
  useEffect25(() => {
@@ -27745,7 +27941,6 @@ function REPL({
27745
27941
  [messagesJSX, replStaticPrefixLength]
27746
27942
  );
27747
27943
  const showingCostDialog = !isLoading && showCostDialog;
27748
- const conversationKey = `${messageLogName}:${forkNumber}`;
27749
27944
  return /* @__PURE__ */ React97.createElement(
27750
27945
  PermissionProvider,
27751
27946
  {
@@ -28077,7 +28272,7 @@ import { homedir as homedir8 } from "os";
28077
28272
  // src/commands/agents/generation.ts
28078
28273
  import { randomUUID as randomUUID6 } from "crypto";
28079
28274
  async function generateAgentWithClaude(prompt) {
28080
- const { queryModel } = await import("./llm-A3S75CLF.js");
28275
+ const { queryModel } = await import("./llm-AR66BS2U.js");
28081
28276
  const systemPrompt = `You are an expert at creating AI agent configurations. Based on the user's description, generate a specialized agent configuration.
28082
28277
 
28083
28278
  Return your response as a JSON object with exactly these fields:
@@ -31800,7 +31995,7 @@ NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTAN
31800
31995
  ` : ""}
31801
31996
 
31802
31997
  # 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.
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.
31804
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.
31805
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.
31806
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.