pybao-cli 1.5.2 → 1.5.3

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 (151) hide show
  1. package/dist/REPL-2NKO3DDR.js +49 -0
  2. package/dist/{acp-DXLDM2M4.js → acp-DXNZZBYP.js} +30 -30
  3. package/dist/{agentsValidate-MBFWR6QL.js → agentsValidate-TMUIF7RL.js} +7 -7
  4. package/dist/{ask-F626S4ZT.js → ask-7WBPXXRW.js} +29 -29
  5. package/dist/{autoUpdater-DWURNXYL.js → autoUpdater-FASENJNG.js} +3 -3
  6. package/dist/{chunk-XGHVVVMB.js → chunk-4NDXPOTT.js} +2 -2
  7. package/dist/{chunk-BIJXNPMG.js → chunk-4NW34B7Y.js} +1 -1
  8. package/dist/{chunk-Y6F7IDHE.js → chunk-53SGWVRR.js} +3 -3
  9. package/dist/{chunk-CTJBHXP7.js → chunk-CHLNVDSF.js} +3 -3
  10. package/dist/{chunk-KNPYA7XB.js → chunk-D6677VAG.js} +2 -2
  11. package/dist/{chunk-PPCG7UIH.js → chunk-DGP7LO7K.js} +1 -1
  12. package/dist/{chunk-DB3VA6G3.js → chunk-EHQQTP7E.js} +1 -1
  13. package/dist/{chunk-NOEVDTYI.js → chunk-HM43Y2CP.js} +4 -4
  14. package/dist/{chunk-TFOMEGLL.js → chunk-IF53E332.js} +2 -2
  15. package/dist/{chunk-TSKSA2Y4.js → chunk-IIUYGVCI.js} +3 -3
  16. package/dist/{chunk-AZ2D6YSU.js → chunk-KO22LAIF.js} +4 -4
  17. package/dist/{chunk-56EHVEXV.js → chunk-KW4PMRDR.js} +1 -1
  18. package/dist/{chunk-6UZZ4RXH.js → chunk-MAF3SKT6.js} +1 -1
  19. package/dist/{chunk-T5WL2NM6.js → chunk-NYDZHCDE.js} +1 -1
  20. package/dist/{chunk-K4VCVAYN.js → chunk-OHQETPDH.js} +3 -3
  21. package/dist/{chunk-W4GPV4TG.js → chunk-OUECTNP5.js} +3 -3
  22. package/dist/{chunk-3YUADJU7.js → chunk-OYC2QR54.js} +2 -2
  23. package/dist/{chunk-WVJF2KNA.js → chunk-OYYWTXJC.js} +3 -3
  24. package/dist/{chunk-J6MYGZQL.js → chunk-PISK6U5J.js} +20 -30
  25. package/dist/chunk-PISK6U5J.js.map +7 -0
  26. package/dist/{chunk-VC4UXX7K.js → chunk-QBLRERUX.js} +1 -1
  27. package/dist/{chunk-HM57DLRI.js → chunk-QEVQWEYU.js} +2 -2
  28. package/dist/{chunk-HIDCDFMI.js → chunk-R35OPNFM.js} +1 -1
  29. package/dist/{chunk-D5CO64XN.js → chunk-RHDW7BWR.js} +1 -1
  30. package/dist/{chunk-66I7VWVN.js → chunk-S5JM4TXZ.js} +1 -1
  31. package/dist/{chunk-66I7VWVN.js.map → chunk-S5JM4TXZ.js.map} +1 -1
  32. package/dist/{chunk-5K6AFF6H.js → chunk-SMLLIGJI.js} +2 -2
  33. package/dist/{chunk-GCA65KUK.js → chunk-SPC2RSUA.js} +3 -3
  34. package/dist/{chunk-FHWWNYDB.js → chunk-SXZ3VQNN.js} +2 -2
  35. package/dist/{chunk-GTH2GLM2.js → chunk-UI4EDGQP.js} +623 -47
  36. package/dist/chunk-UI4EDGQP.js.map +7 -0
  37. package/dist/{chunk-YEUCIHU6.js → chunk-VJ3ZH6XK.js} +1 -1
  38. package/dist/{chunk-RAPAWNQM.js → chunk-XZDNNAOG.js} +4 -4
  39. package/dist/{chunk-2JZ774IW.js → chunk-YNHS2JAI.js} +4 -4
  40. package/dist/{cli-6D5EB2QO.js → cli-DTSQZFF5.js} +89 -89
  41. package/dist/commands-EFJBRLOX.js +53 -0
  42. package/dist/{config-EBRTHXNO.js → config-R5OJR4XK.js} +4 -4
  43. package/dist/{context-NGUOVGLI.js → context-IQR6KZZG.js} +6 -6
  44. package/dist/{conversationTracker-RL4AR6AT.js → conversationTracker-LT4FZ2TE.js} +3 -3
  45. package/dist/{customCommands-JBK5WMYM.js → customCommands-37VLCSFB.js} +4 -4
  46. package/dist/{env-7JK5WQ6D.js → env-PIM6NMWB.js} +2 -2
  47. package/dist/{file-4VUV6TU7.js → file-2QFJYC3P.js} +4 -4
  48. package/dist/index.js +3 -3
  49. package/dist/{llm-FFB2I7QL.js → llm-BV3ZXLUQ.js} +30 -30
  50. package/dist/{llmLazy-TD2AWFEQ.js → llmLazy-TU4RPL2G.js} +1 -1
  51. package/dist/{loader-2K3HLM4L.js → loader-GI7TV6A6.js} +4 -4
  52. package/dist/{lsp-B7KRNQHU.js → lsp-PPMZSL4Y.js} +6 -6
  53. package/dist/{lspAnchor-YIYZHOHL.js → lspAnchor-LB2NFDKB.js} +6 -6
  54. package/dist/{mcp-IC4WIZKM.js → mcp-ESFRIVSV.js} +7 -7
  55. package/dist/{mentionProcessor-PER465QN.js → mentionProcessor-SGRO3JHT.js} +5 -5
  56. package/dist/{messages-LQ27CQTF.js → messages-GQ6FETYN.js} +1 -1
  57. package/dist/{model-XE7N4T23.js → model-GFLLFKZX.js} +5 -5
  58. package/dist/{openai-STSXOBJK.js → openai-DSFJ7BDF.js} +5 -5
  59. package/dist/{outputStyles-AHEDF77O.js → outputStyles-55WG42CM.js} +4 -4
  60. package/dist/{pluginRuntime-KO3VBNQ4.js → pluginRuntime-XUB6KZMQ.js} +6 -6
  61. package/dist/{pluginValidation-VY7XQ3NX.js → pluginValidation-L2MN57D2.js} +6 -6
  62. package/dist/prompts-SNTE6VEN.js +55 -0
  63. package/dist/{pybAgentSessionLoad-I5HNNX7P.js → pybAgentSessionLoad-CHKBBFKM.js} +4 -4
  64. package/dist/{pybAgentSessionResume-7Q3BLWXA.js → pybAgentSessionResume-IAHZMV3H.js} +4 -4
  65. package/dist/{pybAgentStreamJsonSession-7RVISZVF.js → pybAgentStreamJsonSession-OSSUE2KR.js} +1 -1
  66. package/dist/{pybHooks-RVK7YU3J.js → pybHooks-7HVWU6ZV.js} +4 -4
  67. package/dist/query-YB5HN4QQ.js +57 -0
  68. package/dist/{registry-ZQ2TH2OE.js → registry-WU6HV5MK.js} +5 -5
  69. package/dist/{ripgrep-Y6W4QA3Q.js → ripgrep-KWOKWKDZ.js} +3 -3
  70. package/dist/{skillMarketplace-NWL6FBJV.js → skillMarketplace-77YJ6UGU.js} +3 -3
  71. package/dist/{state-OHGUHJMH.js → state-FUNN2BQL.js} +2 -2
  72. package/dist/{theme-S3ODCAZQ.js → theme-ZTXKDDNY.js} +5 -5
  73. package/dist/{toolPermissionSettings-7U6ZLOWH.js → toolPermissionSettings-JPH4VWNJ.js} +6 -6
  74. package/dist/tools-7YC25SS4.js +54 -0
  75. package/dist/{userInput-RWBTW5QJ.js → userInput-EVSLUMYP.js} +31 -31
  76. package/package.json +1 -1
  77. package/dist/REPL-WBTT5LR6.js +0 -49
  78. package/dist/chunk-GTH2GLM2.js.map +0 -7
  79. package/dist/chunk-J6MYGZQL.js.map +0 -7
  80. package/dist/commands-2DU75YYL.js +0 -53
  81. package/dist/prompts-YJPKJBGM.js +0 -55
  82. package/dist/query-QBYPG3GI.js +0 -57
  83. package/dist/tools-LW5HBTH3.js +0 -54
  84. /package/dist/{REPL-WBTT5LR6.js.map → REPL-2NKO3DDR.js.map} +0 -0
  85. /package/dist/{acp-DXLDM2M4.js.map → acp-DXNZZBYP.js.map} +0 -0
  86. /package/dist/{agentsValidate-MBFWR6QL.js.map → agentsValidate-TMUIF7RL.js.map} +0 -0
  87. /package/dist/{ask-F626S4ZT.js.map → ask-7WBPXXRW.js.map} +0 -0
  88. /package/dist/{autoUpdater-DWURNXYL.js.map → autoUpdater-FASENJNG.js.map} +0 -0
  89. /package/dist/{chunk-XGHVVVMB.js.map → chunk-4NDXPOTT.js.map} +0 -0
  90. /package/dist/{chunk-BIJXNPMG.js.map → chunk-4NW34B7Y.js.map} +0 -0
  91. /package/dist/{chunk-Y6F7IDHE.js.map → chunk-53SGWVRR.js.map} +0 -0
  92. /package/dist/{chunk-CTJBHXP7.js.map → chunk-CHLNVDSF.js.map} +0 -0
  93. /package/dist/{chunk-KNPYA7XB.js.map → chunk-D6677VAG.js.map} +0 -0
  94. /package/dist/{chunk-PPCG7UIH.js.map → chunk-DGP7LO7K.js.map} +0 -0
  95. /package/dist/{chunk-DB3VA6G3.js.map → chunk-EHQQTP7E.js.map} +0 -0
  96. /package/dist/{chunk-NOEVDTYI.js.map → chunk-HM43Y2CP.js.map} +0 -0
  97. /package/dist/{chunk-TFOMEGLL.js.map → chunk-IF53E332.js.map} +0 -0
  98. /package/dist/{chunk-TSKSA2Y4.js.map → chunk-IIUYGVCI.js.map} +0 -0
  99. /package/dist/{chunk-AZ2D6YSU.js.map → chunk-KO22LAIF.js.map} +0 -0
  100. /package/dist/{chunk-56EHVEXV.js.map → chunk-KW4PMRDR.js.map} +0 -0
  101. /package/dist/{chunk-6UZZ4RXH.js.map → chunk-MAF3SKT6.js.map} +0 -0
  102. /package/dist/{chunk-T5WL2NM6.js.map → chunk-NYDZHCDE.js.map} +0 -0
  103. /package/dist/{chunk-K4VCVAYN.js.map → chunk-OHQETPDH.js.map} +0 -0
  104. /package/dist/{chunk-W4GPV4TG.js.map → chunk-OUECTNP5.js.map} +0 -0
  105. /package/dist/{chunk-3YUADJU7.js.map → chunk-OYC2QR54.js.map} +0 -0
  106. /package/dist/{chunk-WVJF2KNA.js.map → chunk-OYYWTXJC.js.map} +0 -0
  107. /package/dist/{chunk-VC4UXX7K.js.map → chunk-QBLRERUX.js.map} +0 -0
  108. /package/dist/{chunk-HM57DLRI.js.map → chunk-QEVQWEYU.js.map} +0 -0
  109. /package/dist/{chunk-HIDCDFMI.js.map → chunk-R35OPNFM.js.map} +0 -0
  110. /package/dist/{chunk-D5CO64XN.js.map → chunk-RHDW7BWR.js.map} +0 -0
  111. /package/dist/{chunk-5K6AFF6H.js.map → chunk-SMLLIGJI.js.map} +0 -0
  112. /package/dist/{chunk-GCA65KUK.js.map → chunk-SPC2RSUA.js.map} +0 -0
  113. /package/dist/{chunk-FHWWNYDB.js.map → chunk-SXZ3VQNN.js.map} +0 -0
  114. /package/dist/{chunk-YEUCIHU6.js.map → chunk-VJ3ZH6XK.js.map} +0 -0
  115. /package/dist/{chunk-RAPAWNQM.js.map → chunk-XZDNNAOG.js.map} +0 -0
  116. /package/dist/{chunk-2JZ774IW.js.map → chunk-YNHS2JAI.js.map} +0 -0
  117. /package/dist/{cli-6D5EB2QO.js.map → cli-DTSQZFF5.js.map} +0 -0
  118. /package/dist/{commands-2DU75YYL.js.map → commands-EFJBRLOX.js.map} +0 -0
  119. /package/dist/{config-EBRTHXNO.js.map → config-R5OJR4XK.js.map} +0 -0
  120. /package/dist/{context-NGUOVGLI.js.map → context-IQR6KZZG.js.map} +0 -0
  121. /package/dist/{conversationTracker-RL4AR6AT.js.map → conversationTracker-LT4FZ2TE.js.map} +0 -0
  122. /package/dist/{customCommands-JBK5WMYM.js.map → customCommands-37VLCSFB.js.map} +0 -0
  123. /package/dist/{env-7JK5WQ6D.js.map → env-PIM6NMWB.js.map} +0 -0
  124. /package/dist/{file-4VUV6TU7.js.map → file-2QFJYC3P.js.map} +0 -0
  125. /package/dist/{llm-FFB2I7QL.js.map → llm-BV3ZXLUQ.js.map} +0 -0
  126. /package/dist/{llmLazy-TD2AWFEQ.js.map → llmLazy-TU4RPL2G.js.map} +0 -0
  127. /package/dist/{loader-2K3HLM4L.js.map → loader-GI7TV6A6.js.map} +0 -0
  128. /package/dist/{lsp-B7KRNQHU.js.map → lsp-PPMZSL4Y.js.map} +0 -0
  129. /package/dist/{lspAnchor-YIYZHOHL.js.map → lspAnchor-LB2NFDKB.js.map} +0 -0
  130. /package/dist/{mcp-IC4WIZKM.js.map → mcp-ESFRIVSV.js.map} +0 -0
  131. /package/dist/{mentionProcessor-PER465QN.js.map → mentionProcessor-SGRO3JHT.js.map} +0 -0
  132. /package/dist/{messages-LQ27CQTF.js.map → messages-GQ6FETYN.js.map} +0 -0
  133. /package/dist/{model-XE7N4T23.js.map → model-GFLLFKZX.js.map} +0 -0
  134. /package/dist/{openai-STSXOBJK.js.map → openai-DSFJ7BDF.js.map} +0 -0
  135. /package/dist/{outputStyles-AHEDF77O.js.map → outputStyles-55WG42CM.js.map} +0 -0
  136. /package/dist/{pluginRuntime-KO3VBNQ4.js.map → pluginRuntime-XUB6KZMQ.js.map} +0 -0
  137. /package/dist/{pluginValidation-VY7XQ3NX.js.map → pluginValidation-L2MN57D2.js.map} +0 -0
  138. /package/dist/{prompts-YJPKJBGM.js.map → prompts-SNTE6VEN.js.map} +0 -0
  139. /package/dist/{pybAgentSessionLoad-I5HNNX7P.js.map → pybAgentSessionLoad-CHKBBFKM.js.map} +0 -0
  140. /package/dist/{pybAgentSessionResume-7Q3BLWXA.js.map → pybAgentSessionResume-IAHZMV3H.js.map} +0 -0
  141. /package/dist/{pybAgentStreamJsonSession-7RVISZVF.js.map → pybAgentStreamJsonSession-OSSUE2KR.js.map} +0 -0
  142. /package/dist/{pybHooks-RVK7YU3J.js.map → pybHooks-7HVWU6ZV.js.map} +0 -0
  143. /package/dist/{query-QBYPG3GI.js.map → query-YB5HN4QQ.js.map} +0 -0
  144. /package/dist/{registry-ZQ2TH2OE.js.map → registry-WU6HV5MK.js.map} +0 -0
  145. /package/dist/{ripgrep-Y6W4QA3Q.js.map → ripgrep-KWOKWKDZ.js.map} +0 -0
  146. /package/dist/{skillMarketplace-NWL6FBJV.js.map → skillMarketplace-77YJ6UGU.js.map} +0 -0
  147. /package/dist/{state-OHGUHJMH.js.map → state-FUNN2BQL.js.map} +0 -0
  148. /package/dist/{theme-S3ODCAZQ.js.map → theme-ZTXKDDNY.js.map} +0 -0
  149. /package/dist/{toolPermissionSettings-7U6ZLOWH.js.map → toolPermissionSettings-JPH4VWNJ.js.map} +0 -0
  150. /package/dist/{tools-LW5HBTH3.js.map → tools-7YC25SS4.js.map} +0 -0
  151. /package/dist/{userInput-RWBTW5QJ.js.map → userInput-EVSLUMYP.js.map} +0 -0
@@ -2,11 +2,11 @@ import { createRequire as __pybCreateRequire } from "node:module";
2
2
  const require = __pybCreateRequire(import.meta.url);
3
3
  import {
4
4
  listPybAgentSessions
5
- } from "./chunk-BIJXNPMG.js";
5
+ } from "./chunk-4NW34B7Y.js";
6
6
  import {
7
7
  formatValidationResult,
8
8
  validatePluginOrMarketplacePath
9
- } from "./chunk-WVJF2KNA.js";
9
+ } from "./chunk-OYYWTXJC.js";
10
10
  import {
11
11
  ConversationTracker,
12
12
  appendFinishState,
@@ -14,18 +14,18 @@ import {
14
14
  getConversationTrackerForContext,
15
15
  isFinishComplete,
16
16
  mapFinishReason
17
- } from "./chunk-D5CO64XN.js";
17
+ } from "./chunk-RHDW7BWR.js";
18
18
  import {
19
19
  beginReplSessionScope
20
20
  } from "./chunk-F4AXICO7.js";
21
21
  import {
22
22
  loadPybAgentSessionMessages
23
- } from "./chunk-56EHVEXV.js";
23
+ } from "./chunk-KW4PMRDR.js";
24
24
  import {
25
25
  appendSessionCustomTitleRecord,
26
26
  appendSessionJsonlFromMessage,
27
27
  appendSessionTagRecord
28
- } from "./chunk-3YUADJU7.js";
28
+ } from "./chunk-OYC2QR54.js";
29
29
  import {
30
30
  drainHookSystemPromptAdditions,
31
31
  getHookTranscriptPath,
@@ -37,7 +37,7 @@ import {
37
37
  runStopHooks,
38
38
  runUserPromptSubmitHooks,
39
39
  updateHookTranscriptForMessages
40
- } from "./chunk-GCA65KUK.js";
40
+ } from "./chunk-SPC2RSUA.js";
41
41
  import {
42
42
  DEFAULT_OUTPUT_STYLE,
43
43
  getAvailableOutputStyles,
@@ -46,11 +46,11 @@ import {
46
46
  getOutputStyleSystemPromptAdditions,
47
47
  resolveOutputStyleName,
48
48
  setCurrentOutputStyle
49
- } from "./chunk-KNPYA7XB.js";
49
+ } from "./chunk-D6677VAG.js";
50
50
  import {
51
51
  fetchCustomModels,
52
52
  getModelFeatures
53
- } from "./chunk-HM57DLRI.js";
53
+ } from "./chunk-QEVQWEYU.js";
54
54
  import {
55
55
  getSessionState
56
56
  } from "./chunk-XKYHFZEC.js";
@@ -58,7 +58,7 @@ import {
58
58
  queryLLM,
59
59
  queryQuick,
60
60
  verifyApiKey
61
- } from "./chunk-RAPAWNQM.js";
61
+ } from "./chunk-XZDNNAOG.js";
62
62
  import {
63
63
  DEFAULT_TIMEOUT_MS,
64
64
  FallbackToolUseRejectedMessage,
@@ -72,7 +72,7 @@ import {
72
72
  listMCPServers,
73
73
  loadMergedSettings,
74
74
  normalizeSandboxRuntimeConfigFromSettings
75
- } from "./chunk-2JZ774IW.js";
75
+ } from "./chunk-YNHS2JAI.js";
76
76
  import {
77
77
  addMarketplace,
78
78
  disableSkillPlugin,
@@ -85,11 +85,11 @@ import {
85
85
  refreshMarketplaceAsync,
86
86
  removeMarketplace,
87
87
  uninstallSkillPlugin
88
- } from "./chunk-6UZZ4RXH.js";
88
+ } from "./chunk-MAF3SKT6.js";
89
89
  import {
90
90
  loadToolPermissionContextFromDisk,
91
91
  persistToolPermissionUpdateToDisk
92
- } from "./chunk-TSKSA2Y4.js";
92
+ } from "./chunk-IIUYGVCI.js";
93
93
  import {
94
94
  applyToolPermissionContextUpdate,
95
95
  applyToolPermissionContextUpdates,
@@ -100,13 +100,13 @@ import {
100
100
  generateSystemReminders,
101
101
  resetReminderSession,
102
102
  systemReminderService
103
- } from "./chunk-TFOMEGLL.js";
103
+ } from "./chunk-IF53E332.js";
104
104
  import {
105
105
  clearAgentCache,
106
106
  getActiveAgents,
107
107
  getAgentByType,
108
108
  getAllAgents
109
- } from "./chunk-FHWWNYDB.js";
109
+ } from "./chunk-SXZ3VQNN.js";
110
110
  import {
111
111
  API_ERROR_MESSAGE_PREFIX,
112
112
  CANCEL_MESSAGE,
@@ -137,7 +137,7 @@ import {
137
137
  processUserInput,
138
138
  reorderMessages,
139
139
  stripSystemMessages
140
- } from "./chunk-DB3VA6G3.js";
140
+ } from "./chunk-EHQQTP7E.js";
141
141
  import {
142
142
  getRequestStatus,
143
143
  setRequestStatus,
@@ -167,7 +167,7 @@ import {
167
167
  normalizeFilePath,
168
168
  readTextContent,
169
169
  writeTextContent
170
- } from "./chunk-5K6AFF6H.js";
170
+ } from "./chunk-SMLLIGJI.js";
171
171
  import {
172
172
  parseBlockEdits
173
173
  } from "./chunk-QWIBSCDN.js";
@@ -177,18 +177,18 @@ import {
177
177
  ParserRegistry,
178
178
  initParser,
179
179
  loadLanguage
180
- } from "./chunk-NOEVDTYI.js";
180
+ } from "./chunk-HM43Y2CP.js";
181
181
  import {
182
182
  getSettingsFileCandidates,
183
183
  loadSettingsWithLegacyFallback,
184
184
  readSettingsFile
185
- } from "./chunk-VC4UXX7K.js";
185
+ } from "./chunk-QBLRERUX.js";
186
186
  import {
187
187
  getCustomCommandDirectories,
188
188
  hasCustomCommands,
189
189
  loadCustomCommands,
190
190
  reloadCustomCommands
191
- } from "./chunk-XGHVVVMB.js";
191
+ } from "./chunk-4NDXPOTT.js";
192
192
  import {
193
193
  getSessionPlugins
194
194
  } from "./chunk-BJSWTHRM.js";
@@ -197,7 +197,7 @@ import {
197
197
  buildModelProfileKey,
198
198
  getModelManager,
199
199
  isDefaultSlowAndCapableModel
200
- } from "./chunk-CTJBHXP7.js";
200
+ } from "./chunk-CHLNVDSF.js";
201
201
  import {
202
202
  getCodeStyle,
203
203
  getContext,
@@ -205,16 +205,16 @@ import {
205
205
  getIsGit,
206
206
  getProjectDocs,
207
207
  getProjectStructureStatisticsBlock
208
- } from "./chunk-AZ2D6YSU.js";
208
+ } from "./chunk-KO22LAIF.js";
209
209
  import {
210
210
  getRipgrepPath,
211
211
  getRipgrepPolicyMode,
212
212
  resolveRipgrepPolicy,
213
213
  ripGrep
214
- } from "./chunk-PPCG7UIH.js";
214
+ } from "./chunk-DGP7LO7K.js";
215
215
  import {
216
216
  getTheme
217
- } from "./chunk-HIDCDFMI.js";
217
+ } from "./chunk-R35OPNFM.js";
218
218
  import {
219
219
  DEFAULT_GLOBAL_CONFIG,
220
220
  enableConfigs,
@@ -227,7 +227,7 @@ import {
227
227
  saveGlobalConfig,
228
228
  setAllPointersToModel,
229
229
  setModelPointer
230
- } from "./chunk-W4GPV4TG.js";
230
+ } from "./chunk-OUECTNP5.js";
231
231
  import {
232
232
  AbortError
233
233
  } from "./chunk-RQVLBMP7.js";
@@ -236,7 +236,7 @@ import {
236
236
  getCurrentRequest,
237
237
  logUserFriendly,
238
238
  markPhase
239
- } from "./chunk-T5WL2NM6.js";
239
+ } from "./chunk-NYDZHCDE.js";
240
240
  import {
241
241
  ASCII_LOGO,
242
242
  BunShell,
@@ -277,10 +277,10 @@ import {
277
277
  setCwd,
278
278
  shouldApplyToolOutputTruncation,
279
279
  truncateToolOutput
280
- } from "./chunk-YEUCIHU6.js";
280
+ } from "./chunk-VJ3ZH6XK.js";
281
281
  import {
282
282
  MACRO
283
- } from "./chunk-66I7VWVN.js";
283
+ } from "./chunk-S5JM4TXZ.js";
284
284
  import {
285
285
  __export
286
286
  } from "./chunk-I3J4JYES.js";
@@ -461,7 +461,7 @@ var getCommandSubcommandPrefix = memoize(
461
461
  var getCommandPrefix = memoize(
462
462
  async (command4, abortSignal) => {
463
463
  const { systemPrompt, userPrompt } = buildBashCommandPrefixDetectionPrompt(command4);
464
- const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryQuick: queryQuick2 } = await import("./llm-FFB2I7QL.js");
464
+ const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryQuick: queryQuick2 } = await import("./llm-BV3ZXLUQ.js");
465
465
  const response = await queryQuick2({
466
466
  systemPrompt,
467
467
  userPrompt,
@@ -4263,7 +4263,7 @@ function formatParseError(error) {
4263
4263
  return error instanceof Error ? error.message : String(error);
4264
4264
  }
4265
4265
  async function defaultGateQuery(args) {
4266
- const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryLLM: queryLLM2 } = await import("./llm-FFB2I7QL.js");
4266
+ const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryLLM: queryLLM2 } = await import("./llm-BV3ZXLUQ.js");
4267
4267
  const queryLLMFn = args.queryLLMOverride ?? queryLLM2;
4268
4268
  const messages = [
4269
4269
  {
@@ -6624,7 +6624,7 @@ var FileEditTool = {
6624
6624
  const originalFileContent = currentFileContent;
6625
6625
  let totalPatch = [];
6626
6626
  const { SmartEdit } = await import("./smart-edit-AWHJDSU6.js");
6627
- const { findLspAnchor } = await import("./lspAnchor-YIYZHOHL.js");
6627
+ const { findLspAnchor } = await import("./lspAnchor-LB2NFDKB.js");
6628
6628
  for (const op of editOperations) {
6629
6629
  const normalizedSearch = normalizeLineEndings(op.search);
6630
6630
  const normalizedReplace = normalizeLineEndings(op.replace);
@@ -8808,6 +8808,33 @@ import { Box as Box16, Text as Text17 } from "ink";
8808
8808
  import React17 from "react";
8809
8809
  import { z as z8 } from "zod";
8810
8810
 
8811
+ // src/services/system/toolOutputPolicy.ts
8812
+ function buildWebSearchCitationPolicy() {
8813
+ return [
8814
+ "Policy:",
8815
+ "- citations: required",
8816
+ "- format: markdown hyperlinks",
8817
+ "- sources: use links listed above"
8818
+ ].join("\n");
8819
+ }
8820
+ function buildTaskAsyncPolicy(agentId) {
8821
+ const toolName = "TaskOutput";
8822
+ return [
8823
+ "Async agent launched.",
8824
+ `agentId: ${agentId} (internal only, do not expose to user)`,
8825
+ "Policy:",
8826
+ `- progress check: ${toolName} with block=false`,
8827
+ `- wait for final output only when idle: ${toolName} with block=true`
8828
+ ].join("\n");
8829
+ }
8830
+ var TASK_FORK_CONTEXT_POLICY = [
8831
+ "Entered sub-agent context.",
8832
+ "Policy:",
8833
+ "- above main-thread messages are context only",
8834
+ "- only use tools available in the sub-agent prompt",
8835
+ "- complete only the assigned sub-agent task"
8836
+ ].join("\n");
8837
+
8811
8838
  // src/tools/network/WebSearchTool/prompt.ts
8812
8839
  var TOOL_NAME_FOR_PROMPT4 = "WebSearch";
8813
8840
  function todayISO() {
@@ -9038,7 +9065,8 @@ var WebSearchTool = {
9038
9065
  `;
9039
9066
  }
9040
9067
  }
9041
- result += "\nREMINDER: You MUST include the sources above in your response to the user using markdown hyperlinks.";
9068
+ result += `
9069
+ ${buildWebSearchCitationPolicy()}`;
9042
9070
  return result.trim();
9043
9071
  },
9044
9072
  async validateInput(input) {
@@ -11898,7 +11926,7 @@ async function createAndStoreApiKey(accessToken) {
11898
11926
  }
11899
11927
  saveGlobalConfig(config2);
11900
11928
  try {
11901
- const { resetAnthropicClient } = await import("./llm-FFB2I7QL.js");
11929
+ const { resetAnthropicClient } = await import("./llm-BV3ZXLUQ.js");
11902
11930
  resetAnthropicClient();
11903
11931
  } catch {
11904
11932
  }
@@ -16322,7 +16350,7 @@ async function refreshPluginRuntimeFromInstalls() {
16322
16350
  const existingRoots = getSessionPlugins().map((p) => p.rootDir);
16323
16351
  const dirs = Array.from(/* @__PURE__ */ new Set([...existingRoots, ...installedRoots]));
16324
16352
  if (dirs.length === 0) return [];
16325
- const { configureSessionPlugins } = await import("./pluginRuntime-KO3VBNQ4.js");
16353
+ const { configureSessionPlugins } = await import("./pluginRuntime-XUB6KZMQ.js");
16326
16354
  const { errors } = await configureSessionPlugins({ pluginDirs: dirs });
16327
16355
  return errors;
16328
16356
  }
@@ -16997,7 +17025,7 @@ async function call(onDone, context) {
16997
17025
  ModelConfig,
16998
17026
  {
16999
17027
  onClose: () => {
17000
- import("./model-XE7N4T23.js").then(({ reloadModelManager: reloadModelManager2 }) => {
17028
+ import("./model-GFLLFKZX.js").then(({ reloadModelManager: reloadModelManager2 }) => {
17001
17029
  reloadModelManager2();
17002
17030
  triggerModelConfigChange();
17003
17031
  onDone();
@@ -25201,7 +25229,7 @@ function useStatusLine() {
25201
25229
  // src/ui/components/PromptInput.tsx
25202
25230
  async function interpretHashCommand(input) {
25203
25231
  try {
25204
- const { queryQuick: queryQuick2 } = await import("./llm-FFB2I7QL.js");
25232
+ const { queryQuick: queryQuick2 } = await import("./llm-BV3ZXLUQ.js");
25205
25233
  const systemPrompt = [
25206
25234
  "You're helping the user structure notes that will be added to their PYB.md file.",
25207
25235
  "Format the user's input into a well-structured note that will be useful for later reference.",
@@ -25514,7 +25542,7 @@ function PromptInput({
25514
25542
  if (messages2.length) {
25515
25543
  if (mode === "bash") {
25516
25544
  onQuery(messages2, newAbortController).then(async () => {
25517
- const { getCwd: getCwd2 } = await import("./state-OHGUHJMH.js");
25545
+ const { getCwd: getCwd2 } = await import("./state-FUNN2BQL.js");
25518
25546
  setCurrentPwd(getCwd2());
25519
25547
  });
25520
25548
  } else {
@@ -26861,11 +26889,62 @@ function computeAutoCompactMetrics(events) {
26861
26889
  crossReplayErrors,
26862
26890
  crossReplayTotal
26863
26891
  );
26892
+ const sanitizerEvents = events.filter(
26893
+ (event) => event.phase === "AUTO_COMPACT_SANITIZER_APPLIED"
26894
+ );
26895
+ const removedNoiseTotal = sanitizerEvents.reduce(
26896
+ (sum, event) => sum + Number(event.data?.removedReminderTags ?? 0) + Number(event.data?.removedToolProgressTags ?? 0),
26897
+ 0
26898
+ );
26899
+ const changedMessagesTotal = sanitizerEvents.reduce(
26900
+ (sum, event) => sum + Number(event.data?.changedMessages ?? 0),
26901
+ 0
26902
+ );
26903
+ const noise_ratio_after_compaction = changedMessagesTotal > 0 ? Math.max(
26904
+ 0,
26905
+ Math.min(1, 1 - safeDivide(removedNoiseTotal, changedMessagesTotal * 2))
26906
+ ) : void 0;
26907
+ const qualityEvents = events.filter(
26908
+ (event) => event.phase === "AUTO_COMPACT_SUMMARY_QUALITY"
26909
+ );
26910
+ const goalSamples = qualityEvents.filter(
26911
+ (event) => typeof event.data?.taskGoalRetained === "boolean"
26912
+ );
26913
+ const resultSamples = qualityEvents.filter(
26914
+ (event) => typeof event.data?.hasResultInput === "boolean"
26915
+ );
26916
+ const errorSamples = qualityEvents.filter(
26917
+ (event) => typeof event.data?.hasErrorInput === "boolean"
26918
+ );
26919
+ const task_goal_retention_rate = goalSamples.length > 0 ? safeDivide(
26920
+ goalSamples.filter((event) => event.data?.taskGoalRetained === true).length,
26921
+ goalSamples.length
26922
+ ) : void 0;
26923
+ const result_fidelity_rate = resultSamples.length > 0 ? safeDivide(
26924
+ resultSamples.filter((event) => {
26925
+ if (event.data?.hasResultInput !== true) return true;
26926
+ return event.data?.hasResultSummary === true;
26927
+ }).length,
26928
+ resultSamples.length
26929
+ ) : void 0;
26930
+ const error_fidelity_rate = errorSamples.length > 0 ? safeDivide(
26931
+ errorSamples.filter((event) => {
26932
+ if (event.data?.hasErrorInput !== true) return true;
26933
+ return event.data?.hasErrorSummary === true;
26934
+ }).length,
26935
+ errorSamples.length
26936
+ ) : void 0;
26937
+ const first_turn_drift_rate = task_goal_retention_rate === void 0 ? void 0 : 1 - task_goal_retention_rate;
26864
26938
  return {
26865
26939
  compact_invalid_shape_rate,
26866
26940
  compact_retry_success_rate,
26867
26941
  thinking_first_ratio,
26868
- cross_model_replay_error_rate
26942
+ cross_model_replay_error_rate,
26943
+ noise_ratio_after_compaction,
26944
+ task_goal_retention_rate,
26945
+ result_fidelity_rate,
26946
+ error_fidelity_rate,
26947
+ first_turn_drift_rate
26869
26948
  };
26870
26949
  }
26871
26950
 
@@ -26893,7 +26972,10 @@ var AUTO_COMPACT_TELEMETRY_PHASES = /* @__PURE__ */ new Set([
26893
26972
  "AUTO_COMPACT_FAILED",
26894
26973
  "AUTO_COMPACT_RETRY",
26895
26974
  "AUTO_COMPACT_FALLBACK",
26896
- "MESSAGE_TRANSFORM_APPLIED"
26975
+ "MESSAGE_TRANSFORM_APPLIED",
26976
+ "AUTO_COMPACT_SANITIZER_APPLIED",
26977
+ "AUTO_COMPACT_SUMMARY_QUALITY",
26978
+ "AUTO_COMPACT_BUDGET_APPLIED"
26897
26979
  ]);
26898
26980
  var AUTO_COMPACT_SINK_LISTENER_ID = "auto-compact-metrics-sink";
26899
26981
  var autoCompactSink = createAutoCompactMetricsSink();
@@ -27591,6 +27673,447 @@ function buildAutoCompactAggregationFields(params) {
27591
27673
  };
27592
27674
  }
27593
27675
 
27676
+ // src/utils/session/summarySanitizer.ts
27677
+ var REMINDER_TAG_REGEX = /<system-reminder>[\s\S]*?<\/system-reminder>/gi;
27678
+ var TOOL_PROGRESS_TAG_REGEX = /<tool-progress>[\s\S]*?<\/tool-progress>/gi;
27679
+ var LOCAL_STDOUT_TAG_REGEX = /<local-command-stdout>([\s\S]*?)<\/local-command-stdout>/gi;
27680
+ var LOCAL_STDERR_TAG_REGEX = /<local-command-stderr>([\s\S]*?)<\/local-command-stderr>/gi;
27681
+ var MAX_TOOL_USE_INPUT_LENGTH = 700;
27682
+ var MAX_TOOL_RESULT_CONTENT_LENGTH = 1400;
27683
+ var MAX_LOCAL_COMMAND_BODY_LENGTH = 700;
27684
+ var FAILURE_KEYWORDS = ["error", "failed", "exception", "denied", "not found"];
27685
+ var SUCCESS_KEYWORDS = ["success", "completed", "done", "saved", "updated"];
27686
+ var ACTION_KEYWORDS = ["create", "write", "edit", "delete", "search", "read", "run"];
27687
+ function countMatches(text, regex) {
27688
+ const matches2 = text.match(regex);
27689
+ return matches2 ? matches2.length : 0;
27690
+ }
27691
+ function cleanTextContent(text) {
27692
+ let output = text.replace(REMINDER_TAG_REGEX, "").replace(TOOL_PROGRESS_TAG_REGEX, "").trim();
27693
+ output = output.replace(LOCAL_STDOUT_TAG_REGEX, (_, body) => {
27694
+ return `<local-command-stdout>${truncateLocalCommandBody(body)}</local-command-stdout>`;
27695
+ });
27696
+ output = output.replace(LOCAL_STDERR_TAG_REGEX, (_, body) => {
27697
+ return `<local-command-stderr>${truncateLocalCommandBody(body)}</local-command-stderr>`;
27698
+ });
27699
+ return output;
27700
+ }
27701
+ function truncateLocalCommandBody(body) {
27702
+ const normalized = String(body ?? "");
27703
+ if (normalized.length <= MAX_LOCAL_COMMAND_BODY_LENGTH) {
27704
+ return normalized;
27705
+ }
27706
+ const lines = normalized.split("\n");
27707
+ const errorLines = lines.filter(
27708
+ (line) => FAILURE_KEYWORDS.some((keyword) => line.toLowerCase().includes(keyword))
27709
+ ).slice(0, 2);
27710
+ const head = normalized.slice(0, 280);
27711
+ const tail = normalized.slice(-220);
27712
+ const errorSegment = errorLines.length > 0 ? `
27713
+ ${errorLines.join("\n")}
27714
+ ` : "\n";
27715
+ return `${head}
27716
+ ...[truncated]...${errorSegment}${tail}`;
27717
+ }
27718
+ function extractTextFromUnknownContent(content) {
27719
+ if (typeof content === "string") {
27720
+ return content;
27721
+ }
27722
+ if (Array.isArray(content)) {
27723
+ return content.map((block) => {
27724
+ if (typeof block === "string") {
27725
+ return block;
27726
+ }
27727
+ if (!block || typeof block !== "object") {
27728
+ return "";
27729
+ }
27730
+ const record = block;
27731
+ if (typeof record.text === "string") {
27732
+ return record.text;
27733
+ }
27734
+ if (typeof record.content === "string") {
27735
+ return record.content;
27736
+ }
27737
+ return "";
27738
+ }).filter(Boolean).join("\n");
27739
+ }
27740
+ return "";
27741
+ }
27742
+ function inferStatus(rawText, isErrorFlag) {
27743
+ if (isErrorFlag) {
27744
+ return "failed";
27745
+ }
27746
+ const lower = rawText.toLowerCase();
27747
+ if (FAILURE_KEYWORDS.some((keyword) => lower.includes(keyword))) {
27748
+ return "failed";
27749
+ }
27750
+ if (SUCCESS_KEYWORDS.some((keyword) => lower.includes(keyword))) {
27751
+ return "success";
27752
+ }
27753
+ return "unknown";
27754
+ }
27755
+ function extractTargets(rawText) {
27756
+ const matches2 = rawText.match(
27757
+ /https?:\/\/[^\s]+|[A-Za-z]:\\[^\s]+|\/[^\s]+|[A-Za-z0-9._/-]+\.(ts|tsx|js|jsx|json|md|py|go|rs|java|yml|yaml)/gi
27758
+ );
27759
+ if (!matches2) {
27760
+ return [];
27761
+ }
27762
+ const unique = Array.from(new Set(matches2.map((item) => item.trim())));
27763
+ return unique.slice(0, 5);
27764
+ }
27765
+ function extractKeyFacts(rawText) {
27766
+ const lines = rawText.split("\n").map((line) => line.trim()).filter(Boolean);
27767
+ const facts = lines.filter(
27768
+ (line) => ACTION_KEYWORDS.some((keyword) => line.toLowerCase().includes(keyword))
27769
+ );
27770
+ const picked = facts.length > 0 ? facts : lines.slice(0, 3);
27771
+ return picked.slice(0, 5);
27772
+ }
27773
+ function extractErrors(rawText) {
27774
+ const lines = rawText.split("\n").map((line) => line.trim()).filter(Boolean);
27775
+ return lines.filter(
27776
+ (line) => FAILURE_KEYWORDS.some((keyword) => line.toLowerCase().includes(keyword))
27777
+ ).slice(0, 3);
27778
+ }
27779
+ function truncateText(text, maxLength) {
27780
+ if (text.length <= maxLength) {
27781
+ return { text, truncated: false };
27782
+ }
27783
+ const head = text.slice(0, Math.floor(maxLength * 0.55));
27784
+ const tail = text.slice(-Math.floor(maxLength * 0.25));
27785
+ return { text: `${head}
27786
+ ...[truncated]...
27787
+ ${tail}`, truncated: true };
27788
+ }
27789
+ function sanitizeToolUseBlock(block) {
27790
+ const id = block.id;
27791
+ const name3 = block.name;
27792
+ const rawInput = block.input;
27793
+ const inputSummary = truncateText(JSON.stringify(rawInput ?? {}), MAX_TOOL_USE_INPUT_LENGTH);
27794
+ return {
27795
+ type: block.type,
27796
+ id,
27797
+ name: name3,
27798
+ input: {
27799
+ _summary: inputSummary.text,
27800
+ _truncated: inputSummary.truncated
27801
+ }
27802
+ };
27803
+ }
27804
+ function sanitizeToolResultBlock(block) {
27805
+ const rawText = cleanTextContent(extractTextFromUnknownContent(block.content));
27806
+ const status = inferStatus(rawText, Boolean(block.is_error));
27807
+ const targets = extractTargets(rawText);
27808
+ const keyFacts = extractKeyFacts(rawText);
27809
+ const errors = extractErrors(rawText);
27810
+ const evidenceRaw = [rawText.split("\n")[0] ?? "", ...errors.length > 0 ? errors : []].map((line) => line.trim()).filter(Boolean).slice(0, 6);
27811
+ const formatted = [
27812
+ `status: ${status}`,
27813
+ targets.length > 0 ? `targets: ${targets.join(" | ")}` : "targets: none",
27814
+ keyFacts.length > 0 ? `keyFacts: ${keyFacts.join(" | ")}` : "keyFacts: none",
27815
+ errors.length > 0 ? `errors: ${errors.join(" | ")}` : "errors: none",
27816
+ evidenceRaw.length > 0 ? `evidence: ${evidenceRaw.join(" | ")}` : "evidence: none"
27817
+ ].join("\n");
27818
+ const truncated = truncateText(formatted, MAX_TOOL_RESULT_CONTENT_LENGTH);
27819
+ const wasRawTruncated = rawText.length > MAX_TOOL_RESULT_CONTENT_LENGTH;
27820
+ const content = `${truncated.text}
27821
+ truncated: ${truncated.truncated || wasRawTruncated}`;
27822
+ return {
27823
+ ...block,
27824
+ content
27825
+ };
27826
+ }
27827
+ function sanitizeBlock(block) {
27828
+ if (!block || typeof block !== "object") {
27829
+ return { value: block, changed: false };
27830
+ }
27831
+ const record = block;
27832
+ const type3 = String(record.type ?? "");
27833
+ if (type3 === "tool_use" || type3 === "server_tool_use" || type3 === "mcp_tool_use") {
27834
+ return { value: sanitizeToolUseBlock(record), changed: true };
27835
+ }
27836
+ if (type3 === "tool_result") {
27837
+ return { value: sanitizeToolResultBlock(record), changed: true };
27838
+ }
27839
+ if (typeof record.text === "string") {
27840
+ const nextText = cleanTextContent(record.text);
27841
+ if (nextText === record.text) {
27842
+ return { value: record, changed: false };
27843
+ }
27844
+ return {
27845
+ value: {
27846
+ ...record,
27847
+ text: nextText
27848
+ },
27849
+ changed: true
27850
+ };
27851
+ }
27852
+ if (typeof record.content === "string") {
27853
+ const nextContent = cleanTextContent(record.content);
27854
+ if (nextContent === record.content) {
27855
+ return { value: record, changed: false };
27856
+ }
27857
+ return {
27858
+ value: {
27859
+ ...record,
27860
+ content: nextContent
27861
+ },
27862
+ changed: true
27863
+ };
27864
+ }
27865
+ return { value: record, changed: false };
27866
+ }
27867
+ function sanitizeForCompactionSummaryWithReport(messages) {
27868
+ let changedMessages = 0;
27869
+ let removedReminderTags = 0;
27870
+ let removedToolProgressTags = 0;
27871
+ return messages.map((message) => {
27872
+ const rawContent = message?.message?.content;
27873
+ let nextContent = rawContent;
27874
+ let changed = false;
27875
+ if (typeof rawContent === "string") {
27876
+ removedReminderTags += countMatches(rawContent, REMINDER_TAG_REGEX);
27877
+ removedToolProgressTags += countMatches(rawContent, TOOL_PROGRESS_TAG_REGEX);
27878
+ const cleaned = cleanTextContent(rawContent);
27879
+ nextContent = cleaned;
27880
+ changed = cleaned !== rawContent;
27881
+ } else if (Array.isArray(rawContent)) {
27882
+ const sanitizedBlocks = rawContent.map((block) => {
27883
+ if (block && typeof block === "object") {
27884
+ const record = block;
27885
+ const rawText = typeof record.text === "string" ? record.text : typeof record.content === "string" ? record.content : "";
27886
+ if (rawText.length > 0) {
27887
+ removedReminderTags += countMatches(rawText, REMINDER_TAG_REGEX);
27888
+ removedToolProgressTags += countMatches(rawText, TOOL_PROGRESS_TAG_REGEX);
27889
+ }
27890
+ }
27891
+ return sanitizeBlock(block);
27892
+ });
27893
+ changed = sanitizedBlocks.some((item) => item.changed);
27894
+ nextContent = sanitizedBlocks.map((item) => item.value);
27895
+ }
27896
+ if (!changed) {
27897
+ return message;
27898
+ }
27899
+ changedMessages += 1;
27900
+ return {
27901
+ ...message,
27902
+ message: {
27903
+ ...message.message,
27904
+ content: nextContent
27905
+ }
27906
+ };
27907
+ }).reduce(
27908
+ (acc, message) => {
27909
+ acc.messages.push(message);
27910
+ return acc;
27911
+ },
27912
+ {
27913
+ messages: [],
27914
+ report: {
27915
+ changedMessages,
27916
+ removedReminderTags,
27917
+ removedToolProgressTags
27918
+ }
27919
+ }
27920
+ );
27921
+ }
27922
+
27923
+ // src/utils/session/compactionBudget.ts
27924
+ var DEFAULT_TOTAL_BUDGET_TOKENS = 12e3;
27925
+ var DEFAULT_SUMMARY_RATIO = 0.45;
27926
+ var DEFAULT_CONVERSATION_RATIO = 0.2;
27927
+ var DEFAULT_RECOVERED_RATIO = 0.35;
27928
+ var RECOVERED_FILE_MARKER = "**Recovered File:";
27929
+ function estimateTokens(text) {
27930
+ return Math.max(1, Math.ceil(text.length * 0.25));
27931
+ }
27932
+ function getMessageText(message) {
27933
+ const content = message?.message?.content;
27934
+ if (typeof content === "string") {
27935
+ return content;
27936
+ }
27937
+ if (Array.isArray(content)) {
27938
+ return content.map((block) => {
27939
+ if (!block || typeof block !== "object") {
27940
+ return "";
27941
+ }
27942
+ const record = block;
27943
+ if (typeof record.text === "string") {
27944
+ return record.text;
27945
+ }
27946
+ if (typeof record.content === "string") {
27947
+ return record.content;
27948
+ }
27949
+ return "";
27950
+ }).filter(Boolean).join("\n");
27951
+ }
27952
+ return "";
27953
+ }
27954
+ function setMessageText(message, text) {
27955
+ return {
27956
+ ...message,
27957
+ message: {
27958
+ ...message.message,
27959
+ content: text
27960
+ }
27961
+ };
27962
+ }
27963
+ function isRecoveredMessage(message) {
27964
+ return message.type === "user" && getMessageText(message).includes(RECOVERED_FILE_MARKER);
27965
+ }
27966
+ function isConversationSummaryMessage(message) {
27967
+ if (message.type !== "assistant") return false;
27968
+ const text = getMessageText(message);
27969
+ return text.includes("<conversation-summary>");
27970
+ }
27971
+ function findCompactionSummaryIndex(messages) {
27972
+ return messages.findIndex(
27973
+ (message) => message.type === "assistant" && Boolean(message?.compaction?.type === "compaction")
27974
+ );
27975
+ }
27976
+ function truncatePreservingSignals(text, maxChars, keywords) {
27977
+ if (text.length <= maxChars) {
27978
+ return { text, truncated: false };
27979
+ }
27980
+ const lines = text.split("\n");
27981
+ const signalLines = lines.filter(
27982
+ (line) => keywords.some((keyword) => line.toLowerCase().includes(keyword))
27983
+ );
27984
+ const head = text.slice(0, Math.max(200, Math.floor(maxChars * 0.55)));
27985
+ const tail = text.slice(-Math.max(120, Math.floor(maxChars * 0.2)));
27986
+ const middle = signalLines.slice(0, 4).join("\n");
27987
+ const rebuilt = `${head}
27988
+ ...[budget-truncated]...
27989
+ ${middle}
27990
+ ${tail}`;
27991
+ return {
27992
+ text: rebuilt.slice(0, maxChars),
27993
+ truncated: true
27994
+ };
27995
+ }
27996
+ function computeCurrentTokens(messages) {
27997
+ return messages.reduce((sum, message) => sum + estimateTokens(getMessageText(message)), 0);
27998
+ }
27999
+ function applyCompactionBudget(compactedMessages, config2 = {}) {
28000
+ const totalBudgetTokens = config2.totalBudgetTokens ?? DEFAULT_TOTAL_BUDGET_TOKENS;
28001
+ const summaryRatio = config2.summaryRatio ?? DEFAULT_SUMMARY_RATIO;
28002
+ const conversationRatio = config2.conversationSummaryRatio ?? DEFAULT_CONVERSATION_RATIO;
28003
+ const recoveredRatio = config2.recoveredRatio ?? DEFAULT_RECOVERED_RATIO;
28004
+ const summaryBudgetTokens = Math.max(60, Math.floor(totalBudgetTokens * summaryRatio));
28005
+ const conversationBudgetTokens = Math.max(
28006
+ 40,
28007
+ Math.floor(totalBudgetTokens * conversationRatio)
28008
+ );
28009
+ const recoveredBudgetTokens = Math.max(40, Math.floor(totalBudgetTokens * recoveredRatio));
28010
+ const beforeTokens = computeCurrentTokens(compactedMessages);
28011
+ if (beforeTokens <= totalBudgetTokens) {
28012
+ return {
28013
+ messages: compactedMessages,
28014
+ report: {
28015
+ applied: false,
28016
+ beforeTokens,
28017
+ afterTokens: beforeTokens,
28018
+ budgetTokens: totalBudgetTokens,
28019
+ steps: []
28020
+ }
28021
+ };
28022
+ }
28023
+ const messages = [...compactedMessages];
28024
+ const steps = [];
28025
+ const recoveredIndices = messages.map((message, index) => ({ message, index })).filter((item) => isRecoveredMessage(item.message)).map((item) => item.index);
28026
+ if (recoveredIndices.length > 0) {
28027
+ let recoveredTokens = recoveredIndices.reduce(
28028
+ (sum, index) => sum + estimateTokens(getMessageText(messages[index])),
28029
+ 0
28030
+ );
28031
+ for (const index of recoveredIndices) {
28032
+ if (recoveredTokens <= recoveredBudgetTokens) {
28033
+ break;
28034
+ }
28035
+ const text = getMessageText(messages[index]);
28036
+ const next = truncatePreservingSignals(
28037
+ text,
28038
+ Math.max(240, Math.floor(recoveredBudgetTokens * 2.2)),
28039
+ ["error", "failed", "warning", "truncated"]
28040
+ );
28041
+ messages[index] = setMessageText(messages[index], next.text);
28042
+ recoveredTokens = recoveredIndices.reduce(
28043
+ (sum, itemIndex) => sum + estimateTokens(getMessageText(messages[itemIndex])),
28044
+ 0
28045
+ );
28046
+ }
28047
+ while (recoveredIndices.length > 1 && recoveredIndices.reduce(
28048
+ (sum, index) => sum + estimateTokens(getMessageText(messages[index])),
28049
+ 0
28050
+ ) > recoveredBudgetTokens) {
28051
+ const dropIndex = recoveredIndices.pop();
28052
+ if (dropIndex === void 0) break;
28053
+ messages.splice(dropIndex, 1);
28054
+ for (let i = 0; i < recoveredIndices.length; i += 1) {
28055
+ if (recoveredIndices[i] > dropIndex) {
28056
+ recoveredIndices[i] -= 1;
28057
+ }
28058
+ }
28059
+ }
28060
+ steps.push("recovered");
28061
+ }
28062
+ const conversationIndex = messages.findIndex(
28063
+ (message) => isConversationSummaryMessage(message)
28064
+ );
28065
+ if (conversationIndex >= 0) {
28066
+ const text = getMessageText(messages[conversationIndex]);
28067
+ const allowedChars = Math.max(200, Math.floor(conversationBudgetTokens * 3.5));
28068
+ const trimmed = truncatePreservingSignals(text, allowedChars, [
28069
+ "task",
28070
+ "decision",
28071
+ "error",
28072
+ "status"
28073
+ ]);
28074
+ if (trimmed.truncated) {
28075
+ messages[conversationIndex] = setMessageText(messages[conversationIndex], trimmed.text);
28076
+ steps.push("conversation-summary");
28077
+ }
28078
+ }
28079
+ const summaryIndex = findCompactionSummaryIndex(messages);
28080
+ if (summaryIndex >= 0) {
28081
+ const text = getMessageText(messages[summaryIndex]);
28082
+ const allowedChars = Math.max(240, Math.floor(summaryBudgetTokens * 3.5));
28083
+ const trimmed = truncatePreservingSignals(text, allowedChars, [
28084
+ "error",
28085
+ "failed",
28086
+ "decision",
28087
+ "current status",
28088
+ "pending"
28089
+ ]);
28090
+ if (trimmed.truncated) {
28091
+ messages[summaryIndex] = setMessageText(messages[summaryIndex], trimmed.text);
28092
+ steps.push("summary");
28093
+ }
28094
+ }
28095
+ let afterTokens = computeCurrentTokens(messages);
28096
+ while (afterTokens > totalBudgetTokens) {
28097
+ const lastRecovered = messages.map((message, index) => ({ message, index })).filter((item) => isRecoveredMessage(item.message)).map((item) => item.index).pop();
28098
+ if (lastRecovered === void 0) {
28099
+ break;
28100
+ }
28101
+ messages.splice(lastRecovered, 1);
28102
+ steps.push("recovered-drop");
28103
+ afterTokens = computeCurrentTokens(messages);
28104
+ }
28105
+ return {
28106
+ messages,
28107
+ report: {
28108
+ applied: true,
28109
+ beforeTokens,
28110
+ afterTokens: computeCurrentTokens(messages),
28111
+ budgetTokens: totalBudgetTokens,
28112
+ steps: Array.from(new Set(steps))
28113
+ }
28114
+ };
28115
+ }
28116
+
27594
28117
  // src/utils/session/autoCompactCore.ts
27595
28118
  async function getMainConversationContextLimit() {
27596
28119
  try {
@@ -27633,7 +28156,7 @@ Important technical decisions made and their rationale. Alternative approaches c
27633
28156
 
27634
28157
  Focus on information essential for continuing the conversation effectively, including specific details about code, files, errors, and plans.`;
27635
28158
  var AUTO_COMPACT_NOTICE = "Context automatically compressed due to token limit.";
27636
- var RECOVERED_FILE_MARKER = "**Recovered File:";
28159
+ var RECOVERED_FILE_MARKER2 = "**Recovered File:";
27637
28160
  var CONVERSATION_SUMMARY_LIMITS = {
27638
28161
  maxEntries: 10,
27639
28162
  maxEntryChars: 80,
@@ -27644,7 +28167,7 @@ var AUTO_COMPACT_CHAIN_RETRY_DELAY_MS = 250;
27644
28167
  function wait(ms) {
27645
28168
  return new Promise((resolve14) => setTimeout(resolve14, ms));
27646
28169
  }
27647
- function getMessageText(message) {
28170
+ function getMessageText2(message) {
27648
28171
  if (!message || typeof message !== "object") return null;
27649
28172
  if (message.type !== "user" && message.type !== "assistant") return null;
27650
28173
  const content = message.message?.content;
@@ -27654,13 +28177,13 @@ function getMessageText(message) {
27654
28177
  }
27655
28178
  function isAutoCompactNotice(message) {
27656
28179
  if (message.type !== "user") return false;
27657
- const text = getMessageText(message);
28180
+ const text = getMessageText2(message);
27658
28181
  return Boolean(text && text.includes(AUTO_COMPACT_NOTICE));
27659
28182
  }
27660
28183
  function isRecoveredFileMessage(message) {
27661
28184
  if (message.type !== "user") return false;
27662
- const text = getMessageText(message);
27663
- return Boolean(text && text.includes(RECOVERED_FILE_MARKER));
28185
+ const text = getMessageText2(message);
28186
+ return Boolean(text && text.includes(RECOVERED_FILE_MARKER2));
27664
28187
  }
27665
28188
  function stripLeadingRecoveredFiles(messages) {
27666
28189
  let index = 0;
@@ -27674,7 +28197,7 @@ function findLatestAutoCompactSummary(messages) {
27674
28197
  if (!isAutoCompactNotice(messages[i])) continue;
27675
28198
  for (let j = i + 1; j < messages.length; j += 1) {
27676
28199
  if (messages[j].type !== "assistant") continue;
27677
- const summaryText = getMessageText(messages[j]);
28200
+ const summaryText = getMessageText2(messages[j]);
27678
28201
  if (summaryText && summaryText.trim().length > 0) {
27679
28202
  return { summaryText, summaryIndex: j };
27680
28203
  }
@@ -27683,6 +28206,29 @@ function findLatestAutoCompactSummary(messages) {
27683
28206
  }
27684
28207
  return null;
27685
28208
  }
28209
+ function collectCompactionInputText(messages) {
28210
+ return messages.map((item) => getMessageText2(item) ?? "").filter(Boolean).join("\n");
28211
+ }
28212
+ function containsAny(text, keywords) {
28213
+ const lower = text.toLowerCase();
28214
+ return keywords.some((keyword) => lower.includes(keyword));
28215
+ }
28216
+ function computeSummaryQualitySignals(sourceText, summaryText) {
28217
+ const resultKeywords = ["created", "updated", "deleted", "found", "success", "completed"];
28218
+ const errorKeywords = ["error", "failed", "exception", "denied", "not found"];
28219
+ const hasResultInput = containsAny(sourceText, resultKeywords);
28220
+ const hasResultSummary = containsAny(summaryText, resultKeywords);
28221
+ const hasErrorInput = containsAny(sourceText, errorKeywords);
28222
+ const hasErrorSummary = containsAny(summaryText, errorKeywords);
28223
+ const taskGoalRetained = containsAny(summaryText, ["task", "goal", "next", "pending", "status"]);
28224
+ return {
28225
+ hasResultInput,
28226
+ hasResultSummary,
28227
+ hasErrorInput,
28228
+ hasErrorSummary,
28229
+ taskGoalRetained
28230
+ };
28231
+ }
27686
28232
  async function calculateThresholds(tokenCount) {
27687
28233
  const contextLimit = await getMainConversationContextLimit();
27688
28234
  return calculateAutoCompactThresholds(tokenCount, contextLimit);
@@ -27855,7 +28401,15 @@ Update and consolidate it using only the recent messages provided. Avoid repeati
27855
28401
 
27856
28402
  ${COMPRESSION_PROMPT2}` : COMPRESSION_PROMPT2;
27857
28403
  const messagesForSummary = previousSummary ? stripLeadingRecoveredFiles(messages.slice(previousSummary.summaryIndex + 1)) : messages;
28404
+ const sanitizerResult = sanitizeForCompactionSummaryWithReport(messagesForSummary);
28405
+ const sanitizedMessagesForSummary = sanitizerResult.messages;
28406
+ emitAutoCompactTelemetryEvent("AUTO_COMPACT_SANITIZER_APPLIED", {
28407
+ changedMessages: sanitizerResult.report.changedMessages,
28408
+ removedReminderTags: sanitizerResult.report.removedReminderTags,
28409
+ removedToolProgressTags: sanitizerResult.report.removedToolProgressTags
28410
+ });
27858
28411
  const summaryRequest = createUserMessage(summaryRequestContent);
28412
+ const compactionSourceText = collectCompactionInputText(sanitizedMessagesForSummary);
27859
28413
  const tokenCount = countTokens(messages);
27860
28414
  const modelManager = getModelManager();
27861
28415
  const compactResolution = modelManager.resolveModelWithInfo("compact");
@@ -27887,7 +28441,10 @@ ${COMPRESSION_PROMPT2}` : COMPRESSION_PROMPT2;
27887
28441
  attempts += 1;
27888
28442
  try {
27889
28443
  const summaryCandidate = await queryLLM(
27890
- normalizeMessagesForAPI([...messagesForSummary, summaryRequest]),
28444
+ normalizeMessagesForAPI([
28445
+ ...sanitizedMessagesForSummary,
28446
+ summaryRequest
28447
+ ]),
27891
28448
  [
27892
28449
  "You are a helpful AI assistant tasked with creating comprehensive conversation summaries that preserve all essential context for continuing development work."
27893
28450
  ],
@@ -27974,6 +28531,9 @@ ${COMPRESSION_PROMPT2}` : COMPRESSION_PROMPT2;
27974
28531
  );
27975
28532
  }
27976
28533
  summaryResponse = summaryCandidate;
28534
+ emitAutoCompactTelemetryEvent("AUTO_COMPACT_SUMMARY_QUALITY", {
28535
+ ...computeSummaryQualitySignals(compactionSourceText, summary)
28536
+ });
27977
28537
  break;
27978
28538
  } catch (error) {
27979
28539
  const classified = classifyAutoCompactFailure(error);
@@ -28110,7 +28670,21 @@ ${contentWithLines}
28110
28670
  flushTypedPartBuffer({ requestId: typedRequestId });
28111
28671
  } catch {
28112
28672
  }
28113
- return compactedMessages;
28673
+ const budgetApplied = applyCompactionBudget(
28674
+ compactedMessages,
28675
+ toolUseContext?.compactionBudgetConfig
28676
+ );
28677
+ if (budgetApplied.report.applied) {
28678
+ const payload = {
28679
+ beforeTokens: budgetApplied.report.beforeTokens,
28680
+ afterTokens: budgetApplied.report.afterTokens,
28681
+ budgetTokens: budgetApplied.report.budgetTokens,
28682
+ steps: budgetApplied.report.steps
28683
+ };
28684
+ debug.warn("AUTO_COMPACT_BUDGET_APPLIED", payload);
28685
+ emitAutoCompactTelemetryEvent("AUTO_COMPACT_BUDGET_APPLIED", payload);
28686
+ }
28687
+ return budgetApplied.messages;
28114
28688
  }
28115
28689
 
28116
28690
  // src/services/telemetry/autoCompactTelemetryPersistence.ts
@@ -30308,7 +30882,7 @@ import { homedir as homedir8 } from "os";
30308
30882
  // src/commands/agents/generation.ts
30309
30883
  import { randomUUID as randomUUID6 } from "crypto";
30310
30884
  async function generateAgentWithClaude(prompt) {
30311
- const { queryModel } = await import("./llm-FFB2I7QL.js");
30885
+ const { queryModel } = await import("./llm-BV3ZXLUQ.js");
30312
30886
  const systemPrompt = `You are an expert at creating AI agent configurations. Based on the user's description, generate a specialized agent configuration.
30313
30887
 
30314
30888
  Return your response as a JSON object with exactly these fields:
@@ -34111,6 +34685,8 @@ export {
34111
34685
  FileWriteTool,
34112
34686
  GlobTool,
34113
34687
  GrepTool,
34688
+ buildTaskAsyncPolicy,
34689
+ TASK_FORK_CONTEXT_POLICY,
34114
34690
  WebSearchTool,
34115
34691
  SlashCommandTool,
34116
34692
  SkillTool,