pybao-cli 1.5.2 → 1.5.4

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-MBDNDVDD.js +49 -0
  2. package/dist/{acp-DXLDM2M4.js → acp-IRGLAUUJ.js} +30 -30
  3. package/dist/{agentsValidate-MBFWR6QL.js → agentsValidate-JBJJ2EH7.js} +7 -7
  4. package/dist/{ask-F626S4ZT.js → ask-WKLLFN55.js} +29 -29
  5. package/dist/{autoUpdater-DWURNXYL.js → autoUpdater-UAC34Y6K.js} +3 -3
  6. package/dist/{chunk-6UZZ4RXH.js → chunk-2HK2IYZU.js} +1 -1
  7. package/dist/{chunk-TSKSA2Y4.js → chunk-6KR5MXW4.js} +3 -3
  8. package/dist/{chunk-3YUADJU7.js → chunk-A3NFY5TV.js} +2 -2
  9. package/dist/{chunk-GTH2GLM2.js → chunk-A3WIVAEQ.js} +644 -47
  10. package/dist/chunk-A3WIVAEQ.js.map +7 -0
  11. package/dist/{chunk-Y6F7IDHE.js → chunk-ATT3HCME.js} +3 -3
  12. package/dist/{chunk-TFOMEGLL.js → chunk-BJHBQUXH.js} +2 -2
  13. package/dist/{chunk-CTJBHXP7.js → chunk-BVJZ6435.js} +3 -3
  14. package/dist/{chunk-J6MYGZQL.js → chunk-G3SWBGWN.js} +20 -30
  15. package/dist/chunk-G3SWBGWN.js.map +7 -0
  16. package/dist/{chunk-XGHVVVMB.js → chunk-GL5OH6V4.js} +2 -2
  17. package/dist/{chunk-W4GPV4TG.js → chunk-GUBKR5CU.js} +3 -3
  18. package/dist/{chunk-GCA65KUK.js → chunk-H744C3MH.js} +3 -3
  19. package/dist/{chunk-NOEVDTYI.js → chunk-HCGBT46A.js} +4 -4
  20. package/dist/{chunk-WVJF2KNA.js → chunk-HLFRL66T.js} +3 -3
  21. package/dist/{chunk-DB3VA6G3.js → chunk-IQV3HS22.js} +1 -1
  22. package/dist/{chunk-FHWWNYDB.js → chunk-KG3TWGBU.js} +2 -2
  23. package/dist/{chunk-VC4UXX7K.js → chunk-LKJJGCDP.js} +1 -1
  24. package/dist/{chunk-66I7VWVN.js → chunk-M73XAOTH.js} +1 -1
  25. package/dist/{chunk-66I7VWVN.js.map → chunk-M73XAOTH.js.map} +1 -1
  26. package/dist/{chunk-5K6AFF6H.js → chunk-MBM5WCIY.js} +2 -2
  27. package/dist/{chunk-AZ2D6YSU.js → chunk-MWSQEKK6.js} +4 -4
  28. package/dist/{chunk-BIJXNPMG.js → chunk-PUBU44C2.js} +1 -1
  29. package/dist/{chunk-T5WL2NM6.js → chunk-Q64XH2HD.js} +1 -1
  30. package/dist/{chunk-KNPYA7XB.js → chunk-QJFAJORX.js} +2 -2
  31. package/dist/{chunk-PPCG7UIH.js → chunk-QMQYRYOJ.js} +1 -1
  32. package/dist/{chunk-YEUCIHU6.js → chunk-RHLNLOZP.js} +1 -1
  33. package/dist/{chunk-RAPAWNQM.js → chunk-RYALTDJI.js} +4 -4
  34. package/dist/{chunk-2JZ774IW.js → chunk-SNLXXBXP.js} +4 -4
  35. package/dist/{chunk-K4VCVAYN.js → chunk-TBZGYEDP.js} +3 -3
  36. package/dist/{chunk-HIDCDFMI.js → chunk-TI57KY6H.js} +1 -1
  37. package/dist/{chunk-56EHVEXV.js → chunk-U5AY65EA.js} +1 -1
  38. package/dist/{chunk-D5CO64XN.js → chunk-U76IVQIF.js} +1 -1
  39. package/dist/{chunk-HM57DLRI.js → chunk-XXDO6DFB.js} +2 -2
  40. package/dist/{cli-6D5EB2QO.js → cli-UUU72LBP.js} +89 -89
  41. package/dist/commands-HN4V6NUM.js +53 -0
  42. package/dist/{config-EBRTHXNO.js → config-SKKYAIQT.js} +4 -4
  43. package/dist/{context-NGUOVGLI.js → context-VC4F6CQH.js} +6 -6
  44. package/dist/{conversationTracker-RL4AR6AT.js → conversationTracker-2PRBUDU7.js} +3 -3
  45. package/dist/{customCommands-JBK5WMYM.js → customCommands-KFSKRLOR.js} +4 -4
  46. package/dist/{env-7JK5WQ6D.js → env-UXRNUTRY.js} +2 -2
  47. package/dist/{file-4VUV6TU7.js → file-YOLDPGAZ.js} +4 -4
  48. package/dist/index.js +3 -3
  49. package/dist/{llm-FFB2I7QL.js → llm-NNPSCVNC.js} +30 -30
  50. package/dist/{llmLazy-TD2AWFEQ.js → llmLazy-VFQBE4VQ.js} +1 -1
  51. package/dist/{loader-2K3HLM4L.js → loader-JLKU56P4.js} +4 -4
  52. package/dist/{lsp-B7KRNQHU.js → lsp-ODCSAM2C.js} +6 -6
  53. package/dist/{lspAnchor-YIYZHOHL.js → lspAnchor-DRPDOTNI.js} +6 -6
  54. package/dist/{mcp-IC4WIZKM.js → mcp-YNM5F6DI.js} +7 -7
  55. package/dist/{mentionProcessor-PER465QN.js → mentionProcessor-XE5YX3QF.js} +5 -5
  56. package/dist/{messages-LQ27CQTF.js → messages-S6CUVFAR.js} +1 -1
  57. package/dist/{model-XE7N4T23.js → model-XRNLQZ4O.js} +5 -5
  58. package/dist/{openai-STSXOBJK.js → openai-JAWY3TYO.js} +5 -5
  59. package/dist/{outputStyles-AHEDF77O.js → outputStyles-C2BALUUY.js} +4 -4
  60. package/dist/{pluginRuntime-KO3VBNQ4.js → pluginRuntime-S7J5ODQU.js} +6 -6
  61. package/dist/{pluginValidation-VY7XQ3NX.js → pluginValidation-QTKM6IXY.js} +6 -6
  62. package/dist/prompts-QVC7LLMH.js +55 -0
  63. package/dist/{pybAgentSessionLoad-I5HNNX7P.js → pybAgentSessionLoad-QONCGHTI.js} +4 -4
  64. package/dist/{pybAgentSessionResume-7Q3BLWXA.js → pybAgentSessionResume-2MIW4X3R.js} +4 -4
  65. package/dist/{pybAgentStreamJsonSession-7RVISZVF.js → pybAgentStreamJsonSession-7IBCTJCI.js} +1 -1
  66. package/dist/{pybHooks-RVK7YU3J.js → pybHooks-2FKUCMJD.js} +4 -4
  67. package/dist/query-HUTD7BSB.js +57 -0
  68. package/dist/{registry-ZQ2TH2OE.js → registry-OVP3MKFX.js} +5 -5
  69. package/dist/{ripgrep-Y6W4QA3Q.js → ripgrep-KOL5M55E.js} +3 -3
  70. package/dist/{skillMarketplace-NWL6FBJV.js → skillMarketplace-XXVBYC57.js} +3 -3
  71. package/dist/{state-OHGUHJMH.js → state-CVENJNIV.js} +2 -2
  72. package/dist/{theme-S3ODCAZQ.js → theme-CV36XY2J.js} +5 -5
  73. package/dist/{toolPermissionSettings-7U6ZLOWH.js → toolPermissionSettings-MBBYIXDA.js} +6 -6
  74. package/dist/tools-2UQZG6N5.js +54 -0
  75. package/dist/{userInput-RWBTW5QJ.js → userInput-JZQSTMJF.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-MBDNDVDD.js.map} +0 -0
  85. /package/dist/{acp-DXLDM2M4.js.map → acp-IRGLAUUJ.js.map} +0 -0
  86. /package/dist/{agentsValidate-MBFWR6QL.js.map → agentsValidate-JBJJ2EH7.js.map} +0 -0
  87. /package/dist/{ask-F626S4ZT.js.map → ask-WKLLFN55.js.map} +0 -0
  88. /package/dist/{autoUpdater-DWURNXYL.js.map → autoUpdater-UAC34Y6K.js.map} +0 -0
  89. /package/dist/{chunk-6UZZ4RXH.js.map → chunk-2HK2IYZU.js.map} +0 -0
  90. /package/dist/{chunk-TSKSA2Y4.js.map → chunk-6KR5MXW4.js.map} +0 -0
  91. /package/dist/{chunk-3YUADJU7.js.map → chunk-A3NFY5TV.js.map} +0 -0
  92. /package/dist/{chunk-Y6F7IDHE.js.map → chunk-ATT3HCME.js.map} +0 -0
  93. /package/dist/{chunk-TFOMEGLL.js.map → chunk-BJHBQUXH.js.map} +0 -0
  94. /package/dist/{chunk-CTJBHXP7.js.map → chunk-BVJZ6435.js.map} +0 -0
  95. /package/dist/{chunk-XGHVVVMB.js.map → chunk-GL5OH6V4.js.map} +0 -0
  96. /package/dist/{chunk-W4GPV4TG.js.map → chunk-GUBKR5CU.js.map} +0 -0
  97. /package/dist/{chunk-GCA65KUK.js.map → chunk-H744C3MH.js.map} +0 -0
  98. /package/dist/{chunk-NOEVDTYI.js.map → chunk-HCGBT46A.js.map} +0 -0
  99. /package/dist/{chunk-WVJF2KNA.js.map → chunk-HLFRL66T.js.map} +0 -0
  100. /package/dist/{chunk-DB3VA6G3.js.map → chunk-IQV3HS22.js.map} +0 -0
  101. /package/dist/{chunk-FHWWNYDB.js.map → chunk-KG3TWGBU.js.map} +0 -0
  102. /package/dist/{chunk-VC4UXX7K.js.map → chunk-LKJJGCDP.js.map} +0 -0
  103. /package/dist/{chunk-5K6AFF6H.js.map → chunk-MBM5WCIY.js.map} +0 -0
  104. /package/dist/{chunk-AZ2D6YSU.js.map → chunk-MWSQEKK6.js.map} +0 -0
  105. /package/dist/{chunk-BIJXNPMG.js.map → chunk-PUBU44C2.js.map} +0 -0
  106. /package/dist/{chunk-T5WL2NM6.js.map → chunk-Q64XH2HD.js.map} +0 -0
  107. /package/dist/{chunk-KNPYA7XB.js.map → chunk-QJFAJORX.js.map} +0 -0
  108. /package/dist/{chunk-PPCG7UIH.js.map → chunk-QMQYRYOJ.js.map} +0 -0
  109. /package/dist/{chunk-YEUCIHU6.js.map → chunk-RHLNLOZP.js.map} +0 -0
  110. /package/dist/{chunk-RAPAWNQM.js.map → chunk-RYALTDJI.js.map} +0 -0
  111. /package/dist/{chunk-2JZ774IW.js.map → chunk-SNLXXBXP.js.map} +0 -0
  112. /package/dist/{chunk-K4VCVAYN.js.map → chunk-TBZGYEDP.js.map} +0 -0
  113. /package/dist/{chunk-HIDCDFMI.js.map → chunk-TI57KY6H.js.map} +0 -0
  114. /package/dist/{chunk-56EHVEXV.js.map → chunk-U5AY65EA.js.map} +0 -0
  115. /package/dist/{chunk-D5CO64XN.js.map → chunk-U76IVQIF.js.map} +0 -0
  116. /package/dist/{chunk-HM57DLRI.js.map → chunk-XXDO6DFB.js.map} +0 -0
  117. /package/dist/{cli-6D5EB2QO.js.map → cli-UUU72LBP.js.map} +0 -0
  118. /package/dist/{commands-2DU75YYL.js.map → commands-HN4V6NUM.js.map} +0 -0
  119. /package/dist/{config-EBRTHXNO.js.map → config-SKKYAIQT.js.map} +0 -0
  120. /package/dist/{context-NGUOVGLI.js.map → context-VC4F6CQH.js.map} +0 -0
  121. /package/dist/{conversationTracker-RL4AR6AT.js.map → conversationTracker-2PRBUDU7.js.map} +0 -0
  122. /package/dist/{customCommands-JBK5WMYM.js.map → customCommands-KFSKRLOR.js.map} +0 -0
  123. /package/dist/{env-7JK5WQ6D.js.map → env-UXRNUTRY.js.map} +0 -0
  124. /package/dist/{file-4VUV6TU7.js.map → file-YOLDPGAZ.js.map} +0 -0
  125. /package/dist/{llm-FFB2I7QL.js.map → llm-NNPSCVNC.js.map} +0 -0
  126. /package/dist/{llmLazy-TD2AWFEQ.js.map → llmLazy-VFQBE4VQ.js.map} +0 -0
  127. /package/dist/{loader-2K3HLM4L.js.map → loader-JLKU56P4.js.map} +0 -0
  128. /package/dist/{lsp-B7KRNQHU.js.map → lsp-ODCSAM2C.js.map} +0 -0
  129. /package/dist/{lspAnchor-YIYZHOHL.js.map → lspAnchor-DRPDOTNI.js.map} +0 -0
  130. /package/dist/{mcp-IC4WIZKM.js.map → mcp-YNM5F6DI.js.map} +0 -0
  131. /package/dist/{mentionProcessor-PER465QN.js.map → mentionProcessor-XE5YX3QF.js.map} +0 -0
  132. /package/dist/{messages-LQ27CQTF.js.map → messages-S6CUVFAR.js.map} +0 -0
  133. /package/dist/{model-XE7N4T23.js.map → model-XRNLQZ4O.js.map} +0 -0
  134. /package/dist/{openai-STSXOBJK.js.map → openai-JAWY3TYO.js.map} +0 -0
  135. /package/dist/{outputStyles-AHEDF77O.js.map → outputStyles-C2BALUUY.js.map} +0 -0
  136. /package/dist/{pluginRuntime-KO3VBNQ4.js.map → pluginRuntime-S7J5ODQU.js.map} +0 -0
  137. /package/dist/{pluginValidation-VY7XQ3NX.js.map → pluginValidation-QTKM6IXY.js.map} +0 -0
  138. /package/dist/{prompts-YJPKJBGM.js.map → prompts-QVC7LLMH.js.map} +0 -0
  139. /package/dist/{pybAgentSessionLoad-I5HNNX7P.js.map → pybAgentSessionLoad-QONCGHTI.js.map} +0 -0
  140. /package/dist/{pybAgentSessionResume-7Q3BLWXA.js.map → pybAgentSessionResume-2MIW4X3R.js.map} +0 -0
  141. /package/dist/{pybAgentStreamJsonSession-7RVISZVF.js.map → pybAgentStreamJsonSession-7IBCTJCI.js.map} +0 -0
  142. /package/dist/{pybHooks-RVK7YU3J.js.map → pybHooks-2FKUCMJD.js.map} +0 -0
  143. /package/dist/{query-QBYPG3GI.js.map → query-HUTD7BSB.js.map} +0 -0
  144. /package/dist/{registry-ZQ2TH2OE.js.map → registry-OVP3MKFX.js.map} +0 -0
  145. /package/dist/{ripgrep-Y6W4QA3Q.js.map → ripgrep-KOL5M55E.js.map} +0 -0
  146. /package/dist/{skillMarketplace-NWL6FBJV.js.map → skillMarketplace-XXVBYC57.js.map} +0 -0
  147. /package/dist/{state-OHGUHJMH.js.map → state-CVENJNIV.js.map} +0 -0
  148. /package/dist/{theme-S3ODCAZQ.js.map → theme-CV36XY2J.js.map} +0 -0
  149. /package/dist/{toolPermissionSettings-7U6ZLOWH.js.map → toolPermissionSettings-MBBYIXDA.js.map} +0 -0
  150. /package/dist/{tools-LW5HBTH3.js.map → tools-2UQZG6N5.js.map} +0 -0
  151. /package/dist/{userInput-RWBTW5QJ.js.map → userInput-JZQSTMJF.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-PUBU44C2.js";
6
6
  import {
7
7
  formatValidationResult,
8
8
  validatePluginOrMarketplacePath
9
- } from "./chunk-WVJF2KNA.js";
9
+ } from "./chunk-HLFRL66T.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-U76IVQIF.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-U5AY65EA.js";
24
24
  import {
25
25
  appendSessionCustomTitleRecord,
26
26
  appendSessionJsonlFromMessage,
27
27
  appendSessionTagRecord
28
- } from "./chunk-3YUADJU7.js";
28
+ } from "./chunk-A3NFY5TV.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-H744C3MH.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-QJFAJORX.js";
50
50
  import {
51
51
  fetchCustomModels,
52
52
  getModelFeatures
53
- } from "./chunk-HM57DLRI.js";
53
+ } from "./chunk-XXDO6DFB.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-RYALTDJI.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-SNLXXBXP.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-2HK2IYZU.js";
89
89
  import {
90
90
  loadToolPermissionContextFromDisk,
91
91
  persistToolPermissionUpdateToDisk
92
- } from "./chunk-TSKSA2Y4.js";
92
+ } from "./chunk-6KR5MXW4.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-BJHBQUXH.js";
104
104
  import {
105
105
  clearAgentCache,
106
106
  getActiveAgents,
107
107
  getAgentByType,
108
108
  getAllAgents
109
- } from "./chunk-FHWWNYDB.js";
109
+ } from "./chunk-KG3TWGBU.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-IQV3HS22.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-MBM5WCIY.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-HCGBT46A.js";
181
181
  import {
182
182
  getSettingsFileCandidates,
183
183
  loadSettingsWithLegacyFallback,
184
184
  readSettingsFile
185
- } from "./chunk-VC4UXX7K.js";
185
+ } from "./chunk-LKJJGCDP.js";
186
186
  import {
187
187
  getCustomCommandDirectories,
188
188
  hasCustomCommands,
189
189
  loadCustomCommands,
190
190
  reloadCustomCommands
191
- } from "./chunk-XGHVVVMB.js";
191
+ } from "./chunk-GL5OH6V4.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-BVJZ6435.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-MWSQEKK6.js";
209
209
  import {
210
210
  getRipgrepPath,
211
211
  getRipgrepPolicyMode,
212
212
  resolveRipgrepPolicy,
213
213
  ripGrep
214
- } from "./chunk-PPCG7UIH.js";
214
+ } from "./chunk-QMQYRYOJ.js";
215
215
  import {
216
216
  getTheme
217
- } from "./chunk-HIDCDFMI.js";
217
+ } from "./chunk-TI57KY6H.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-GUBKR5CU.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-Q64XH2HD.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-RHLNLOZP.js";
281
281
  import {
282
282
  MACRO
283
- } from "./chunk-66I7VWVN.js";
283
+ } from "./chunk-M73XAOTH.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-NNPSCVNC.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-NNPSCVNC.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-DRPDOTNI.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-NNPSCVNC.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-S7J5ODQU.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-XRNLQZ4O.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-NNPSCVNC.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-CVENJNIV.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,
@@ -27641,10 +28164,11 @@ var CONVERSATION_SUMMARY_LIMITS = {
27641
28164
  };
27642
28165
  var MAX_COMPACTED_QUERY_IDS = 10;
27643
28166
  var AUTO_COMPACT_CHAIN_RETRY_DELAY_MS = 250;
28167
+ var MAX_DEBUG_SUMMARY_LOG_CHARS = 2400;
27644
28168
  function wait(ms) {
27645
28169
  return new Promise((resolve14) => setTimeout(resolve14, ms));
27646
28170
  }
27647
- function getMessageText(message) {
28171
+ function getMessageText2(message) {
27648
28172
  if (!message || typeof message !== "object") return null;
27649
28173
  if (message.type !== "user" && message.type !== "assistant") return null;
27650
28174
  const content = message.message?.content;
@@ -27654,13 +28178,13 @@ function getMessageText(message) {
27654
28178
  }
27655
28179
  function isAutoCompactNotice(message) {
27656
28180
  if (message.type !== "user") return false;
27657
- const text = getMessageText(message);
28181
+ const text = getMessageText2(message);
27658
28182
  return Boolean(text && text.includes(AUTO_COMPACT_NOTICE));
27659
28183
  }
27660
28184
  function isRecoveredFileMessage(message) {
27661
28185
  if (message.type !== "user") return false;
27662
- const text = getMessageText(message);
27663
- return Boolean(text && text.includes(RECOVERED_FILE_MARKER));
28186
+ const text = getMessageText2(message);
28187
+ return Boolean(text && text.includes(RECOVERED_FILE_MARKER2));
27664
28188
  }
27665
28189
  function stripLeadingRecoveredFiles(messages) {
27666
28190
  let index = 0;
@@ -27674,7 +28198,7 @@ function findLatestAutoCompactSummary(messages) {
27674
28198
  if (!isAutoCompactNotice(messages[i])) continue;
27675
28199
  for (let j = i + 1; j < messages.length; j += 1) {
27676
28200
  if (messages[j].type !== "assistant") continue;
27677
- const summaryText = getMessageText(messages[j]);
28201
+ const summaryText = getMessageText2(messages[j]);
27678
28202
  if (summaryText && summaryText.trim().length > 0) {
27679
28203
  return { summaryText, summaryIndex: j };
27680
28204
  }
@@ -27683,6 +28207,44 @@ function findLatestAutoCompactSummary(messages) {
27683
28207
  }
27684
28208
  return null;
27685
28209
  }
28210
+ function collectCompactionInputText(messages) {
28211
+ return messages.map((item) => getMessageText2(item) ?? "").filter(Boolean).join("\n");
28212
+ }
28213
+ function containsAny(text, keywords) {
28214
+ const lower = text.toLowerCase();
28215
+ return keywords.some((keyword) => lower.includes(keyword));
28216
+ }
28217
+ function computeSummaryQualitySignals(sourceText, summaryText) {
28218
+ const resultKeywords = ["created", "updated", "deleted", "found", "success", "completed"];
28219
+ const errorKeywords = ["error", "failed", "exception", "denied", "not found"];
28220
+ const hasResultInput = containsAny(sourceText, resultKeywords);
28221
+ const hasResultSummary = containsAny(summaryText, resultKeywords);
28222
+ const hasErrorInput = containsAny(sourceText, errorKeywords);
28223
+ const hasErrorSummary = containsAny(summaryText, errorKeywords);
28224
+ const taskGoalRetained = containsAny(summaryText, ["task", "goal", "next", "pending", "status"]);
28225
+ return {
28226
+ hasResultInput,
28227
+ hasResultSummary,
28228
+ hasErrorInput,
28229
+ hasErrorSummary,
28230
+ taskGoalRetained
28231
+ };
28232
+ }
28233
+ function buildSummaryDebugPreview(summary) {
28234
+ if (summary.length <= MAX_DEBUG_SUMMARY_LOG_CHARS) {
28235
+ return {
28236
+ summaryPreview: summary,
28237
+ summaryLength: summary.length,
28238
+ truncated: false
28239
+ };
28240
+ }
28241
+ return {
28242
+ summaryPreview: `${summary.slice(0, MAX_DEBUG_SUMMARY_LOG_CHARS)}
28243
+ ...[truncated]...`,
28244
+ summaryLength: summary.length,
28245
+ truncated: true
28246
+ };
28247
+ }
27686
28248
  async function calculateThresholds(tokenCount) {
27687
28249
  const contextLimit = await getMainConversationContextLimit();
27688
28250
  return calculateAutoCompactThresholds(tokenCount, contextLimit);
@@ -27855,7 +28417,15 @@ Update and consolidate it using only the recent messages provided. Avoid repeati
27855
28417
 
27856
28418
  ${COMPRESSION_PROMPT2}` : COMPRESSION_PROMPT2;
27857
28419
  const messagesForSummary = previousSummary ? stripLeadingRecoveredFiles(messages.slice(previousSummary.summaryIndex + 1)) : messages;
28420
+ const sanitizerResult = sanitizeForCompactionSummaryWithReport(messagesForSummary);
28421
+ const sanitizedMessagesForSummary = sanitizerResult.messages;
28422
+ emitAutoCompactTelemetryEvent("AUTO_COMPACT_SANITIZER_APPLIED", {
28423
+ changedMessages: sanitizerResult.report.changedMessages,
28424
+ removedReminderTags: sanitizerResult.report.removedReminderTags,
28425
+ removedToolProgressTags: sanitizerResult.report.removedToolProgressTags
28426
+ });
27858
28427
  const summaryRequest = createUserMessage(summaryRequestContent);
28428
+ const compactionSourceText = collectCompactionInputText(sanitizedMessagesForSummary);
27859
28429
  const tokenCount = countTokens(messages);
27860
28430
  const modelManager = getModelManager();
27861
28431
  const compactResolution = modelManager.resolveModelWithInfo("compact");
@@ -27887,7 +28457,10 @@ ${COMPRESSION_PROMPT2}` : COMPRESSION_PROMPT2;
27887
28457
  attempts += 1;
27888
28458
  try {
27889
28459
  const summaryCandidate = await queryLLM(
27890
- normalizeMessagesForAPI([...messagesForSummary, summaryRequest]),
28460
+ normalizeMessagesForAPI([
28461
+ ...sanitizedMessagesForSummary,
28462
+ summaryRequest
28463
+ ]),
27891
28464
  [
27892
28465
  "You are a helpful AI assistant tasked with creating comprehensive conversation summaries that preserve all essential context for continuing development work."
27893
28466
  ],
@@ -27974,6 +28547,14 @@ ${COMPRESSION_PROMPT2}` : COMPRESSION_PROMPT2;
27974
28547
  );
27975
28548
  }
27976
28549
  summaryResponse = summaryCandidate;
28550
+ debug.warn("AUTO_COMPACT_SUMMARY_GENERATED", {
28551
+ ...buildSummaryDebugPreview(summary),
28552
+ model: activeModelPointer,
28553
+ attempt: attempts
28554
+ });
28555
+ emitAutoCompactTelemetryEvent("AUTO_COMPACT_SUMMARY_QUALITY", {
28556
+ ...computeSummaryQualitySignals(compactionSourceText, summary)
28557
+ });
27977
28558
  break;
27978
28559
  } catch (error) {
27979
28560
  const classified = classifyAutoCompactFailure(error);
@@ -28110,7 +28691,21 @@ ${contentWithLines}
28110
28691
  flushTypedPartBuffer({ requestId: typedRequestId });
28111
28692
  } catch {
28112
28693
  }
28113
- return compactedMessages;
28694
+ const budgetApplied = applyCompactionBudget(
28695
+ compactedMessages,
28696
+ toolUseContext?.compactionBudgetConfig
28697
+ );
28698
+ if (budgetApplied.report.applied) {
28699
+ const payload = {
28700
+ beforeTokens: budgetApplied.report.beforeTokens,
28701
+ afterTokens: budgetApplied.report.afterTokens,
28702
+ budgetTokens: budgetApplied.report.budgetTokens,
28703
+ steps: budgetApplied.report.steps
28704
+ };
28705
+ debug.warn("AUTO_COMPACT_BUDGET_APPLIED", payload);
28706
+ emitAutoCompactTelemetryEvent("AUTO_COMPACT_BUDGET_APPLIED", payload);
28707
+ }
28708
+ return budgetApplied.messages;
28114
28709
  }
28115
28710
 
28116
28711
  // src/services/telemetry/autoCompactTelemetryPersistence.ts
@@ -30308,7 +30903,7 @@ import { homedir as homedir8 } from "os";
30308
30903
  // src/commands/agents/generation.ts
30309
30904
  import { randomUUID as randomUUID6 } from "crypto";
30310
30905
  async function generateAgentWithClaude(prompt) {
30311
- const { queryModel } = await import("./llm-FFB2I7QL.js");
30906
+ const { queryModel } = await import("./llm-NNPSCVNC.js");
30312
30907
  const systemPrompt = `You are an expert at creating AI agent configurations. Based on the user's description, generate a specialized agent configuration.
30313
30908
 
30314
30909
  Return your response as a JSON object with exactly these fields:
@@ -34111,6 +34706,8 @@ export {
34111
34706
  FileWriteTool,
34112
34707
  GlobTool,
34113
34708
  GrepTool,
34709
+ buildTaskAsyncPolicy,
34710
+ TASK_FORK_CONTEXT_POLICY,
34114
34711
  WebSearchTool,
34115
34712
  SlashCommandTool,
34116
34713
  SkillTool,