pybao-cli 1.5.14 → 1.5.16

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 (154) hide show
  1. package/dist/REPL-SLKFFXW3.js +50 -0
  2. package/dist/{acp-AT5V4HJH.js → acp-OQU3Q74X.js} +31 -31
  3. package/dist/{agentsValidate-RAMCNNGN.js → agentsValidate-SZEKAI7D.js} +7 -7
  4. package/dist/{ask-MSHFKMOM.js → ask-4GYZIFBI.js} +30 -30
  5. package/dist/{autoUpdater-SKKUYQGP.js → autoUpdater-TNJ5EHPF.js} +3 -3
  6. package/dist/{chunk-P6GUR3BQ.js → chunk-2IP3S5YY.js} +2 -2
  7. package/dist/{chunk-W2IIXSKF.js → chunk-2JDFT27Z.js} +4 -4
  8. package/dist/{chunk-LFCRI4XF.js → chunk-2UIC6KUN.js} +2 -2
  9. package/dist/{chunk-633CKZ4H.js → chunk-5NEN4RZF.js} +2 -2
  10. package/dist/{chunk-XFCLMIVU.js → chunk-6UUMMCEA.js} +1 -1
  11. package/dist/{chunk-2UWY74V2.js → chunk-74PPXIKF.js} +1 -1
  12. package/dist/{chunk-PD3UXMJI.js → chunk-7TRQANX3.js} +2 -2
  13. package/dist/{chunk-6GFXJLN3.js → chunk-7UPV7QTD.js} +4 -4
  14. package/dist/{chunk-GP4PJUZ5.js → chunk-DXLMPRXX.js} +1 -1
  15. package/dist/{chunk-G4URT4VU.js → chunk-EGFEUHPK.js} +1 -1
  16. package/dist/{chunk-WGK3XBGW.js → chunk-GDUBW6S3.js} +1 -1
  17. package/dist/{chunk-7RAZGTUT.js → chunk-GF2MQGGQ.js} +1 -1
  18. package/dist/{chunk-CCGXQSUZ.js → chunk-GZBASJQM.js} +3 -3
  19. package/dist/{chunk-BLPZN5F3.js → chunk-IW5UFMRQ.js} +1 -1
  20. package/dist/{chunk-GWIJUNRO.js → chunk-LE4MSECX.js} +293 -187
  21. package/dist/{chunk-GWIJUNRO.js.map → chunk-LE4MSECX.js.map} +4 -4
  22. package/dist/{chunk-RAWU5JAN.js → chunk-MMTMYYK4.js} +1 -1
  23. package/dist/{chunk-KROM73XA.js → chunk-MZBUBAHS.js} +15 -15
  24. package/dist/{chunk-G2NQTS2X.js → chunk-OQUAEZWY.js} +2 -2
  25. package/dist/{chunk-3O5DLN4S.js → chunk-OTEQDHXR.js} +3 -3
  26. package/dist/{chunk-RAT3UGPD.js → chunk-PJ6F6UEG.js} +3 -3
  27. package/dist/{chunk-WSYTRNNY.js → chunk-RA55NOAX.js} +3 -3
  28. package/dist/{chunk-HWG2BWLL.js → chunk-SQDHH3JF.js} +3 -3
  29. package/dist/{chunk-EL45JJXX.js → chunk-T2TMNQ7H.js} +3 -3
  30. package/dist/{chunk-RE4W2ZJB.js → chunk-TKUXXEIH.js} +1 -1
  31. package/dist/{chunk-JWJC3DE2.js → chunk-TOLIZZNG.js} +1 -1
  32. package/dist/{chunk-3I7K6SG5.js → chunk-VLAJHHDH.js} +4 -4
  33. package/dist/{chunk-DPM2NLYC.js → chunk-WCNJUZPB.js} +4 -4
  34. package/dist/{chunk-656DI2PZ.js → chunk-XC7HSASO.js} +3 -3
  35. package/dist/{chunk-DY2JCWQE.js → chunk-ZGQA3IBT.js} +1 -1
  36. package/dist/{chunk-EOZR4EWJ.js → chunk-ZHCJRYGZ.js} +2 -2
  37. package/dist/{chunk-YDZG5W4V.js → chunk-ZVKBWRCR.js} +1 -1
  38. package/dist/{chunk-YDZG5W4V.js.map → chunk-ZVKBWRCR.js.map} +1 -1
  39. package/dist/{chunk-5GJVTQ6Z.js → chunk-ZVVBLU3R.js} +1 -1
  40. package/dist/{cli-BOWVY6R3.js → cli-BQVVZA5X.js} +91 -91
  41. package/dist/commands-BW7WPWPW.js +54 -0
  42. package/dist/{config-I2D37MAO.js → config-RPIQCWHL.js} +4 -4
  43. package/dist/{context-VABSOXYH.js → context-LWB5JWQA.js} +6 -6
  44. package/dist/{conversationPersistence-5VZYNRKZ.js → conversationPersistence-KR3CK6SF.js} +3 -3
  45. package/dist/{conversationTracker-GLBFPNV5.js → conversationTracker-YXHNBYW3.js} +4 -4
  46. package/dist/{customCommands-XDBZLSTQ.js → customCommands-6TIJA6HB.js} +4 -4
  47. package/dist/{env-LQC4XU2Q.js → env-7RX7XQ4A.js} +2 -2
  48. package/dist/{file-GG4AHH6L.js → file-LJN7Y7PR.js} +4 -4
  49. package/dist/index.js +3 -3
  50. package/dist/{llm-BPQNYHE3.js → llm-NAYVED3B.js} +31 -31
  51. package/dist/{llmLazy-ERIDXKJP.js → llmLazy-ORKIQCY5.js} +1 -1
  52. package/dist/{loader-4PJMU2RQ.js → loader-A76GID3X.js} +4 -4
  53. package/dist/{lsp-TTHCC6GK.js → lsp-XEKIOPMN.js} +6 -6
  54. package/dist/{lspAnchor-GVGHDYX4.js → lspAnchor-AAJRSC4H.js} +6 -6
  55. package/dist/{mcp-7UXI2HGT.js → mcp-FLNPZDDY.js} +7 -7
  56. package/dist/{mentionProcessor-MJMQGTMD.js → mentionProcessor-I5GL7S3X.js} +5 -5
  57. package/dist/{messages-BGURJH5A.js → messages-4MKBBVXD.js} +1 -1
  58. package/dist/{model-73TIVV4A.js → model-TIZ3I4PF.js} +5 -5
  59. package/dist/{openai-AKBW3O3B.js → openai-FQAJSMPU.js} +5 -5
  60. package/dist/{outputStyles-3OQCURTS.js → outputStyles-UGN4PZ2U.js} +4 -4
  61. package/dist/{pluginRuntime-QWYITTNV.js → pluginRuntime-VS4AI72Y.js} +6 -6
  62. package/dist/{pluginValidation-6KF6BNI3.js → pluginValidation-UXM6NUGH.js} +6 -6
  63. package/dist/prompts-7JAIWFA4.js +56 -0
  64. package/dist/{pybAgentSessionLoad-O6E64X5A.js → pybAgentSessionLoad-HN7QZC2J.js} +4 -4
  65. package/dist/{pybAgentSessionResume-AQOFIWCM.js → pybAgentSessionResume-JI2EBGGX.js} +4 -4
  66. package/dist/{pybAgentStreamJsonSession-IFBVOQOE.js → pybAgentStreamJsonSession-GGI6HS7W.js} +1 -1
  67. package/dist/{pybHooks-WDSZDXUD.js → pybHooks-YLJLAANL.js} +4 -4
  68. package/dist/query-HS7RAFSK.js +56 -0
  69. package/dist/{registry-MPFGTVV6.js → registry-JZNE7NQ7.js} +5 -5
  70. package/dist/{ripgrep-JAKZKDZN.js → ripgrep-JEZOY3ZY.js} +3 -3
  71. package/dist/{skillMarketplace-OGHKQY7N.js → skillMarketplace-67VL2DPG.js} +3 -3
  72. package/dist/{state-KCGPU2FP.js → state-WMWNA6WF.js} +2 -2
  73. package/dist/{theme-LMMG2NKE.js → theme-X7OI4VAS.js} +5 -5
  74. package/dist/{toolPermissionSettings-HVQSSP7C.js → toolPermissionSettings-XWDLCBZA.js} +6 -6
  75. package/dist/tools-XHB7WGLV.js +55 -0
  76. package/dist/{userInput-WGDHQIMP.js → userInput-3TEL6EW5.js} +32 -32
  77. package/package.json +1 -1
  78. package/scripts/session-behavior-invariant-gate.mjs +7 -0
  79. package/dist/REPL-BZ3IK37X.js +0 -50
  80. package/dist/commands-5TSQH2YJ.js +0 -54
  81. package/dist/prompts-MOJ3I4T4.js +0 -56
  82. package/dist/query-OC3TMXBW.js +0 -56
  83. package/dist/tools-NE4ZQ7RG.js +0 -55
  84. /package/dist/{REPL-BZ3IK37X.js.map → REPL-SLKFFXW3.js.map} +0 -0
  85. /package/dist/{acp-AT5V4HJH.js.map → acp-OQU3Q74X.js.map} +0 -0
  86. /package/dist/{agentsValidate-RAMCNNGN.js.map → agentsValidate-SZEKAI7D.js.map} +0 -0
  87. /package/dist/{ask-MSHFKMOM.js.map → ask-4GYZIFBI.js.map} +0 -0
  88. /package/dist/{autoUpdater-SKKUYQGP.js.map → autoUpdater-TNJ5EHPF.js.map} +0 -0
  89. /package/dist/{chunk-P6GUR3BQ.js.map → chunk-2IP3S5YY.js.map} +0 -0
  90. /package/dist/{chunk-W2IIXSKF.js.map → chunk-2JDFT27Z.js.map} +0 -0
  91. /package/dist/{chunk-LFCRI4XF.js.map → chunk-2UIC6KUN.js.map} +0 -0
  92. /package/dist/{chunk-633CKZ4H.js.map → chunk-5NEN4RZF.js.map} +0 -0
  93. /package/dist/{chunk-XFCLMIVU.js.map → chunk-6UUMMCEA.js.map} +0 -0
  94. /package/dist/{chunk-2UWY74V2.js.map → chunk-74PPXIKF.js.map} +0 -0
  95. /package/dist/{chunk-PD3UXMJI.js.map → chunk-7TRQANX3.js.map} +0 -0
  96. /package/dist/{chunk-6GFXJLN3.js.map → chunk-7UPV7QTD.js.map} +0 -0
  97. /package/dist/{chunk-GP4PJUZ5.js.map → chunk-DXLMPRXX.js.map} +0 -0
  98. /package/dist/{chunk-G4URT4VU.js.map → chunk-EGFEUHPK.js.map} +0 -0
  99. /package/dist/{chunk-WGK3XBGW.js.map → chunk-GDUBW6S3.js.map} +0 -0
  100. /package/dist/{chunk-7RAZGTUT.js.map → chunk-GF2MQGGQ.js.map} +0 -0
  101. /package/dist/{chunk-CCGXQSUZ.js.map → chunk-GZBASJQM.js.map} +0 -0
  102. /package/dist/{chunk-BLPZN5F3.js.map → chunk-IW5UFMRQ.js.map} +0 -0
  103. /package/dist/{chunk-RAWU5JAN.js.map → chunk-MMTMYYK4.js.map} +0 -0
  104. /package/dist/{chunk-KROM73XA.js.map → chunk-MZBUBAHS.js.map} +0 -0
  105. /package/dist/{chunk-G2NQTS2X.js.map → chunk-OQUAEZWY.js.map} +0 -0
  106. /package/dist/{chunk-3O5DLN4S.js.map → chunk-OTEQDHXR.js.map} +0 -0
  107. /package/dist/{chunk-RAT3UGPD.js.map → chunk-PJ6F6UEG.js.map} +0 -0
  108. /package/dist/{chunk-WSYTRNNY.js.map → chunk-RA55NOAX.js.map} +0 -0
  109. /package/dist/{chunk-HWG2BWLL.js.map → chunk-SQDHH3JF.js.map} +0 -0
  110. /package/dist/{chunk-EL45JJXX.js.map → chunk-T2TMNQ7H.js.map} +0 -0
  111. /package/dist/{chunk-RE4W2ZJB.js.map → chunk-TKUXXEIH.js.map} +0 -0
  112. /package/dist/{chunk-JWJC3DE2.js.map → chunk-TOLIZZNG.js.map} +0 -0
  113. /package/dist/{chunk-3I7K6SG5.js.map → chunk-VLAJHHDH.js.map} +0 -0
  114. /package/dist/{chunk-DPM2NLYC.js.map → chunk-WCNJUZPB.js.map} +0 -0
  115. /package/dist/{chunk-656DI2PZ.js.map → chunk-XC7HSASO.js.map} +0 -0
  116. /package/dist/{chunk-DY2JCWQE.js.map → chunk-ZGQA3IBT.js.map} +0 -0
  117. /package/dist/{chunk-EOZR4EWJ.js.map → chunk-ZHCJRYGZ.js.map} +0 -0
  118. /package/dist/{chunk-5GJVTQ6Z.js.map → chunk-ZVVBLU3R.js.map} +0 -0
  119. /package/dist/{cli-BOWVY6R3.js.map → cli-BQVVZA5X.js.map} +0 -0
  120. /package/dist/{commands-5TSQH2YJ.js.map → commands-BW7WPWPW.js.map} +0 -0
  121. /package/dist/{config-I2D37MAO.js.map → config-RPIQCWHL.js.map} +0 -0
  122. /package/dist/{context-VABSOXYH.js.map → context-LWB5JWQA.js.map} +0 -0
  123. /package/dist/{conversationPersistence-5VZYNRKZ.js.map → conversationPersistence-KR3CK6SF.js.map} +0 -0
  124. /package/dist/{conversationTracker-GLBFPNV5.js.map → conversationTracker-YXHNBYW3.js.map} +0 -0
  125. /package/dist/{customCommands-XDBZLSTQ.js.map → customCommands-6TIJA6HB.js.map} +0 -0
  126. /package/dist/{env-LQC4XU2Q.js.map → env-7RX7XQ4A.js.map} +0 -0
  127. /package/dist/{file-GG4AHH6L.js.map → file-LJN7Y7PR.js.map} +0 -0
  128. /package/dist/{llm-BPQNYHE3.js.map → llm-NAYVED3B.js.map} +0 -0
  129. /package/dist/{llmLazy-ERIDXKJP.js.map → llmLazy-ORKIQCY5.js.map} +0 -0
  130. /package/dist/{loader-4PJMU2RQ.js.map → loader-A76GID3X.js.map} +0 -0
  131. /package/dist/{lsp-TTHCC6GK.js.map → lsp-XEKIOPMN.js.map} +0 -0
  132. /package/dist/{lspAnchor-GVGHDYX4.js.map → lspAnchor-AAJRSC4H.js.map} +0 -0
  133. /package/dist/{mcp-7UXI2HGT.js.map → mcp-FLNPZDDY.js.map} +0 -0
  134. /package/dist/{mentionProcessor-MJMQGTMD.js.map → mentionProcessor-I5GL7S3X.js.map} +0 -0
  135. /package/dist/{messages-BGURJH5A.js.map → messages-4MKBBVXD.js.map} +0 -0
  136. /package/dist/{model-73TIVV4A.js.map → model-TIZ3I4PF.js.map} +0 -0
  137. /package/dist/{openai-AKBW3O3B.js.map → openai-FQAJSMPU.js.map} +0 -0
  138. /package/dist/{outputStyles-3OQCURTS.js.map → outputStyles-UGN4PZ2U.js.map} +0 -0
  139. /package/dist/{pluginRuntime-QWYITTNV.js.map → pluginRuntime-VS4AI72Y.js.map} +0 -0
  140. /package/dist/{pluginValidation-6KF6BNI3.js.map → pluginValidation-UXM6NUGH.js.map} +0 -0
  141. /package/dist/{prompts-MOJ3I4T4.js.map → prompts-7JAIWFA4.js.map} +0 -0
  142. /package/dist/{pybAgentSessionLoad-O6E64X5A.js.map → pybAgentSessionLoad-HN7QZC2J.js.map} +0 -0
  143. /package/dist/{pybAgentSessionResume-AQOFIWCM.js.map → pybAgentSessionResume-JI2EBGGX.js.map} +0 -0
  144. /package/dist/{pybAgentStreamJsonSession-IFBVOQOE.js.map → pybAgentStreamJsonSession-GGI6HS7W.js.map} +0 -0
  145. /package/dist/{pybHooks-WDSZDXUD.js.map → pybHooks-YLJLAANL.js.map} +0 -0
  146. /package/dist/{query-OC3TMXBW.js.map → query-HS7RAFSK.js.map} +0 -0
  147. /package/dist/{registry-MPFGTVV6.js.map → registry-JZNE7NQ7.js.map} +0 -0
  148. /package/dist/{ripgrep-JAKZKDZN.js.map → ripgrep-JEZOY3ZY.js.map} +0 -0
  149. /package/dist/{skillMarketplace-OGHKQY7N.js.map → skillMarketplace-67VL2DPG.js.map} +0 -0
  150. /package/dist/{state-KCGPU2FP.js.map → state-WMWNA6WF.js.map} +0 -0
  151. /package/dist/{theme-LMMG2NKE.js.map → theme-X7OI4VAS.js.map} +0 -0
  152. /package/dist/{toolPermissionSettings-HVQSSP7C.js.map → toolPermissionSettings-XWDLCBZA.js.map} +0 -0
  153. /package/dist/{tools-NE4ZQ7RG.js.map → tools-XHB7WGLV.js.map} +0 -0
  154. /package/dist/{userInput-WGDHQIMP.js.map → userInput-3TEL6EW5.js.map} +0 -0
@@ -2,18 +2,18 @@ import { createRequire as __pybCreateRequire } from "node:module";
2
2
  const require = __pybCreateRequire(import.meta.url);
3
3
  import {
4
4
  loadPybAgentSessionMessages
5
- } from "./chunk-DY2JCWQE.js";
5
+ } from "./chunk-ZGQA3IBT.js";
6
6
  import {
7
7
  listPybAgentSessions
8
- } from "./chunk-5GJVTQ6Z.js";
8
+ } from "./chunk-ZVVBLU3R.js";
9
9
  import {
10
10
  appendSessionCustomTitleRecord,
11
11
  appendSessionTagRecord
12
- } from "./chunk-GP4PJUZ5.js";
12
+ } from "./chunk-DXLMPRXX.js";
13
13
  import {
14
14
  formatValidationResult,
15
15
  validatePluginOrMarketplacePath
16
- } from "./chunk-CCGXQSUZ.js";
16
+ } from "./chunk-GZBASJQM.js";
17
17
  import {
18
18
  ConversationTracker,
19
19
  appendFinishState,
@@ -21,10 +21,10 @@ import {
21
21
  getConversationTrackerForContext,
22
22
  isFinishComplete,
23
23
  mapFinishReason
24
- } from "./chunk-2UWY74V2.js";
24
+ } from "./chunk-74PPXIKF.js";
25
25
  import {
26
26
  FileSystemConversationPersistence
27
- } from "./chunk-RAWU5JAN.js";
27
+ } from "./chunk-MMTMYYK4.js";
28
28
  import {
29
29
  beginReplSessionScope
30
30
  } from "./chunk-F4AXICO7.js";
@@ -39,7 +39,7 @@ import {
39
39
  runStopHooks,
40
40
  runUserPromptSubmitHooks,
41
41
  updateHookTranscriptForMessages
42
- } from "./chunk-3O5DLN4S.js";
42
+ } from "./chunk-OTEQDHXR.js";
43
43
  import {
44
44
  DEFAULT_OUTPUT_STYLE,
45
45
  getAvailableOutputStyles,
@@ -48,11 +48,11 @@ import {
48
48
  getOutputStyleSystemPromptAdditions,
49
49
  resolveOutputStyleName,
50
50
  setCurrentOutputStyle
51
- } from "./chunk-EOZR4EWJ.js";
51
+ } from "./chunk-ZHCJRYGZ.js";
52
52
  import {
53
53
  fetchCustomModels,
54
54
  getModelFeatures
55
- } from "./chunk-LFCRI4XF.js";
55
+ } from "./chunk-2UIC6KUN.js";
56
56
  import {
57
57
  getSessionState
58
58
  } from "./chunk-XKYHFZEC.js";
@@ -60,7 +60,7 @@ import {
60
60
  queryLLM,
61
61
  queryQuick,
62
62
  verifyApiKey
63
- } from "./chunk-DPM2NLYC.js";
63
+ } from "./chunk-WCNJUZPB.js";
64
64
  import {
65
65
  DEFAULT_TIMEOUT_MS,
66
66
  FallbackToolUseRejectedMessage,
@@ -74,7 +74,7 @@ import {
74
74
  listMCPServers,
75
75
  loadMergedSettings,
76
76
  normalizeSandboxRuntimeConfigFromSettings
77
- } from "./chunk-W2IIXSKF.js";
77
+ } from "./chunk-2JDFT27Z.js";
78
78
  import {
79
79
  addMarketplace,
80
80
  disableSkillPlugin,
@@ -87,11 +87,11 @@ import {
87
87
  refreshMarketplaceAsync,
88
88
  removeMarketplace,
89
89
  uninstallSkillPlugin
90
- } from "./chunk-WGK3XBGW.js";
90
+ } from "./chunk-GDUBW6S3.js";
91
91
  import {
92
92
  loadToolPermissionContextFromDisk,
93
93
  persistToolPermissionUpdateToDisk
94
- } from "./chunk-656DI2PZ.js";
94
+ } from "./chunk-XC7HSASO.js";
95
95
  import {
96
96
  applyToolPermissionContextUpdate,
97
97
  applyToolPermissionContextUpdates,
@@ -102,13 +102,13 @@ import {
102
102
  generateSystemReminders,
103
103
  resetReminderSession,
104
104
  systemReminderService
105
- } from "./chunk-P6GUR3BQ.js";
105
+ } from "./chunk-2IP3S5YY.js";
106
106
  import {
107
107
  clearAgentCache,
108
108
  getActiveAgents,
109
109
  getAgentByType,
110
110
  getAllAgents
111
- } from "./chunk-G2NQTS2X.js";
111
+ } from "./chunk-OQUAEZWY.js";
112
112
  import {
113
113
  API_ERROR_MESSAGE_PREFIX,
114
114
  CANCEL_MESSAGE,
@@ -145,7 +145,7 @@ import {
145
145
  reorderMessages,
146
146
  resetAutoCompactTelemetry,
147
147
  stripSystemMessages
148
- } from "./chunk-G4URT4VU.js";
148
+ } from "./chunk-EGFEUHPK.js";
149
149
  import {
150
150
  getRequestStatus,
151
151
  setRequestStatus,
@@ -175,7 +175,7 @@ import {
175
175
  normalizeFilePath,
176
176
  readTextContent,
177
177
  writeTextContent
178
- } from "./chunk-PD3UXMJI.js";
178
+ } from "./chunk-7TRQANX3.js";
179
179
  import {
180
180
  parseBlockEdits
181
181
  } from "./chunk-QWIBSCDN.js";
@@ -185,18 +185,18 @@ import {
185
185
  ParserRegistry,
186
186
  initParser,
187
187
  loadLanguage
188
- } from "./chunk-6GFXJLN3.js";
188
+ } from "./chunk-7UPV7QTD.js";
189
189
  import {
190
190
  getSettingsFileCandidates,
191
191
  loadSettingsWithLegacyFallback,
192
192
  readSettingsFile
193
- } from "./chunk-JWJC3DE2.js";
193
+ } from "./chunk-TOLIZZNG.js";
194
194
  import {
195
195
  getCustomCommandDirectories,
196
196
  hasCustomCommands,
197
197
  loadCustomCommands,
198
198
  reloadCustomCommands
199
- } from "./chunk-633CKZ4H.js";
199
+ } from "./chunk-5NEN4RZF.js";
200
200
  import {
201
201
  getSessionPlugins
202
202
  } from "./chunk-BJSWTHRM.js";
@@ -205,7 +205,7 @@ import {
205
205
  buildModelProfileKey,
206
206
  getModelManager,
207
207
  isDefaultSlowAndCapableModel
208
- } from "./chunk-RAT3UGPD.js";
208
+ } from "./chunk-PJ6F6UEG.js";
209
209
  import {
210
210
  getCodeStyle,
211
211
  getContext,
@@ -213,16 +213,16 @@ import {
213
213
  getIsGit,
214
214
  getProjectDocs,
215
215
  getProjectStructureStatisticsBlock
216
- } from "./chunk-3I7K6SG5.js";
216
+ } from "./chunk-VLAJHHDH.js";
217
217
  import {
218
218
  getRipgrepPath,
219
219
  getRipgrepPolicyMode,
220
220
  resolveRipgrepPolicy,
221
221
  ripGrep
222
- } from "./chunk-XFCLMIVU.js";
222
+ } from "./chunk-6UUMMCEA.js";
223
223
  import {
224
224
  getTheme
225
- } from "./chunk-BLPZN5F3.js";
225
+ } from "./chunk-IW5UFMRQ.js";
226
226
  import {
227
227
  DEFAULT_GLOBAL_CONFIG,
228
228
  enableConfigs,
@@ -235,7 +235,7 @@ import {
235
235
  saveGlobalConfig,
236
236
  setAllPointersToModel,
237
237
  setModelPointer
238
- } from "./chunk-EL45JJXX.js";
238
+ } from "./chunk-T2TMNQ7H.js";
239
239
  import {
240
240
  AbortError
241
241
  } from "./chunk-RQVLBMP7.js";
@@ -244,7 +244,7 @@ import {
244
244
  getCurrentRequest,
245
245
  logUserFriendly,
246
246
  markPhase
247
- } from "./chunk-7RAZGTUT.js";
247
+ } from "./chunk-GF2MQGGQ.js";
248
248
  import {
249
249
  ASCII_LOGO,
250
250
  BunShell,
@@ -285,10 +285,10 @@ import {
285
285
  setCwd,
286
286
  shouldApplyToolOutputTruncation,
287
287
  truncateToolOutput
288
- } from "./chunk-RE4W2ZJB.js";
288
+ } from "./chunk-TKUXXEIH.js";
289
289
  import {
290
290
  MACRO
291
- } from "./chunk-YDZG5W4V.js";
291
+ } from "./chunk-ZVKBWRCR.js";
292
292
  import {
293
293
  __export
294
294
  } from "./chunk-I3J4JYES.js";
@@ -469,7 +469,7 @@ var getCommandSubcommandPrefix = memoize(
469
469
  var getCommandPrefix = memoize(
470
470
  async (command4, abortSignal) => {
471
471
  const { systemPrompt, userPrompt } = buildBashCommandPrefixDetectionPrompt(command4);
472
- const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryQuick: queryQuick2 } = await import("./llm-BPQNYHE3.js");
472
+ const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryQuick: queryQuick2 } = await import("./llm-NAYVED3B.js");
473
473
  const response = await queryQuick2({
474
474
  systemPrompt,
475
475
  userPrompt,
@@ -4271,7 +4271,7 @@ function formatParseError(error) {
4271
4271
  return error instanceof Error ? error.message : String(error);
4272
4272
  }
4273
4273
  async function defaultGateQuery(args) {
4274
- const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryLLM: queryLLM2 } = await import("./llm-BPQNYHE3.js");
4274
+ const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryLLM: queryLLM2 } = await import("./llm-NAYVED3B.js");
4275
4275
  const queryLLMFn = args.queryLLMOverride ?? queryLLM2;
4276
4276
  const messages = [
4277
4277
  {
@@ -6664,7 +6664,7 @@ var FileEditTool = {
6664
6664
  const originalFileContent = currentFileContent;
6665
6665
  let totalPatch = [];
6666
6666
  const { SmartEdit } = await import("./smart-edit-AWHJDSU6.js");
6667
- const { findLspAnchor } = await import("./lspAnchor-GVGHDYX4.js");
6667
+ const { findLspAnchor } = await import("./lspAnchor-AAJRSC4H.js");
6668
6668
  for (const op of editOperations) {
6669
6669
  const normalizedSearch = normalizeLineEndings(op.search);
6670
6670
  const normalizedReplace = normalizeLineEndings(op.replace);
@@ -12149,7 +12149,7 @@ async function createAndStoreApiKey(accessToken) {
12149
12149
  }
12150
12150
  saveGlobalConfig(config2);
12151
12151
  try {
12152
- const { resetAnthropicClient } = await import("./llm-BPQNYHE3.js");
12152
+ const { resetAnthropicClient } = await import("./llm-NAYVED3B.js");
12153
12153
  resetAnthropicClient();
12154
12154
  } catch {
12155
12155
  }
@@ -16573,7 +16573,7 @@ async function refreshPluginRuntimeFromInstalls() {
16573
16573
  const existingRoots = getSessionPlugins().map((p) => p.rootDir);
16574
16574
  const dirs = Array.from(/* @__PURE__ */ new Set([...existingRoots, ...installedRoots]));
16575
16575
  if (dirs.length === 0) return [];
16576
- const { configureSessionPlugins } = await import("./pluginRuntime-QWYITTNV.js");
16576
+ const { configureSessionPlugins } = await import("./pluginRuntime-VS4AI72Y.js");
16577
16577
  const { errors } = await configureSessionPlugins({ pluginDirs: dirs });
16578
16578
  return errors;
16579
16579
  }
@@ -17248,7 +17248,7 @@ async function call(onDone, context) {
17248
17248
  ModelConfig,
17249
17249
  {
17250
17250
  onClose: () => {
17251
- import("./model-73TIVV4A.js").then(({ reloadModelManager: reloadModelManager2 }) => {
17251
+ import("./model-TIZ3I4PF.js").then(({ reloadModelManager: reloadModelManager2 }) => {
17252
17252
  reloadModelManager2();
17253
17253
  triggerModelConfigChange();
17254
17254
  onDone();
@@ -25557,7 +25557,7 @@ function useStatusLine() {
25557
25557
  // src/ui/components/PromptInput.tsx
25558
25558
  async function interpretHashCommand(input) {
25559
25559
  try {
25560
- const { queryQuick: queryQuick2 } = await import("./llm-BPQNYHE3.js");
25560
+ const { queryQuick: queryQuick2 } = await import("./llm-NAYVED3B.js");
25561
25561
  const systemPrompt = [
25562
25562
  "You're helping the user structure notes that will be added to their PYB.md file.",
25563
25563
  "Format the user's input into a well-structured note that will be useful for later reference.",
@@ -25870,7 +25870,7 @@ function PromptInput({
25870
25870
  if (messages2.length) {
25871
25871
  if (mode === "bash") {
25872
25872
  onQuery(messages2, newAbortController).then(async () => {
25873
- const { getCwd: getCwd2 } = await import("./state-KCGPU2FP.js");
25873
+ const { getCwd: getCwd2 } = await import("./state-WMWNA6WF.js");
25874
25874
  setCurrentPwd(getCwd2());
25875
25875
  });
25876
25876
  } else {
@@ -30872,6 +30872,84 @@ function resolveSessionEngineReplaySample(replaySeed) {
30872
30872
  return hash % 100;
30873
30873
  }
30874
30874
 
30875
+ // src/app/queryRuntime/lifecycle.ts
30876
+ var TOOL_PROGRESS_OPEN_TAG = ["<tool", "-progress>"].join("");
30877
+ var TOOL_PROGRESS_CLOSE_TAG = ["</tool", "-progress>"].join("");
30878
+ function isTextBlock(block) {
30879
+ return Boolean(
30880
+ block && typeof block === "object" && block.type === "text"
30881
+ );
30882
+ }
30883
+ function isToolResultBlock(block) {
30884
+ return Boolean(
30885
+ block && typeof block === "object" && block.type === "tool_result"
30886
+ );
30887
+ }
30888
+ function inferIsNewSessionForAutoCompact(messages) {
30889
+ const naturalMessages = messages.filter(
30890
+ (message) => message?.type === "user" || message?.type === "assistant"
30891
+ );
30892
+ const hasCompactionMarker = naturalMessages.some(
30893
+ (message) => message?.compaction?.type === "compaction"
30894
+ );
30895
+ return !hasCompactionMarker && naturalMessages.length <= 2;
30896
+ }
30897
+ function extractUserPromptTextFromMessages(messages) {
30898
+ const last2 = messages[messages.length - 1];
30899
+ if (!last2 || typeof last2 !== "object" || last2.type !== "user") {
30900
+ return null;
30901
+ }
30902
+ const content = last2.message?.content;
30903
+ if (typeof content === "string") {
30904
+ return content;
30905
+ }
30906
+ if (!Array.isArray(content)) {
30907
+ return null;
30908
+ }
30909
+ const hasToolResult = content.some((block) => isToolResultBlock(block));
30910
+ if (hasToolResult) {
30911
+ return null;
30912
+ }
30913
+ return content.filter(isTextBlock).map((block) => String(block.text ?? "")).join("");
30914
+ }
30915
+ function resolveLifecycleTokensFromUsage(usage) {
30916
+ if (!usage || typeof usage !== "object") {
30917
+ return void 0;
30918
+ }
30919
+ const usageLike = usage;
30920
+ const input = Number.isFinite(Number(usageLike.input_tokens)) ? Number(usageLike.input_tokens) : void 0;
30921
+ const output = Number.isFinite(Number(usageLike.output_tokens)) ? Number(usageLike.output_tokens) : void 0;
30922
+ if (input === void 0 && output === void 0) {
30923
+ return void 0;
30924
+ }
30925
+ return {
30926
+ ...input === void 0 ? {} : { input },
30927
+ ...output === void 0 ? {} : { output },
30928
+ total: (input ?? 0) + (output ?? 0)
30929
+ };
30930
+ }
30931
+ function resolveLifecycleTokensFromAssistantMessage(assistantMessage) {
30932
+ if (!assistantMessage || typeof assistantMessage !== "object") {
30933
+ return void 0;
30934
+ }
30935
+ const message = assistantMessage.message;
30936
+ if (!message || typeof message !== "object") {
30937
+ return void 0;
30938
+ }
30939
+ return resolveLifecycleTokensFromUsage(
30940
+ message.usage
30941
+ );
30942
+ }
30943
+ function resolveStopHookSignal(args) {
30944
+ const hookEvent = args.agentId && args.agentId !== "main" ? "SubagentStop" : "Stop";
30945
+ const rawStopReason = args.assistantMessage && typeof args.assistantMessage === "object" && args.assistantMessage.message ? args.assistantMessage.message?.stop_reason ?? args.assistantMessage.message?.stopReason : void 0;
30946
+ const stopReason = rawStopReason ?? "end_turn";
30947
+ return {
30948
+ hookEvent,
30949
+ stopReason: String(stopReason ?? "")
30950
+ };
30951
+ }
30952
+
30875
30953
  // src/app/queryRuntime/toolInput.ts
30876
30954
  function normalizeToolInput(tool, input) {
30877
30955
  switch (tool) {
@@ -30913,39 +30991,124 @@ function preprocessToolInput(tool, input) {
30913
30991
  return input;
30914
30992
  }
30915
30993
 
30916
- // src/app/queryRuntime/lifecycle.ts
30917
- var TOOL_PROGRESS_OPEN_TAG = ["<tool", "-progress>"].join("");
30918
- var TOOL_PROGRESS_CLOSE_TAG = ["</tool", "-progress>"].join("");
30919
- function inferIsNewSessionForAutoCompact(messages) {
30920
- const naturalMessages = messages.filter(
30921
- (message) => message?.type === "user" || message?.type === "assistant"
30994
+ // src/app/queryRuntime/stopHooks.ts
30995
+ async function runStopHookAttempt(args) {
30996
+ const stopOutcome = await runStopHooks({
30997
+ hookEvent: args.hookEvent,
30998
+ reason: args.stopReason,
30999
+ retryEntryKey: buildRetryEntryKey([
31000
+ args.context.sessionId,
31001
+ args.context.parentSessionId,
31002
+ args.context.childSessionId,
31003
+ args.context.agentId,
31004
+ args.stopReason
31005
+ ]),
31006
+ retryAttempt: args.stopHookAttempts,
31007
+ sessionId: args.context.sessionId,
31008
+ parentSessionId: args.context.parentSessionId,
31009
+ childSessionId: args.context.childSessionId,
31010
+ agentId: args.context.agentId,
31011
+ permissionMode: args.context.options?.toolPermissionContext?.mode,
31012
+ cwd: getCwd(),
31013
+ transcriptPath: getHookTranscriptPath(args.context),
31014
+ safeMode: args.context.options?.safeMode ?? false,
31015
+ stopHookActive: args.stopHookActive,
31016
+ signal: args.context.abortController.signal
31017
+ });
31018
+ if (stopOutcome.systemMessages.length > 0) {
31019
+ queueHookSystemMessages(args.context, stopOutcome.systemMessages);
31020
+ }
31021
+ if (stopOutcome.additionalContexts.length > 0) {
31022
+ queueHookAdditionalContexts(args.context, stopOutcome.additionalContexts);
31023
+ }
31024
+ if (stopOutcome.decision !== "block") {
31025
+ return {
31026
+ shouldRetry: false,
31027
+ nextStopHookAttempts: args.stopHookAttempts
31028
+ };
31029
+ }
31030
+ queueHookSystemMessages(args.context, [stopOutcome.message]);
31031
+ const maxStopHookAttempts = args.maxStopHookAttempts ?? 5;
31032
+ if (args.stopHookAttempts < maxStopHookAttempts) {
31033
+ return {
31034
+ shouldRetry: true,
31035
+ nextStopHookAttempts: args.stopHookAttempts + 1
31036
+ };
31037
+ }
31038
+ return {
31039
+ shouldRetry: false,
31040
+ nextStopHookAttempts: args.stopHookAttempts
31041
+ };
31042
+ }
31043
+
31044
+ // src/app/queryRuntime/assistantOutput.ts
31045
+ function buildAssistantMessageForParent(args) {
31046
+ if (!args.parentMessageUuid) {
31047
+ return args.assistantMessage;
31048
+ }
31049
+ return appendFinishState(args.assistantMessage, {
31050
+ finish: args.finish,
31051
+ parentID: args.parentMessageUuid,
31052
+ ...args.markCompletedAtOnComplete && isFinishComplete(args.finish) ? { completedAt: Date.now() } : {}
31053
+ });
31054
+ }
31055
+
31056
+ // src/app/queryRuntime/toolQueue.ts
31057
+ function isToolResultErrorBlock(block) {
31058
+ return Boolean(
31059
+ block && typeof block === "object" && block.type === "tool_result" && block.is_error === true
30922
31060
  );
30923
- const hasCompactionMarker = naturalMessages.some(
30924
- (message) => message?.compaction?.type === "compaction"
31061
+ }
31062
+ function isToolUseLikeBlock(block) {
31063
+ return Boolean(
31064
+ block && typeof block === "object" && (block.type === "tool_use" || block.type === "server_tool_use" || block.type === "mcp_tool_use")
30925
31065
  );
30926
- return !hasCompactionMarker && naturalMessages.length <= 2;
30927
31066
  }
30928
- function extractUserPromptTextFromMessages(messages) {
30929
- const last2 = messages[messages.length - 1];
30930
- if (!last2 || typeof last2 !== "object" || last2.type !== "user") {
30931
- return null;
31067
+ function createQueuedWaitingProgressMessage(args) {
31068
+ return createProgressMessage(
31069
+ args.toolUseId,
31070
+ args.siblingToolUseIDs,
31071
+ createAssistantMessage(`${args.openTag}Waiting\u2026${args.closeTag}`),
31072
+ [],
31073
+ args.tools,
31074
+ { progressState: "queued_waiting" }
31075
+ );
31076
+ }
31077
+ function resolveToolQueueContextModifier(message) {
31078
+ if (message.type !== "user") {
31079
+ return void 0;
30932
31080
  }
30933
- const content = last2.message?.content;
30934
- if (typeof content === "string") {
30935
- return content;
31081
+ const modifyContext = message.toolUseResult?.contextModifier?.modifyContext;
31082
+ return typeof modifyContext === "function" ? modifyContext : void 0;
31083
+ }
31084
+ function isToolQueueNextTurnMessage(message) {
31085
+ return message.type === "user" || message.type === "assistant";
31086
+ }
31087
+ function canExecuteToolWithCurrentExecutions(args) {
31088
+ return args.executingEntries.length === 0 || args.nextIsConcurrencySafe && args.executingEntries.every((entry) => entry.isConcurrencySafe);
31089
+ }
31090
+ function shouldWaitForToolQueueProgress(args) {
31091
+ return args.hasExecutingTools && !args.hasCompletedResults && !args.hasPendingProgress;
31092
+ }
31093
+ function resolveToolQueueUserMessageErrorState(message) {
31094
+ if (message.type !== "user") {
31095
+ return { toolErrored: false };
30936
31096
  }
31097
+ const content = message.message?.content;
30937
31098
  if (!Array.isArray(content)) {
30938
- return null;
31099
+ return { toolErrored: false };
30939
31100
  }
30940
- const hasToolResult = content.some(
30941
- (block) => block && typeof block === "object" && block.type === "tool_result"
31101
+ const errorBlocks = content.filter(
31102
+ (block) => isToolResultErrorBlock(block)
30942
31103
  );
30943
- if (hasToolResult) {
30944
- return null;
31104
+ if (errorBlocks.length === 0) {
31105
+ return { toolErrored: false };
31106
+ }
31107
+ const fatalBlock = errorBlocks.find((block) => block.error_class === "fatal");
31108
+ if (fatalBlock && typeof fatalBlock.tool_use_id === "string") {
31109
+ return { toolErrored: true, fatalToolUseId: fatalBlock.tool_use_id };
30945
31110
  }
30946
- return content.filter(
30947
- (block) => block && typeof block === "object" && block.type === "text"
30948
- ).map((block) => String(block.text ?? "")).join("");
31111
+ return { toolErrored: true };
30949
31112
  }
30950
31113
 
30951
31114
  // src/utils/session/singleFactLayer.ts
@@ -31465,9 +31628,6 @@ async function* checkPermissionsAndCallTool(args) {
31465
31628
  }
31466
31629
 
31467
31630
  // src/app/query.ts
31468
- function isToolUseLikeBlock(block) {
31469
- return block && typeof block === "object" && (block.type === "tool_use" || block.type === "server_tool_use" || block.type === "mcp_tool_use");
31470
- }
31471
31631
  var __isToolUseLikeBlockForTests = isToolUseLikeBlock;
31472
31632
  var reminderChannelRounds = [];
31473
31633
  var ToolUseQueue = class {
@@ -31507,7 +31667,10 @@ var ToolUseQueue = class {
31507
31667
  }
31508
31668
  canExecuteTool(isConcurrencySafe) {
31509
31669
  const executing = this.tools.filter((t) => t.status === "executing");
31510
- return executing.length === 0 || isConcurrencySafe && executing.every((t) => t.isConcurrencySafe);
31670
+ return canExecuteToolWithCurrentExecutions({
31671
+ executingEntries: executing,
31672
+ nextIsConcurrencySafe: isConcurrencySafe
31673
+ });
31511
31674
  }
31512
31675
  async processQueue() {
31513
31676
  for (const entry of this.tools) {
@@ -31518,16 +31681,13 @@ var ToolUseQueue = class {
31518
31681
  if (!entry.queuedProgressEmitted) {
31519
31682
  entry.queuedProgressEmitted = true;
31520
31683
  entry.pendingProgress.push(
31521
- createProgressMessage(
31522
- entry.id,
31523
- this.siblingToolUseIDs,
31524
- createAssistantMessage(
31525
- `${TOOL_PROGRESS_OPEN_TAG}Waiting\u2026${TOOL_PROGRESS_CLOSE_TAG}`
31526
- ),
31527
- [],
31528
- this.toolUseContext.options.tools,
31529
- { progressState: "queued_waiting" }
31530
- )
31684
+ createQueuedWaitingProgressMessage({
31685
+ toolUseId: entry.id,
31686
+ siblingToolUseIDs: this.siblingToolUseIDs,
31687
+ tools: this.toolUseContext.options.tools,
31688
+ openTag: TOOL_PROGRESS_OPEN_TAG,
31689
+ closeTag: TOOL_PROGRESS_CLOSE_TAG
31690
+ })
31531
31691
  );
31532
31692
  if (this.progressAvailableResolve) {
31533
31693
  this.progressAvailableResolve();
@@ -31586,21 +31746,12 @@ var ToolUseQueue = class {
31586
31746
  );
31587
31747
  break;
31588
31748
  }
31589
- if (message.type === "user" && Array.isArray(message.message.content) && message.message.content.some(
31590
- (block) => block.type === "tool_result" && block.is_error === true
31591
- )) {
31592
- const fatal = message.message.content.some(
31593
- (block) => block.type === "tool_result" && block.is_error === true && block.error_class === "fatal"
31594
- );
31595
- if (fatal) {
31749
+ const errorState = resolveToolQueueUserMessageErrorState(message);
31750
+ if (errorState.toolErrored) {
31751
+ if (errorState.fatalToolUseId) {
31596
31752
  this.hasFatalErrored = true;
31597
31753
  if (!this.fatalToolUseId) {
31598
- const fatalBlock = message.message.content.find(
31599
- (block) => block.type === "tool_result" && block.is_error === true && block.error_class === "fatal" && typeof block.tool_use_id === "string"
31600
- );
31601
- if (fatalBlock) {
31602
- this.fatalToolUseId = fatalBlock.tool_use_id;
31603
- }
31754
+ this.fatalToolUseId = errorState.fatalToolUseId;
31604
31755
  }
31605
31756
  }
31606
31757
  toolErrored = true;
@@ -31613,10 +31764,9 @@ var ToolUseQueue = class {
31613
31764
  }
31614
31765
  } else {
31615
31766
  results.push(message);
31616
- if (message.type === "user" && message.toolUseResult?.contextModifier) {
31617
- contextModifiers.push(
31618
- message.toolUseResult.contextModifier.modifyContext
31619
- );
31767
+ const modifyContext = resolveToolQueueContextModifier(message);
31768
+ if (modifyContext) {
31769
+ contextModifiers.push(modifyContext);
31620
31770
  }
31621
31771
  }
31622
31772
  }
@@ -31670,7 +31820,11 @@ var ToolUseQueue = class {
31670
31820
  for (const message of this.getCompletedResults()) {
31671
31821
  yield message;
31672
31822
  }
31673
- if (this.hasExecutingTools() && !this.hasCompletedResults() && !this.hasPendingProgress()) {
31823
+ if (shouldWaitForToolQueueProgress({
31824
+ hasExecutingTools: this.hasExecutingTools(),
31825
+ hasCompletedResults: this.hasCompletedResults(),
31826
+ hasPendingProgress: this.hasPendingProgress()
31827
+ })) {
31674
31828
  const promises = this.tools.filter((t) => t.status === "executing" && t.promise).map((t) => t.promise);
31675
31829
  const progressPromise = new Promise((resolve13) => {
31676
31830
  this.progressAvailableResolve = resolve13;
@@ -31997,10 +32151,7 @@ async function* queryCore(messages, systemPrompt, context, canUseTool, toolUseCo
31997
32151
  fullSystemPrompt.push(effectiveSystemReminders);
31998
32152
  fullSystemPrompt.push("\n---\n");
31999
32153
  }
32000
- const planModeAdditions = getPlanModeSystemPromptAdditions(
32001
- messages,
32002
- toolUseContext
32003
- );
32154
+ const planModeAdditions = getPlanModeSystemPromptAdditions(messages, toolUseContext);
32004
32155
  if (planModeAdditions.length > 0) {
32005
32156
  fullSystemPrompt.push(...planModeAdditions);
32006
32157
  }
@@ -32132,17 +32283,12 @@ async function* queryCore(messages, systemPrompt, context, canUseTool, toolUseCo
32132
32283
  const shouldSkipPermissionCheck = result.shouldSkipPermissionCheck;
32133
32284
  const parentUserMessage = findNaturalUserMessageForParent(messages);
32134
32285
  const toolUseMessages = assistantMessage.message.content.filter(isToolUseLikeBlock);
32135
- const usage = assistantMessage.message?.usage;
32136
- const lifecycleTokens = usage && typeof usage === "object" ? {
32137
- ...Number.isFinite(Number(usage.input_tokens)) ? { input: Number(usage.input_tokens) } : {},
32138
- ...Number.isFinite(Number(usage.output_tokens)) ? { output: Number(usage.output_tokens) } : {},
32139
- ...Number.isFinite(Number(usage.input_tokens)) || Number.isFinite(Number(usage.output_tokens)) ? {
32140
- total: Number(usage.input_tokens ?? 0) + Number(usage.output_tokens ?? 0)
32141
- } : {}
32142
- } : void 0;
32286
+ const lifecycleTokens = resolveLifecycleTokensFromAssistantMessage(assistantMessage);
32143
32287
  if (!toolUseMessages.length) {
32144
- const stopHookEvent = toolUseContext.agentId && toolUseContext.agentId !== "main" ? "SubagentStop" : "Stop";
32145
- const stopReason = assistantMessage.message?.stop_reason || assistantMessage.message?.stopReason || "end_turn";
32288
+ const { hookEvent: stopHookEvent, stopReason } = resolveStopHookSignal({
32289
+ agentId: toolUseContext.agentId,
32290
+ assistantMessage
32291
+ });
32146
32292
  const finish = mapFinishReason(stopReason);
32147
32293
  lifecycleEvents.finishStep({
32148
32294
  stepId,
@@ -32153,69 +32299,37 @@ async function* queryCore(messages, systemPrompt, context, canUseTool, toolUseCo
32153
32299
  costUSD: assistantMessage.costUSD,
32154
32300
  ...lifecycleTokens ? { tokens: lifecycleTokens } : {}
32155
32301
  });
32156
- const stopOutcome = await runStopHooks({
32302
+ const stopHookResult = await runStopHookAttempt({
32303
+ context: toolUseContext,
32157
32304
  hookEvent: stopHookEvent,
32158
- reason: String(stopReason ?? ""),
32159
- retryEntryKey: buildRetryEntryKey([
32160
- toolUseContext.sessionId,
32161
- toolUseContext.parentSessionId,
32162
- toolUseContext.childSessionId,
32163
- toolUseContext.agentId,
32164
- String(stopReason ?? "")
32165
- ]),
32166
- retryAttempt: stopHookAttempts,
32167
- sessionId: toolUseContext.sessionId,
32168
- parentSessionId: toolUseContext.parentSessionId,
32169
- childSessionId: toolUseContext.childSessionId,
32170
- agentId: toolUseContext.agentId,
32171
- permissionMode: toolUseContext.options?.toolPermissionContext?.mode,
32172
- cwd: getCwd(),
32173
- transcriptPath: getHookTranscriptPath(toolUseContext),
32174
- safeMode: toolUseContext.options?.safeMode ?? false,
32305
+ stopReason,
32175
32306
  stopHookActive,
32176
- signal: toolUseContext.abortController.signal
32307
+ stopHookAttempts
32177
32308
  });
32178
- if (stopOutcome.systemMessages.length > 0) {
32179
- queueHookSystemMessages(toolUseContext, stopOutcome.systemMessages);
32180
- }
32181
- if (stopOutcome.additionalContexts.length > 0) {
32182
- queueHookAdditionalContexts(
32309
+ if (stopHookResult.shouldRetry) {
32310
+ yield* await queryCore(
32311
+ [...messages, assistantMessage],
32312
+ systemPrompt,
32313
+ context,
32314
+ canUseTool,
32183
32315
  toolUseContext,
32184
- stopOutcome.additionalContexts
32316
+ getBinaryFeedbackResponse,
32317
+ {
32318
+ stopHookActive: true,
32319
+ stopHookAttempts: stopHookResult.nextStopHookAttempts,
32320
+ startupEmitted: true
32321
+ }
32185
32322
  );
32186
- }
32187
- if (stopOutcome.decision === "block") {
32188
- queueHookSystemMessages(toolUseContext, [stopOutcome.message]);
32189
- const MAX_STOP_HOOK_ATTEMPTS = 5;
32190
- if (stopHookAttempts < MAX_STOP_HOOK_ATTEMPTS) {
32191
- yield* await queryCore(
32192
- [...messages, assistantMessage],
32193
- systemPrompt,
32194
- context,
32195
- canUseTool,
32196
- toolUseContext,
32197
- getBinaryFeedbackResponse,
32198
- {
32199
- stopHookActive: true,
32200
- stopHookAttempts: stopHookAttempts + 1,
32201
- startupEmitted: true
32202
- }
32203
- );
32204
- return;
32205
- }
32206
- }
32207
- if (!parentUserMessage?.uuid) {
32208
- sessionContext?.setIdle();
32209
- yield assistantMessage;
32210
32323
  return;
32211
32324
  }
32212
- const enrichedAssistantMessage = appendFinishState(assistantMessage, {
32325
+ const enrichedAssistantMessage = buildAssistantMessageForParent({
32326
+ assistantMessage,
32213
32327
  finish,
32214
- parentID: parentUserMessage.uuid,
32215
- ...isFinishComplete(finish) ? { completedAt: Date.now() } : {}
32328
+ parentMessageUuid: parentUserMessage?.uuid,
32329
+ markCompletedAtOnComplete: true
32216
32330
  });
32217
- const completedQueryId = parentUserMessage.queryId || parentUserMessage.uuid;
32218
- if (conversationTrackingConfig.enabled && conversationTrackingConfig.markCompletion && isFinishComplete(enrichedAssistantMessage.finish) && completedQueryId) {
32331
+ const completedQueryId = parentUserMessage?.queryId || parentUserMessage?.uuid;
32332
+ if (parentUserMessage?.uuid && conversationTrackingConfig.enabled && conversationTrackingConfig.markCompletion && isFinishComplete(enrichedAssistantMessage.finish) && completedQueryId) {
32219
32333
  const completed = tracker.completeQuery(
32220
32334
  completedQueryId,
32221
32335
  enrichedAssistantMessage,
@@ -32229,15 +32343,11 @@ async function* queryCore(messages, systemPrompt, context, canUseTool, toolUseCo
32229
32343
  sessionContext?.setIdle();
32230
32344
  return;
32231
32345
  }
32232
- if (!parentUserMessage?.uuid) {
32233
- yield assistantMessage;
32234
- } else {
32235
- const enrichedAssistantMessage = appendFinishState(assistantMessage, {
32236
- finish: "tool_calls",
32237
- parentID: parentUserMessage.uuid
32238
- });
32239
- yield enrichedAssistantMessage;
32240
- }
32346
+ yield buildAssistantMessageForParent({
32347
+ assistantMessage,
32348
+ finish: "tool_calls",
32349
+ parentMessageUuid: parentUserMessage?.uuid
32350
+ });
32241
32351
  lifecycleEvents.finishStep({
32242
32352
  stepId,
32243
32353
  requestId,
@@ -32261,7 +32371,7 @@ async function* queryCore(messages, systemPrompt, context, canUseTool, toolUseCo
32261
32371
  const toolMessagesForNextTurn = [];
32262
32372
  for await (const message of toolQueue.getRemainingResults()) {
32263
32373
  yield message;
32264
- if (message.type !== "progress") {
32374
+ if (isToolQueueNextTurnMessage(message)) {
32265
32375
  toolMessagesForNextTurn.push(message);
32266
32376
  }
32267
32377
  }
@@ -32271,22 +32381,18 @@ async function* queryCore(messages, systemPrompt, context, canUseTool, toolUseCo
32271
32381
  yield createAssistantMessage(INTERRUPT_MESSAGE_FOR_TOOL_USE);
32272
32382
  return;
32273
32383
  }
32274
- try {
32275
- yield* await queryCore(
32276
- [...messages, assistantMessage, ...toolMessagesForNextTurn],
32277
- systemPrompt,
32278
- context,
32279
- canUseTool,
32280
- toolUseContext,
32281
- getBinaryFeedbackResponse,
32282
- {
32283
- ...hookState ?? {},
32284
- startupEmitted: true
32285
- }
32286
- );
32287
- } catch (error) {
32288
- throw error;
32289
- }
32384
+ yield* await queryCore(
32385
+ [...messages, assistantMessage, ...toolMessagesForNextTurn],
32386
+ systemPrompt,
32387
+ context,
32388
+ canUseTool,
32389
+ toolUseContext,
32390
+ getBinaryFeedbackResponse,
32391
+ {
32392
+ ...hookState ?? {},
32393
+ startupEmitted: true
32394
+ }
32395
+ );
32290
32396
  } catch (error) {
32291
32397
  sessionContext?.setErrored();
32292
32398
  throw error;
@@ -33550,7 +33656,7 @@ import { homedir as homedir8 } from "os";
33550
33656
  // src/commands/agents/generation.ts
33551
33657
  import { randomUUID as randomUUID6 } from "crypto";
33552
33658
  async function generateAgentWithClaude(prompt) {
33553
- const { queryModel } = await import("./llm-BPQNYHE3.js");
33659
+ const { queryModel } = await import("./llm-NAYVED3B.js");
33554
33660
  const systemPrompt = `You are an expert at creating AI agent configurations. Based on the user's description, generate a specialized agent configuration.
33555
33661
 
33556
33662
  Return your response as a JSON object with exactly these fields: