erosolar-cli 2.1.248 → 2.1.252

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 (470) hide show
  1. package/agents/general.rules.json +10 -133
  2. package/agents/general.rules.json.bak +278 -0
  3. package/agents/general.rules.json.bak2 +306 -0
  4. package/dist/bin/erosolar.js +9 -5
  5. package/dist/bin/erosolar.js.map +1 -1
  6. package/dist/capabilities/bidirectionalAuditCapability.d.ts +26 -0
  7. package/dist/capabilities/bidirectionalAuditCapability.d.ts.map +1 -0
  8. package/dist/capabilities/bidirectionalAuditCapability.js +44 -0
  9. package/dist/capabilities/bidirectionalAuditCapability.js.map +1 -0
  10. package/dist/capabilities/globCapability.d.ts +3 -6
  11. package/dist/capabilities/globCapability.d.ts.map +1 -1
  12. package/dist/capabilities/globCapability.js +6 -10
  13. package/dist/capabilities/globCapability.js.map +1 -1
  14. package/dist/capabilities/index.d.ts +1 -18
  15. package/dist/capabilities/index.d.ts.map +1 -1
  16. package/dist/capabilities/index.js +1 -18
  17. package/dist/capabilities/index.js.map +1 -1
  18. package/dist/capabilities/orchestrationCapability.d.ts +177 -3
  19. package/dist/capabilities/orchestrationCapability.d.ts.map +1 -1
  20. package/dist/capabilities/orchestrationCapability.js +1592 -85
  21. package/dist/capabilities/orchestrationCapability.js.map +1 -1
  22. package/dist/capabilities/searchCapability.d.ts +8 -2
  23. package/dist/capabilities/searchCapability.d.ts.map +1 -1
  24. package/dist/capabilities/searchCapability.js +11 -6
  25. package/dist/capabilities/searchCapability.js.map +1 -1
  26. package/dist/contracts/tools.schema.json +9 -133
  27. package/dist/core/agentOrchestrator.d.ts.map +1 -1
  28. package/dist/core/agentOrchestrator.js +18 -1
  29. package/dist/core/agentOrchestrator.js.map +1 -1
  30. package/dist/core/aiErrorFixer.d.ts +1 -14
  31. package/dist/core/aiErrorFixer.d.ts.map +1 -1
  32. package/dist/core/aiErrorFixer.js +51 -239
  33. package/dist/core/aiErrorFixer.js.map +1 -1
  34. package/dist/core/alphaZeroEngine.d.ts +16 -256
  35. package/dist/core/alphaZeroEngine.d.ts.map +1 -1
  36. package/dist/core/alphaZeroEngine.js +22 -513
  37. package/dist/core/alphaZeroEngine.js.map +1 -1
  38. package/dist/core/completeAttackOrchestrator.d.ts +102 -0
  39. package/dist/core/completeAttackOrchestrator.d.ts.map +1 -0
  40. package/dist/core/completeAttackOrchestrator.js +293 -0
  41. package/dist/core/completeAttackOrchestrator.js.map +1 -0
  42. package/dist/core/defensiveSecurityToolkit.d.ts +373 -0
  43. package/dist/core/defensiveSecurityToolkit.d.ts.map +1 -0
  44. package/dist/core/defensiveSecurityToolkit.js +1304 -0
  45. package/dist/core/defensiveSecurityToolkit.js.map +1 -0
  46. package/dist/core/errors/errorTypes.d.ts +30 -57
  47. package/dist/core/errors/errorTypes.d.ts.map +1 -1
  48. package/dist/core/errors/errorTypes.js +51 -228
  49. package/dist/core/errors/errorTypes.js.map +1 -1
  50. package/dist/core/errors/safetyValidator.d.ts +19 -3
  51. package/dist/core/errors/safetyValidator.d.ts.map +1 -1
  52. package/dist/core/errors/safetyValidator.js +33 -71
  53. package/dist/core/errors/safetyValidator.js.map +1 -1
  54. package/dist/core/failureRecovery.d.ts +4 -100
  55. package/dist/core/failureRecovery.d.ts.map +1 -1
  56. package/dist/core/failureRecovery.js +16 -440
  57. package/dist/core/failureRecovery.js.map +1 -1
  58. package/dist/core/intelligentTargetResearcher.d.ts +142 -0
  59. package/dist/core/intelligentTargetResearcher.d.ts.map +1 -0
  60. package/dist/core/intelligentTargetResearcher.js +367 -0
  61. package/dist/core/intelligentTargetResearcher.js.map +1 -0
  62. package/dist/core/intelligentTestFlows.d.ts +26 -107
  63. package/dist/core/intelligentTestFlows.d.ts.map +1 -1
  64. package/dist/core/intelligentTestFlows.js +15 -659
  65. package/dist/core/intelligentTestFlows.js.map +1 -1
  66. package/dist/core/learningPersistence.d.ts +45 -132
  67. package/dist/core/learningPersistence.d.ts.map +1 -1
  68. package/dist/core/learningPersistence.js +32 -463
  69. package/dist/core/learningPersistence.js.map +1 -1
  70. package/dist/core/metricsTracker.d.ts +22 -139
  71. package/dist/core/metricsTracker.d.ts.map +1 -1
  72. package/dist/core/metricsTracker.js +51 -241
  73. package/dist/core/metricsTracker.js.map +1 -1
  74. package/dist/core/performanceMonitor.d.ts +15 -109
  75. package/dist/core/performanceMonitor.d.ts.map +1 -1
  76. package/dist/core/performanceMonitor.js +27 -184
  77. package/dist/core/performanceMonitor.js.map +1 -1
  78. package/dist/core/resultVerification.d.ts +6 -100
  79. package/dist/core/resultVerification.d.ts.map +1 -1
  80. package/dist/core/resultVerification.js +31 -400
  81. package/dist/core/resultVerification.js.map +1 -1
  82. package/dist/core/selfEvolution.d.ts +32 -126
  83. package/dist/core/selfEvolution.d.ts.map +1 -1
  84. package/dist/core/selfEvolution.js +24 -967
  85. package/dist/core/selfEvolution.js.map +1 -1
  86. package/dist/core/selfImprovement.d.ts +50 -109
  87. package/dist/core/selfImprovement.d.ts.map +1 -1
  88. package/dist/core/selfImprovement.js +14 -689
  89. package/dist/core/selfImprovement.js.map +1 -1
  90. package/dist/core/sourceCodeManager.d.ts +89 -0
  91. package/dist/core/sourceCodeManager.d.ts.map +1 -0
  92. package/dist/core/sourceCodeManager.js +332 -0
  93. package/dist/core/sourceCodeManager.js.map +1 -0
  94. package/dist/core/unifiedOrchestrator.d.ts +88 -0
  95. package/dist/core/unifiedOrchestrator.d.ts.map +1 -0
  96. package/dist/core/unifiedOrchestrator.js +284 -0
  97. package/dist/core/unifiedOrchestrator.js.map +1 -0
  98. package/dist/core/userDefenseOrchestrator.d.ts +202 -0
  99. package/dist/core/userDefenseOrchestrator.d.ts.map +1 -0
  100. package/dist/core/userDefenseOrchestrator.js +1006 -0
  101. package/dist/core/userDefenseOrchestrator.js.map +1 -0
  102. package/dist/plugins/index.d.ts +1 -1
  103. package/dist/plugins/index.d.ts.map +1 -1
  104. package/dist/plugins/index.js +36 -26
  105. package/dist/plugins/index.js.map +1 -1
  106. package/dist/plugins/tools/bidirectionalAudit/bidirectionalAuditPlugin.d.ts +8 -0
  107. package/dist/plugins/tools/bidirectionalAudit/bidirectionalAuditPlugin.d.ts.map +1 -0
  108. package/dist/plugins/tools/bidirectionalAudit/bidirectionalAuditPlugin.js +17 -0
  109. package/dist/plugins/tools/bidirectionalAudit/bidirectionalAuditPlugin.js.map +1 -0
  110. package/dist/plugins/tools/nodeDefaults.d.ts +14 -0
  111. package/dist/plugins/tools/nodeDefaults.d.ts.map +1 -1
  112. package/dist/plugins/tools/nodeDefaults.js +17 -54
  113. package/dist/plugins/tools/nodeDefaults.js.map +1 -1
  114. package/dist/plugins/tools/orchestration/orchestrationPlugin.d.ts +9 -0
  115. package/dist/plugins/tools/orchestration/orchestrationPlugin.d.ts.map +1 -0
  116. package/dist/plugins/tools/orchestration/orchestrationPlugin.js +18 -0
  117. package/dist/plugins/tools/orchestration/orchestrationPlugin.js.map +1 -0
  118. package/dist/shell/interactiveShell.d.ts +101 -2
  119. package/dist/shell/interactiveShell.d.ts.map +1 -1
  120. package/dist/shell/interactiveShell.js +1041 -25
  121. package/dist/shell/interactiveShell.js.map +1 -1
  122. package/dist/tools/appleExposureTools.d.ts +108 -0
  123. package/dist/tools/appleExposureTools.d.ts.map +1 -0
  124. package/dist/tools/appleExposureTools.js +850 -0
  125. package/dist/tools/appleExposureTools.js.map +1 -0
  126. package/dist/tools/bidirectionalAuditTools.d.ts +104 -0
  127. package/dist/tools/bidirectionalAuditTools.d.ts.map +1 -0
  128. package/dist/tools/bidirectionalAuditTools.js +1280 -0
  129. package/dist/tools/bidirectionalAuditTools.js.map +1 -0
  130. package/dist/tools/defensiveSecurityTools.d.ts +152 -0
  131. package/dist/tools/defensiveSecurityTools.d.ts.map +1 -0
  132. package/dist/tools/defensiveSecurityTools.js +576 -0
  133. package/dist/tools/defensiveSecurityTools.js.map +1 -0
  134. package/dist/tools/forwardAttackChainTracer.d.ts +73 -0
  135. package/dist/tools/forwardAttackChainTracer.d.ts.map +1 -0
  136. package/dist/tools/forwardAttackChainTracer.js +604 -0
  137. package/dist/tools/forwardAttackChainTracer.js.map +1 -0
  138. package/dist/tools/localExplore.d.ts +12 -199
  139. package/dist/tools/localExplore.d.ts.map +1 -1
  140. package/dist/tools/localExplore.js +18 -1352
  141. package/dist/tools/localExplore.js.map +1 -1
  142. package/dist/tools/offensiveTransparencyTools.d.ts +188 -0
  143. package/dist/tools/offensiveTransparencyTools.d.ts.map +1 -0
  144. package/dist/tools/offensiveTransparencyTools.js +890 -0
  145. package/dist/tools/offensiveTransparencyTools.js.map +1 -0
  146. package/dist/tools/planningTools.d.ts +8 -17
  147. package/dist/tools/planningTools.d.ts.map +1 -1
  148. package/dist/tools/planningTools.js +31 -141
  149. package/dist/tools/planningTools.js.map +1 -1
  150. package/dist/tools/searchTools.d.ts +9 -0
  151. package/dist/tools/searchTools.d.ts.map +1 -1
  152. package/dist/tools/searchTools.js +305 -189
  153. package/dist/tools/searchTools.js.map +1 -1
  154. package/dist/tools/skillTools.d.ts +7 -5
  155. package/dist/tools/skillTools.d.ts.map +1 -1
  156. package/dist/tools/skillTools.js +13 -155
  157. package/dist/tools/skillTools.js.map +1 -1
  158. package/dist/tools/threatIntelligenceTools.d.ts +128 -0
  159. package/dist/tools/threatIntelligenceTools.d.ts.map +1 -0
  160. package/dist/tools/threatIntelligenceTools.js +712 -0
  161. package/dist/tools/threatIntelligenceTools.js.map +1 -0
  162. package/dist/ui/PromptController.d.ts +4 -0
  163. package/dist/ui/PromptController.d.ts.map +1 -1
  164. package/dist/ui/PromptController.js +32 -11
  165. package/dist/ui/PromptController.js.map +1 -1
  166. package/dist/ui/UnifiedUIRenderer.d.ts +36 -0
  167. package/dist/ui/UnifiedUIRenderer.d.ts.map +1 -1
  168. package/dist/ui/UnifiedUIRenderer.js +308 -43
  169. package/dist/ui/UnifiedUIRenderer.js.map +1 -1
  170. package/dist/ui/animatedStatus.d.ts +2 -0
  171. package/dist/ui/animatedStatus.d.ts.map +1 -1
  172. package/dist/ui/animatedStatus.js +36 -2
  173. package/dist/ui/animatedStatus.js.map +1 -1
  174. package/dist/ui/orchestration/StatusOrchestrator.d.ts +10 -0
  175. package/dist/ui/orchestration/StatusOrchestrator.d.ts.map +1 -1
  176. package/dist/ui/orchestration/StatusOrchestrator.js +36 -4
  177. package/dist/ui/orchestration/StatusOrchestrator.js.map +1 -1
  178. package/package.json +2 -2
  179. package/dist/capabilities/advancedTestGenerationCapability.d.ts +0 -17
  180. package/dist/capabilities/advancedTestGenerationCapability.d.ts.map +0 -1
  181. package/dist/capabilities/advancedTestGenerationCapability.js +0 -28
  182. package/dist/capabilities/advancedTestGenerationCapability.js.map +0 -1
  183. package/dist/capabilities/browserAutomationCapability.d.ts +0 -37
  184. package/dist/capabilities/browserAutomationCapability.d.ts.map +0 -1
  185. package/dist/capabilities/browserAutomationCapability.js +0 -49
  186. package/dist/capabilities/browserAutomationCapability.js.map +0 -1
  187. package/dist/capabilities/buildCapability.d.ts +0 -24
  188. package/dist/capabilities/buildCapability.d.ts.map +0 -1
  189. package/dist/capabilities/buildCapability.js +0 -25
  190. package/dist/capabilities/buildCapability.js.map +0 -1
  191. package/dist/capabilities/cloudCapability.d.ts +0 -13
  192. package/dist/capabilities/cloudCapability.d.ts.map +0 -1
  193. package/dist/capabilities/cloudCapability.js +0 -38
  194. package/dist/capabilities/cloudCapability.js.map +0 -1
  195. package/dist/capabilities/codeAnalysisCapability.d.ts +0 -13
  196. package/dist/capabilities/codeAnalysisCapability.d.ts.map +0 -1
  197. package/dist/capabilities/codeAnalysisCapability.js +0 -24
  198. package/dist/capabilities/codeAnalysisCapability.js.map +0 -1
  199. package/dist/capabilities/codeQualityCapability.d.ts +0 -13
  200. package/dist/capabilities/codeQualityCapability.d.ts.map +0 -1
  201. package/dist/capabilities/codeQualityCapability.js +0 -25
  202. package/dist/capabilities/codeQualityCapability.js.map +0 -1
  203. package/dist/capabilities/dependencySecurityCapability.d.ts +0 -13
  204. package/dist/capabilities/dependencySecurityCapability.d.ts.map +0 -1
  205. package/dist/capabilities/dependencySecurityCapability.js +0 -24
  206. package/dist/capabilities/dependencySecurityCapability.js.map +0 -1
  207. package/dist/capabilities/devCapability.d.ts +0 -13
  208. package/dist/capabilities/devCapability.d.ts.map +0 -1
  209. package/dist/capabilities/devCapability.js +0 -24
  210. package/dist/capabilities/devCapability.js.map +0 -1
  211. package/dist/capabilities/emailCapability.d.ts +0 -12
  212. package/dist/capabilities/emailCapability.d.ts.map +0 -1
  213. package/dist/capabilities/emailCapability.js +0 -22
  214. package/dist/capabilities/emailCapability.js.map +0 -1
  215. package/dist/capabilities/enhancedAnalysisCapability.d.ts +0 -13
  216. package/dist/capabilities/enhancedAnalysisCapability.d.ts.map +0 -1
  217. package/dist/capabilities/enhancedAnalysisCapability.js +0 -20
  218. package/dist/capabilities/enhancedAnalysisCapability.js.map +0 -1
  219. package/dist/capabilities/enhancedCodeIntelligenceCapability.d.ts +0 -17
  220. package/dist/capabilities/enhancedCodeIntelligenceCapability.d.ts.map +0 -1
  221. package/dist/capabilities/enhancedCodeIntelligenceCapability.js +0 -28
  222. package/dist/capabilities/enhancedCodeIntelligenceCapability.js.map +0 -1
  223. package/dist/capabilities/enhancedDevWorkflowCapability.d.ts +0 -17
  224. package/dist/capabilities/enhancedDevWorkflowCapability.d.ts.map +0 -1
  225. package/dist/capabilities/enhancedDevWorkflowCapability.js +0 -28
  226. package/dist/capabilities/enhancedDevWorkflowCapability.js.map +0 -1
  227. package/dist/capabilities/frontendTestingCapability.d.ts +0 -13
  228. package/dist/capabilities/frontendTestingCapability.d.ts.map +0 -1
  229. package/dist/capabilities/frontendTestingCapability.js +0 -28
  230. package/dist/capabilities/frontendTestingCapability.js.map +0 -1
  231. package/dist/capabilities/interactionCapability.d.ts +0 -12
  232. package/dist/capabilities/interactionCapability.d.ts.map +0 -1
  233. package/dist/capabilities/interactionCapability.js +0 -22
  234. package/dist/capabilities/interactionCapability.js.map +0 -1
  235. package/dist/capabilities/learnCapability.d.ts +0 -22
  236. package/dist/capabilities/learnCapability.d.ts.map +0 -1
  237. package/dist/capabilities/learnCapability.js +0 -37
  238. package/dist/capabilities/learnCapability.js.map +0 -1
  239. package/dist/capabilities/notebookCapability.d.ts +0 -17
  240. package/dist/capabilities/notebookCapability.d.ts.map +0 -1
  241. package/dist/capabilities/notebookCapability.js +0 -27
  242. package/dist/capabilities/notebookCapability.js.map +0 -1
  243. package/dist/capabilities/planningCapability.d.ts +0 -16
  244. package/dist/capabilities/planningCapability.d.ts.map +0 -1
  245. package/dist/capabilities/planningCapability.js +0 -26
  246. package/dist/capabilities/planningCapability.js.map +0 -1
  247. package/dist/capabilities/refactoringCapability.d.ts +0 -13
  248. package/dist/capabilities/refactoringCapability.d.ts.map +0 -1
  249. package/dist/capabilities/refactoringCapability.js +0 -25
  250. package/dist/capabilities/refactoringCapability.js.map +0 -1
  251. package/dist/capabilities/repoChecksCapability.d.ts +0 -10
  252. package/dist/capabilities/repoChecksCapability.d.ts.map +0 -1
  253. package/dist/capabilities/repoChecksCapability.js +0 -24
  254. package/dist/capabilities/repoChecksCapability.js.map +0 -1
  255. package/dist/capabilities/taskManagementCapability.d.ts +0 -12
  256. package/dist/capabilities/taskManagementCapability.d.ts.map +0 -1
  257. package/dist/capabilities/taskManagementCapability.js +0 -22
  258. package/dist/capabilities/taskManagementCapability.js.map +0 -1
  259. package/dist/capabilities/testingCapability.d.ts +0 -13
  260. package/dist/capabilities/testingCapability.d.ts.map +0 -1
  261. package/dist/capabilities/testingCapability.js +0 -25
  262. package/dist/capabilities/testingCapability.js.map +0 -1
  263. package/dist/capabilities/validationCapability.d.ts +0 -13
  264. package/dist/capabilities/validationCapability.d.ts.map +0 -1
  265. package/dist/capabilities/validationCapability.js +0 -24
  266. package/dist/capabilities/validationCapability.js.map +0 -1
  267. package/dist/capabilities/webCapability.d.ts +0 -12
  268. package/dist/capabilities/webCapability.d.ts.map +0 -1
  269. package/dist/capabilities/webCapability.js +0 -22
  270. package/dist/capabilities/webCapability.js.map +0 -1
  271. package/dist/core/deepBugAnalyzer.d.ts +0 -128
  272. package/dist/core/deepBugAnalyzer.d.ts.map +0 -1
  273. package/dist/core/deepBugAnalyzer.js +0 -406
  274. package/dist/core/deepBugAnalyzer.js.map +0 -1
  275. package/dist/core/hypothesisEngine.d.ts +0 -113
  276. package/dist/core/hypothesisEngine.d.ts.map +0 -1
  277. package/dist/core/hypothesisEngine.js +0 -264
  278. package/dist/core/hypothesisEngine.js.map +0 -1
  279. package/dist/core/productTestHarness.d.ts +0 -113
  280. package/dist/core/productTestHarness.d.ts.map +0 -1
  281. package/dist/core/productTestHarness.js +0 -351
  282. package/dist/core/productTestHarness.js.map +0 -1
  283. package/dist/core/validationRunner.d.ts +0 -106
  284. package/dist/core/validationRunner.d.ts.map +0 -1
  285. package/dist/core/validationRunner.js +0 -892
  286. package/dist/core/validationRunner.js.map +0 -1
  287. package/dist/plugins/tools/browser/browserAutomationPlugin.d.ts +0 -14
  288. package/dist/plugins/tools/browser/browserAutomationPlugin.d.ts.map +0 -1
  289. package/dist/plugins/tools/browser/browserAutomationPlugin.js +0 -26
  290. package/dist/plugins/tools/browser/browserAutomationPlugin.js.map +0 -1
  291. package/dist/plugins/tools/checks/localRepoChecksPlugin.d.ts +0 -3
  292. package/dist/plugins/tools/checks/localRepoChecksPlugin.d.ts.map +0 -1
  293. package/dist/plugins/tools/checks/localRepoChecksPlugin.js +0 -14
  294. package/dist/plugins/tools/checks/localRepoChecksPlugin.js.map +0 -1
  295. package/dist/plugins/tools/cloud/cloudPlugin.d.ts +0 -3
  296. package/dist/plugins/tools/cloud/cloudPlugin.d.ts.map +0 -1
  297. package/dist/plugins/tools/cloud/cloudPlugin.js +0 -14
  298. package/dist/plugins/tools/cloud/cloudPlugin.js.map +0 -1
  299. package/dist/plugins/tools/codeAnalysis/codeAnalysisPlugin.d.ts +0 -3
  300. package/dist/plugins/tools/codeAnalysis/codeAnalysisPlugin.d.ts.map +0 -1
  301. package/dist/plugins/tools/codeAnalysis/codeAnalysisPlugin.js +0 -14
  302. package/dist/plugins/tools/codeAnalysis/codeAnalysisPlugin.js.map +0 -1
  303. package/dist/plugins/tools/codeQuality/codeQualityPlugin.d.ts +0 -3
  304. package/dist/plugins/tools/codeQuality/codeQualityPlugin.d.ts.map +0 -1
  305. package/dist/plugins/tools/codeQuality/codeQualityPlugin.js +0 -14
  306. package/dist/plugins/tools/codeQuality/codeQualityPlugin.js.map +0 -1
  307. package/dist/plugins/tools/dependency/dependencyPlugin.d.ts +0 -3
  308. package/dist/plugins/tools/dependency/dependencyPlugin.d.ts.map +0 -1
  309. package/dist/plugins/tools/dependency/dependencyPlugin.js +0 -12
  310. package/dist/plugins/tools/dependency/dependencyPlugin.js.map +0 -1
  311. package/dist/plugins/tools/development/devPlugin.d.ts +0 -3
  312. package/dist/plugins/tools/development/devPlugin.d.ts.map +0 -1
  313. package/dist/plugins/tools/development/devPlugin.js +0 -14
  314. package/dist/plugins/tools/development/devPlugin.js.map +0 -1
  315. package/dist/plugins/tools/email/emailPlugin.d.ts +0 -3
  316. package/dist/plugins/tools/email/emailPlugin.d.ts.map +0 -1
  317. package/dist/plugins/tools/email/emailPlugin.js +0 -12
  318. package/dist/plugins/tools/email/emailPlugin.js.map +0 -1
  319. package/dist/plugins/tools/enhancedAnalysis/enhancedAnalysisPlugin.d.ts +0 -3
  320. package/dist/plugins/tools/enhancedAnalysis/enhancedAnalysisPlugin.d.ts.map +0 -1
  321. package/dist/plugins/tools/enhancedAnalysis/enhancedAnalysisPlugin.js +0 -14
  322. package/dist/plugins/tools/enhancedAnalysis/enhancedAnalysisPlugin.js.map +0 -1
  323. package/dist/plugins/tools/enhancedCodeIntelligence/enhancedCodeIntelligencePlugin.d.ts +0 -3
  324. package/dist/plugins/tools/enhancedCodeIntelligence/enhancedCodeIntelligencePlugin.d.ts.map +0 -1
  325. package/dist/plugins/tools/enhancedCodeIntelligence/enhancedCodeIntelligencePlugin.js +0 -12
  326. package/dist/plugins/tools/enhancedCodeIntelligence/enhancedCodeIntelligencePlugin.js.map +0 -1
  327. package/dist/plugins/tools/enhancedDevWorkflow/enhancedDevWorkflowPlugin.d.ts +0 -3
  328. package/dist/plugins/tools/enhancedDevWorkflow/enhancedDevWorkflowPlugin.d.ts.map +0 -1
  329. package/dist/plugins/tools/enhancedDevWorkflow/enhancedDevWorkflowPlugin.js +0 -12
  330. package/dist/plugins/tools/enhancedDevWorkflow/enhancedDevWorkflowPlugin.js.map +0 -1
  331. package/dist/plugins/tools/frontendTesting/frontendTestingPlugin.d.ts +0 -3
  332. package/dist/plugins/tools/frontendTesting/frontendTestingPlugin.d.ts.map +0 -1
  333. package/dist/plugins/tools/frontendTesting/frontendTestingPlugin.js +0 -14
  334. package/dist/plugins/tools/frontendTesting/frontendTestingPlugin.js.map +0 -1
  335. package/dist/plugins/tools/interaction/interactionPlugin.d.ts +0 -3
  336. package/dist/plugins/tools/interaction/interactionPlugin.d.ts.map +0 -1
  337. package/dist/plugins/tools/interaction/interactionPlugin.js +0 -12
  338. package/dist/plugins/tools/interaction/interactionPlugin.js.map +0 -1
  339. package/dist/plugins/tools/learn/learnPlugin.d.ts +0 -3
  340. package/dist/plugins/tools/learn/learnPlugin.d.ts.map +0 -1
  341. package/dist/plugins/tools/learn/learnPlugin.js +0 -14
  342. package/dist/plugins/tools/learn/learnPlugin.js.map +0 -1
  343. package/dist/plugins/tools/notebook/notebookPlugin.d.ts +0 -9
  344. package/dist/plugins/tools/notebook/notebookPlugin.d.ts.map +0 -1
  345. package/dist/plugins/tools/notebook/notebookPlugin.js +0 -15
  346. package/dist/plugins/tools/notebook/notebookPlugin.js.map +0 -1
  347. package/dist/plugins/tools/planning/planningPlugin.d.ts +0 -9
  348. package/dist/plugins/tools/planning/planningPlugin.d.ts.map +0 -1
  349. package/dist/plugins/tools/planning/planningPlugin.js +0 -15
  350. package/dist/plugins/tools/planning/planningPlugin.js.map +0 -1
  351. package/dist/plugins/tools/refactoring/refactoringPlugin.d.ts +0 -3
  352. package/dist/plugins/tools/refactoring/refactoringPlugin.d.ts.map +0 -1
  353. package/dist/plugins/tools/refactoring/refactoringPlugin.js +0 -12
  354. package/dist/plugins/tools/refactoring/refactoringPlugin.js.map +0 -1
  355. package/dist/plugins/tools/taskManagement/taskManagementPlugin.d.ts +0 -3
  356. package/dist/plugins/tools/taskManagement/taskManagementPlugin.d.ts.map +0 -1
  357. package/dist/plugins/tools/taskManagement/taskManagementPlugin.js +0 -12
  358. package/dist/plugins/tools/taskManagement/taskManagementPlugin.js.map +0 -1
  359. package/dist/plugins/tools/testing/testingPlugin.d.ts +0 -3
  360. package/dist/plugins/tools/testing/testingPlugin.d.ts.map +0 -1
  361. package/dist/plugins/tools/testing/testingPlugin.js +0 -12
  362. package/dist/plugins/tools/testing/testingPlugin.js.map +0 -1
  363. package/dist/plugins/tools/validation/validationPlugin.d.ts +0 -3
  364. package/dist/plugins/tools/validation/validationPlugin.d.ts.map +0 -1
  365. package/dist/plugins/tools/validation/validationPlugin.js +0 -14
  366. package/dist/plugins/tools/validation/validationPlugin.js.map +0 -1
  367. package/dist/plugins/tools/web/webPlugin.d.ts +0 -3
  368. package/dist/plugins/tools/web/webPlugin.d.ts.map +0 -1
  369. package/dist/plugins/tools/web/webPlugin.js +0 -12
  370. package/dist/plugins/tools/web/webPlugin.js.map +0 -1
  371. package/dist/tools/advancedTestGenerationTools.d.ts +0 -21
  372. package/dist/tools/advancedTestGenerationTools.d.ts.map +0 -1
  373. package/dist/tools/advancedTestGenerationTools.js +0 -304
  374. package/dist/tools/advancedTestGenerationTools.js.map +0 -1
  375. package/dist/tools/browserAutomationTools.d.ts +0 -23
  376. package/dist/tools/browserAutomationTools.d.ts.map +0 -1
  377. package/dist/tools/browserAutomationTools.js +0 -916
  378. package/dist/tools/browserAutomationTools.js.map +0 -1
  379. package/dist/tools/buildTools.d.ts +0 -9
  380. package/dist/tools/buildTools.d.ts.map +0 -1
  381. package/dist/tools/buildTools.js +0 -346
  382. package/dist/tools/buildTools.js.map +0 -1
  383. package/dist/tools/cloudTools.d.ts +0 -49
  384. package/dist/tools/cloudTools.d.ts.map +0 -1
  385. package/dist/tools/cloudTools.js +0 -1258
  386. package/dist/tools/cloudTools.js.map +0 -1
  387. package/dist/tools/codeAnalysisTools.d.ts +0 -74
  388. package/dist/tools/codeAnalysisTools.d.ts.map +0 -1
  389. package/dist/tools/codeAnalysisTools.js +0 -664
  390. package/dist/tools/codeAnalysisTools.js.map +0 -1
  391. package/dist/tools/codeGenerationTools.d.ts +0 -3
  392. package/dist/tools/codeGenerationTools.d.ts.map +0 -1
  393. package/dist/tools/codeGenerationTools.js +0 -439
  394. package/dist/tools/codeGenerationTools.js.map +0 -1
  395. package/dist/tools/codeQualityTools.d.ts +0 -3
  396. package/dist/tools/codeQualityTools.d.ts.map +0 -1
  397. package/dist/tools/codeQualityTools.js +0 -297
  398. package/dist/tools/codeQualityTools.js.map +0 -1
  399. package/dist/tools/dependencyTools.d.ts +0 -3
  400. package/dist/tools/dependencyTools.d.ts.map +0 -1
  401. package/dist/tools/dependencyTools.js +0 -284
  402. package/dist/tools/dependencyTools.js.map +0 -1
  403. package/dist/tools/devTools.d.ts +0 -10
  404. package/dist/tools/devTools.d.ts.map +0 -1
  405. package/dist/tools/devTools.js +0 -2126
  406. package/dist/tools/devTools.js.map +0 -1
  407. package/dist/tools/emailTools.d.ts +0 -21
  408. package/dist/tools/emailTools.d.ts.map +0 -1
  409. package/dist/tools/emailTools.js +0 -449
  410. package/dist/tools/emailTools.js.map +0 -1
  411. package/dist/tools/enhancedAnalysisTools.d.ts +0 -9
  412. package/dist/tools/enhancedAnalysisTools.d.ts.map +0 -1
  413. package/dist/tools/enhancedAnalysisTools.js +0 -370
  414. package/dist/tools/enhancedAnalysisTools.js.map +0 -1
  415. package/dist/tools/enhancedCodeIntelligenceTools.d.ts +0 -7
  416. package/dist/tools/enhancedCodeIntelligenceTools.d.ts.map +0 -1
  417. package/dist/tools/enhancedCodeIntelligenceTools.js +0 -540
  418. package/dist/tools/enhancedCodeIntelligenceTools.js.map +0 -1
  419. package/dist/tools/enhancedDevWorkflowTools.d.ts +0 -7
  420. package/dist/tools/enhancedDevWorkflowTools.d.ts.map +0 -1
  421. package/dist/tools/enhancedDevWorkflowTools.js +0 -432
  422. package/dist/tools/enhancedDevWorkflowTools.js.map +0 -1
  423. package/dist/tools/frontendTestingTools.d.ts +0 -35
  424. package/dist/tools/frontendTestingTools.d.ts.map +0 -1
  425. package/dist/tools/frontendTestingTools.js +0 -1258
  426. package/dist/tools/frontendTestingTools.js.map +0 -1
  427. package/dist/tools/globTools.d.ts +0 -15
  428. package/dist/tools/globTools.d.ts.map +0 -1
  429. package/dist/tools/globTools.js +0 -174
  430. package/dist/tools/globTools.js.map +0 -1
  431. package/dist/tools/grepTools.d.ts +0 -19
  432. package/dist/tools/grepTools.d.ts.map +0 -1
  433. package/dist/tools/grepTools.js +0 -411
  434. package/dist/tools/grepTools.js.map +0 -1
  435. package/dist/tools/interactionTools.d.ts +0 -6
  436. package/dist/tools/interactionTools.d.ts.map +0 -1
  437. package/dist/tools/interactionTools.js +0 -209
  438. package/dist/tools/interactionTools.js.map +0 -1
  439. package/dist/tools/learnTools.d.ts +0 -164
  440. package/dist/tools/learnTools.d.ts.map +0 -1
  441. package/dist/tools/learnTools.js +0 -2098
  442. package/dist/tools/learnTools.js.map +0 -1
  443. package/dist/tools/notebookEditTools.d.ts +0 -15
  444. package/dist/tools/notebookEditTools.d.ts.map +0 -1
  445. package/dist/tools/notebookEditTools.js +0 -197
  446. package/dist/tools/notebookEditTools.js.map +0 -1
  447. package/dist/tools/refactoringTools.d.ts +0 -3
  448. package/dist/tools/refactoringTools.d.ts.map +0 -1
  449. package/dist/tools/refactoringTools.js +0 -294
  450. package/dist/tools/refactoringTools.js.map +0 -1
  451. package/dist/tools/repoChecksTools.d.ts +0 -3
  452. package/dist/tools/repoChecksTools.d.ts.map +0 -1
  453. package/dist/tools/repoChecksTools.js +0 -276
  454. package/dist/tools/repoChecksTools.js.map +0 -1
  455. package/dist/tools/taskManagementTools.d.ts +0 -10
  456. package/dist/tools/taskManagementTools.d.ts.map +0 -1
  457. package/dist/tools/taskManagementTools.js +0 -133
  458. package/dist/tools/taskManagementTools.js.map +0 -1
  459. package/dist/tools/testingTools.d.ts +0 -3
  460. package/dist/tools/testingTools.d.ts.map +0 -1
  461. package/dist/tools/testingTools.js +0 -237
  462. package/dist/tools/testingTools.js.map +0 -1
  463. package/dist/tools/validationTools.d.ts +0 -7
  464. package/dist/tools/validationTools.d.ts.map +0 -1
  465. package/dist/tools/validationTools.js +0 -344
  466. package/dist/tools/validationTools.js.map +0 -1
  467. package/dist/tools/webTools.d.ts +0 -3
  468. package/dist/tools/webTools.d.ts.map +0 -1
  469. package/dist/tools/webTools.js +0 -502
  470. package/dist/tools/webTools.js.map +0 -1
@@ -78,13 +78,14 @@ export class UnifiedUIRenderer extends EventEmitter {
78
78
  activityStarFrames = ['✳', '✴', '✵', '✶', '✷', '✸'];
79
79
  // Token count during streaming
80
80
  streamingTokens = 0;
81
- // Fun phrases to cycle through when no specific activity is provided
81
+ // User-friendly activity phrases (clean, professional)
82
82
  funActivityPhrases = [
83
- 'Moseying', 'Ruminating', 'Pondering', 'Cogitating', 'Mulling',
84
- 'Contemplating', 'Deliberating', 'Noodling', 'Percolating', 'Stewing',
85
- 'Brewing', 'Simmering', 'Churning', 'Puzzling', 'Meandering',
86
- 'Wandering', 'Musing', 'Daydreaming', 'Woolgathering', 'Chewing',
83
+ 'Thinking', 'Processing', 'Analyzing', 'Working', 'Preparing',
87
84
  ];
85
+ maxCuratedReasoningLines = 8;
86
+ maxCuratedReasoningChars = 1800;
87
+ thoughtDedupWindowMs = 15000;
88
+ lastCuratedThought = null;
88
89
  statusMeta = {};
89
90
  toggleState = {
90
91
  verificationEnabled: false,
@@ -93,6 +94,37 @@ export class UnifiedUIRenderer extends EventEmitter {
93
94
  dualRlEnabled: false,
94
95
  };
95
96
  // ------------ Helpers ------------
97
+ /** Ensure cursor is always within valid bounds for the current buffer */
98
+ clampCursor() {
99
+ this.cursor = Math.max(0, Math.min(this.cursor, this.buffer.length));
100
+ }
101
+ /** Safely append to paste buffer with size limit enforcement */
102
+ appendToPasteBuffer(buffer, text) {
103
+ if (this.pasteBufferOverflow)
104
+ return; // Already at limit
105
+ const current = buffer === 'paste' ? this.pasteBuffer : this.plainPasteBuffer;
106
+ const remaining = this.maxPasteBufferSize - current.length;
107
+ if (remaining <= 0) {
108
+ this.pasteBufferOverflow = true;
109
+ return;
110
+ }
111
+ const toAdd = text.length <= remaining ? text : text.slice(0, remaining);
112
+ if (buffer === 'paste') {
113
+ this.pasteBuffer += toAdd;
114
+ }
115
+ else {
116
+ this.plainPasteBuffer += toAdd;
117
+ }
118
+ if (toAdd.length < text.length) {
119
+ this.pasteBufferOverflow = true;
120
+ }
121
+ }
122
+ /** Strip ANSI escape sequences from text to prevent injection */
123
+ sanitizePasteContent(text) {
124
+ // Remove all ANSI escape sequences (CSI, OSC, etc.)
125
+ // eslint-disable-next-line no-control-regex
126
+ return text.replace(/\x1b\[[0-9;]*[A-Za-z]|\x1b\][^\x07]*\x07|\x1b[PX^_][^\x1b]*\x1b\\|\x1b./g, '');
127
+ }
96
128
  formatHotkey(combo) {
97
129
  if (!combo?.trim())
98
130
  return null;
@@ -109,6 +141,9 @@ export class UnifiedUIRenderer extends EventEmitter {
109
141
  plainPasteWindowMs = 60;
110
142
  plainPasteTriggerChars = 24;
111
143
  plainPasteEarlyNewlineChars = 2; // Guard for short first lines in plain paste mode
144
+ // Paste buffer limits to prevent memory exhaustion
145
+ maxPasteBufferSize = 10 * 1024 * 1024; // 10MB max paste size
146
+ pasteBufferOverflow = false; // Track if paste was truncated
112
147
  cursorVisibleColumn = 1;
113
148
  inBracketedPaste = false;
114
149
  pasteBuffer = '';
@@ -118,6 +153,10 @@ export class UnifiedUIRenderer extends EventEmitter {
118
153
  pasteBurstWindowStart = 0;
119
154
  pasteBurstCharCount = 0;
120
155
  plainRecentChunks = [];
156
+ // Pending insert buffer: holds characters during paste detection window to prevent visual leak
157
+ pendingInsertBuffer = '';
158
+ pendingInsertTimer = null;
159
+ pendingInsertDelayMs = 80; // Wait before committing chars as normal input
121
160
  lastRenderedEventKey = null;
122
161
  lastOutputEndedWithNewline = true;
123
162
  hasRenderedPrompt = false;
@@ -130,6 +169,12 @@ export class UnifiedUIRenderer extends EventEmitter {
130
169
  pendingRender = false;
131
170
  lastRenderTime = 0;
132
171
  renderThrottleMs = 16; // ~60fps max
172
+ renderThrottleTimer = null;
173
+ // Disposal state to prevent operations after cleanup
174
+ disposed = false;
175
+ // Bound event handlers for proper cleanup
176
+ boundResizeHandler = null;
177
+ boundKeypressHandler = null;
133
178
  inputCapture = null;
134
179
  constructor(output = process.stdout, input = process.stdin, _options) {
135
180
  super();
@@ -148,12 +193,14 @@ export class UnifiedUIRenderer extends EventEmitter {
148
193
  });
149
194
  this.rl.setPrompt('');
150
195
  this.updateTerminalSize();
151
- this.output.on('resize', () => {
152
- if (!this.plainMode) {
196
+ // Use bound handlers so we can remove them on cleanup
197
+ this.boundResizeHandler = () => {
198
+ if (!this.plainMode && !this.disposed) {
153
199
  this.updateTerminalSize();
154
200
  this.renderPrompt();
155
201
  }
156
- });
202
+ };
203
+ this.output.on('resize', this.boundResizeHandler);
157
204
  this.setupInputHandlers();
158
205
  }
159
206
  initialize() {
@@ -180,8 +227,15 @@ export class UnifiedUIRenderer extends EventEmitter {
180
227
  this.renderPrompt();
181
228
  }
182
229
  cleanup() {
230
+ // Mark as disposed first to prevent any pending operations
231
+ this.disposed = true;
183
232
  this.cancelInputCapture(new Error('Renderer disposed'));
184
233
  this.cancelPlainPasteCapture();
234
+ // Clear render throttle timer
235
+ if (this.renderThrottleTimer) {
236
+ clearTimeout(this.renderThrottleTimer);
237
+ this.renderThrottleTimer = null;
238
+ }
185
239
  // Stop any running animations
186
240
  if (this.spinnerInterval) {
187
241
  clearInterval(this.spinnerInterval);
@@ -197,6 +251,17 @@ export class UnifiedUIRenderer extends EventEmitter {
197
251
  }
198
252
  this.contextMeter.dispose();
199
253
  disposeAnimations();
254
+ // Remove event listeners to prevent memory leaks
255
+ if (this.boundResizeHandler) {
256
+ this.output.removeListener('resize', this.boundResizeHandler);
257
+ this.boundResizeHandler = null;
258
+ }
259
+ if (this.boundKeypressHandler) {
260
+ this.input.removeListener('keypress', this.boundKeypressHandler);
261
+ this.boundKeypressHandler = null;
262
+ }
263
+ // Remove all EventEmitter listeners from this instance
264
+ this.removeAllListeners();
200
265
  if (!this.interactive) {
201
266
  this.rl.close();
202
267
  return;
@@ -213,6 +278,8 @@ export class UnifiedUIRenderer extends EventEmitter {
213
278
  }
214
279
  this.rl.close();
215
280
  this.lastOverlay = null;
281
+ // Clear event queue
282
+ this.eventQueue = [];
216
283
  }
217
284
  suspendPromptRendering() {
218
285
  this.promptRenderingSuspended = true;
@@ -233,9 +300,13 @@ export class UnifiedUIRenderer extends EventEmitter {
233
300
  if (this.input.isTTY) {
234
301
  this.input.setRawMode(true);
235
302
  }
236
- this.input.on('keypress', (str, key) => {
237
- this.handleKeypress(str, key);
238
- });
303
+ // Use bound handler so we can remove it on cleanup
304
+ this.boundKeypressHandler = (str, key) => {
305
+ if (!this.disposed) {
306
+ this.handleKeypress(str, key);
307
+ }
308
+ };
309
+ this.input.on('keypress', this.boundKeypressHandler);
239
310
  }
240
311
  emitInputChange() {
241
312
  const payload = {
@@ -385,8 +456,16 @@ export class UnifiedUIRenderer extends EventEmitter {
385
456
  else if (this.historyIndex > 0) {
386
457
  this.historyIndex--;
387
458
  }
388
- this.buffer = this.history[this.historyIndex] ?? '';
459
+ // Validate index is within bounds before accessing
460
+ if (this.historyIndex >= 0 && this.historyIndex < this.history.length) {
461
+ this.buffer = this.history[this.historyIndex] ?? '';
462
+ }
463
+ else {
464
+ this.historyIndex = -1;
465
+ this.buffer = '';
466
+ }
389
467
  this.cursor = this.buffer.length;
468
+ this.inputRenderOffset = 0; // Reset render offset for new buffer
390
469
  this.updateSuggestions();
391
470
  this.renderPrompt();
392
471
  this.emitInputChange();
@@ -403,10 +482,16 @@ export class UnifiedUIRenderer extends EventEmitter {
403
482
  this.historyIndex = -1;
404
483
  this.buffer = '';
405
484
  }
406
- else {
485
+ else if (this.historyIndex >= 0) {
407
486
  this.buffer = this.history[this.historyIndex] ?? '';
408
487
  }
488
+ else {
489
+ // Safety: invalid state, reset
490
+ this.historyIndex = -1;
491
+ this.buffer = '';
492
+ }
409
493
  this.cursor = this.buffer.length;
494
+ this.inputRenderOffset = 0; // Reset render offset for new buffer
410
495
  this.updateSuggestions();
411
496
  this.renderPrompt();
412
497
  this.emitInputChange();
@@ -419,8 +504,50 @@ export class UnifiedUIRenderer extends EventEmitter {
419
504
  return;
420
505
  }
421
506
  if (str && !key.ctrl && !key.meta) {
422
- this.insertText(str);
507
+ // Defer insertion to allow paste detection window to catch rapid input
508
+ this.queuePendingInsert(str);
509
+ }
510
+ }
511
+ /**
512
+ * Queue characters for deferred insertion. This prevents visual "leak" of
513
+ * pasted content by holding characters until we're confident it's not a paste.
514
+ */
515
+ queuePendingInsert(text) {
516
+ this.pendingInsertBuffer += text;
517
+ // Clear any existing timer
518
+ if (this.pendingInsertTimer) {
519
+ clearTimeout(this.pendingInsertTimer);
520
+ this.pendingInsertTimer = null;
521
+ }
522
+ // Schedule commit after delay - if paste detection triggers first, it will consume the buffer
523
+ this.pendingInsertTimer = setTimeout(() => {
524
+ this.commitPendingInsert();
525
+ }, this.pendingInsertDelayMs);
526
+ }
527
+ /**
528
+ * Commit pending characters as normal input (not a paste).
529
+ */
530
+ commitPendingInsert() {
531
+ if (this.pendingInsertTimer) {
532
+ clearTimeout(this.pendingInsertTimer);
533
+ this.pendingInsertTimer = null;
534
+ }
535
+ if (this.pendingInsertBuffer && !this.inPlainPaste && !this.inBracketedPaste) {
536
+ this.insertText(this.pendingInsertBuffer);
537
+ }
538
+ this.pendingInsertBuffer = '';
539
+ }
540
+ /**
541
+ * Consume pending insert buffer into paste detection (prevents visual leak).
542
+ */
543
+ consumePendingInsertForPaste() {
544
+ if (this.pendingInsertTimer) {
545
+ clearTimeout(this.pendingInsertTimer);
546
+ this.pendingInsertTimer = null;
423
547
  }
548
+ const consumed = this.pendingInsertBuffer;
549
+ this.pendingInsertBuffer = '';
550
+ return consumed;
424
551
  }
425
552
  handleBracketedPaste(str, key) {
426
553
  const sequence = key?.sequence || str;
@@ -429,7 +556,10 @@ export class UnifiedUIRenderer extends EventEmitter {
429
556
  }
430
557
  if (sequence === '\x1b[200~') {
431
558
  this.inBracketedPaste = true;
432
- this.pasteBuffer = '';
559
+ this.pasteBufferOverflow = false; // Reset overflow flag for new paste
560
+ // Consume any pending insert buffer to prevent leak
561
+ const pending = this.consumePendingInsertForPaste();
562
+ this.pasteBuffer = pending; // Include any chars that arrived before bracketed paste started
433
563
  this.cancelPlainPasteCapture();
434
564
  return true;
435
565
  }
@@ -441,7 +571,7 @@ export class UnifiedUIRenderer extends EventEmitter {
441
571
  return true;
442
572
  }
443
573
  if (key?.name === 'return' || key?.name === 'enter') {
444
- this.pasteBuffer += '\n';
574
+ this.appendToPasteBuffer('paste', '\n');
445
575
  return true;
446
576
  }
447
577
  if (key?.name === 'backspace') {
@@ -449,11 +579,11 @@ export class UnifiedUIRenderer extends EventEmitter {
449
579
  return true;
450
580
  }
451
581
  if (typeof str === 'string' && str.length > 0) {
452
- this.pasteBuffer += str;
582
+ this.appendToPasteBuffer('paste', str);
453
583
  return true;
454
584
  }
455
585
  if (typeof sequence === 'string' && sequence.length > 0) {
456
- this.pasteBuffer += sequence;
586
+ this.appendToPasteBuffer('paste', sequence);
457
587
  return true;
458
588
  }
459
589
  return true;
@@ -461,11 +591,18 @@ export class UnifiedUIRenderer extends EventEmitter {
461
591
  commitPasteBuffer() {
462
592
  if (!this.inBracketedPaste)
463
593
  return;
464
- const content = this.pasteBuffer.replace(/\r\n?/g, '\n');
594
+ // Sanitize to remove any injected escape sequences, then normalize line endings
595
+ const sanitized = this.sanitizePasteContent(this.pasteBuffer);
596
+ const content = sanitized.replace(/\r\n?/g, '\n');
465
597
  if (content) {
466
598
  const lines = content.split('\n');
599
+ const wasTruncated = this.pasteBufferOverflow;
467
600
  if (lines.length > 1 || content.length > 200) {
468
- this.collapsedPaste = { text: content, lines: lines.length, chars: content.length };
601
+ this.collapsedPaste = {
602
+ text: content,
603
+ lines: lines.length,
604
+ chars: content.length + (wasTruncated ? '+' : 0), // Indicate truncation
605
+ };
469
606
  this.buffer = '';
470
607
  this.cursor = 0;
471
608
  this.updateSuggestions();
@@ -478,6 +615,7 @@ export class UnifiedUIRenderer extends EventEmitter {
478
615
  }
479
616
  this.inBracketedPaste = false;
480
617
  this.pasteBuffer = '';
618
+ this.pasteBufferOverflow = false;
481
619
  this.cancelPlainPasteCapture();
482
620
  }
483
621
  handlePlainPaste(str, key) {
@@ -517,23 +655,35 @@ export class UnifiedUIRenderer extends EventEmitter {
517
655
  let chunkAlreadyCaptured = false;
518
656
  if (!this.inPlainPaste) {
519
657
  this.inPlainPaste = true;
658
+ this.pasteBufferOverflow = false; // Reset overflow flag for new paste
659
+ // Consume pending insert buffer first - this is the primary source now
660
+ const pending = this.consumePendingInsertForPaste();
520
661
  const reclaimed = this.reclaimRecentPlainChunks();
521
- if (reclaimed.length > 0) {
522
- const removeCount = Math.min(this.buffer.length, reclaimed.length);
523
- const suffix = this.buffer.slice(-removeCount);
524
- if (removeCount > 0 && suffix === reclaimed.slice(-removeCount)) {
525
- this.buffer = this.buffer.slice(0, this.buffer.length - removeCount);
526
- this.cursor = Math.max(0, this.buffer.length);
662
+ // Combine pending buffer with any reclaimed chunks
663
+ const combined = pending + reclaimed;
664
+ if (combined.length > 0) {
665
+ // Remove any chars that leaked into buffer (legacy reclaim path)
666
+ if (reclaimed.length > 0) {
667
+ const removeCount = Math.min(this.buffer.length, reclaimed.length);
668
+ const suffix = this.buffer.slice(-removeCount);
669
+ if (removeCount > 0 && suffix === reclaimed.slice(-removeCount)) {
670
+ this.buffer = this.buffer.slice(0, this.buffer.length - removeCount);
671
+ this.cursor = Math.max(0, this.buffer.length);
672
+ this.clampCursor(); // Ensure cursor is valid
673
+ }
674
+ }
675
+ this.plainPasteBuffer = combined.slice(0, this.maxPasteBufferSize);
676
+ if (combined.length > this.maxPasteBufferSize) {
677
+ this.pasteBufferOverflow = true;
527
678
  }
528
- this.plainPasteBuffer = reclaimed;
529
- chunkAlreadyCaptured = reclaimed.endsWith(chunk);
679
+ chunkAlreadyCaptured = combined.endsWith(chunk);
530
680
  }
531
681
  else {
532
682
  this.plainPasteBuffer = '';
533
683
  }
534
684
  }
535
685
  if (!chunkAlreadyCaptured) {
536
- this.plainPasteBuffer += chunk;
686
+ this.appendToPasteBuffer('plainPaste', chunk);
537
687
  }
538
688
  this.schedulePlainPasteCommit();
539
689
  return true;
@@ -554,6 +704,12 @@ export class UnifiedUIRenderer extends EventEmitter {
554
704
  clearTimeout(this.plainPasteTimer);
555
705
  this.plainPasteTimer = null;
556
706
  }
707
+ // Also cancel pending insert buffer
708
+ if (this.pendingInsertTimer) {
709
+ clearTimeout(this.pendingInsertTimer);
710
+ this.pendingInsertTimer = null;
711
+ }
712
+ this.pendingInsertBuffer = '';
557
713
  this.inPlainPaste = false;
558
714
  this.plainPasteBuffer = '';
559
715
  this.plainRecentChunks = [];
@@ -589,11 +745,15 @@ export class UnifiedUIRenderer extends EventEmitter {
589
745
  finalizePlainPaste() {
590
746
  if (!this.inPlainPaste)
591
747
  return;
592
- const content = this.plainPasteBuffer.replace(/\r\n?/g, '\n');
748
+ // Sanitize to remove any injected escape sequences, then normalize line endings
749
+ const sanitized = this.sanitizePasteContent(this.plainPasteBuffer);
750
+ const content = sanitized.replace(/\r\n?/g, '\n');
751
+ const wasTruncated = this.pasteBufferOverflow;
593
752
  this.inPlainPaste = false;
594
753
  this.plainPasteBuffer = '';
595
754
  this.plainRecentChunks = [];
596
755
  this.resetPlainPasteBurst();
756
+ this.pasteBufferOverflow = false;
597
757
  if (this.plainPasteTimer) {
598
758
  clearTimeout(this.plainPasteTimer);
599
759
  this.plainPasteTimer = null;
@@ -602,7 +762,11 @@ export class UnifiedUIRenderer extends EventEmitter {
602
762
  return;
603
763
  const lines = content.split('\n');
604
764
  if (lines.length > 1 || content.length > 200) {
605
- this.collapsedPaste = { text: content, lines: lines.length, chars: content.length };
765
+ this.collapsedPaste = {
766
+ text: content,
767
+ lines: lines.length,
768
+ chars: content.length + (wasTruncated ? '+' : 0),
769
+ };
606
770
  this.buffer = '';
607
771
  this.cursor = 0;
608
772
  this.updateSuggestions();
@@ -621,8 +785,11 @@ export class UnifiedUIRenderer extends EventEmitter {
621
785
  if (this.collapsedPaste) {
622
786
  this.expandCollapsedPaste();
623
787
  }
788
+ // Ensure cursor is valid before slicing
789
+ this.clampCursor();
624
790
  this.buffer = this.buffer.slice(0, this.cursor) + text + this.buffer.slice(this.cursor);
625
791
  this.cursor += text.length;
792
+ this.clampCursor(); // Ensure cursor remains valid after modification
626
793
  this.updateSuggestions();
627
794
  this.renderPrompt();
628
795
  this.emitInputChange();
@@ -739,11 +906,19 @@ export class UnifiedUIRenderer extends EventEmitter {
739
906
  }
740
907
  navigateSuggestions(direction) {
741
908
  if (!this.buffer.startsWith('/') || this.suggestions.length === 0) {
909
+ // Reset index if suggestions were cleared but index wasn't
910
+ if (this.suggestionIndex !== -1 && this.suggestions.length === 0) {
911
+ this.suggestionIndex = -1;
912
+ }
742
913
  return false;
743
914
  }
744
- const next = this.suggestionIndex + direction;
915
+ // Ensure current index is valid before computing next
916
+ const currentIndex = this.suggestionIndex >= 0 && this.suggestionIndex < this.suggestions.length
917
+ ? this.suggestionIndex
918
+ : -1;
919
+ const next = currentIndex + direction;
745
920
  const clamped = Math.max(0, Math.min(this.suggestions.length - 1, next));
746
- if (clamped === this.suggestionIndex) {
921
+ if (clamped === this.suggestionIndex && this.suggestionIndex >= 0) {
747
922
  return true;
748
923
  }
749
924
  this.suggestionIndex = clamped;
@@ -812,11 +987,11 @@ export class UnifiedUIRenderer extends EventEmitter {
812
987
  }
813
988
  }
814
989
  async processQueue() {
815
- if (this.isProcessingQueue)
990
+ if (this.isProcessingQueue || this.disposed)
816
991
  return;
817
992
  this.isProcessingQueue = true;
818
993
  try {
819
- while (this.eventQueue.length > 0) {
994
+ while (this.eventQueue.length > 0 && !this.disposed) {
820
995
  const event = this.eventQueue.shift();
821
996
  if (!event)
822
997
  continue;
@@ -826,9 +1001,14 @@ export class UnifiedUIRenderer extends EventEmitter {
826
1001
  }
827
1002
  catch (error) {
828
1003
  // Never allow a rendering failure to stall the event queue
1004
+ if (this.disposed)
1005
+ break; // Don't try to write after disposal
829
1006
  const message = error instanceof Error ? error.message : typeof error === 'string' ? error : 'Unknown renderer error';
830
1007
  this.output.write(`\n[renderer] ${message}\n`);
831
1008
  }
1009
+ // Check disposed before continuing
1010
+ if (this.disposed)
1011
+ break;
832
1012
  // For prompt events, ensure the overlay is rendered immediately
833
1013
  // This guarantees prompts are visible before async processing continues
834
1014
  if (event.type === 'prompt') {
@@ -844,7 +1024,7 @@ export class UnifiedUIRenderer extends EventEmitter {
844
1024
  }
845
1025
  // ALWAYS render prompt after queue completes to keep bottom UI persistent
846
1026
  // This ensures status/toggles stay pinned and responses are fully rendered
847
- if (this.output.isTTY) {
1027
+ if (this.output.isTTY && !this.disposed) {
848
1028
  this.allowPromptRender = true;
849
1029
  this.renderPrompt();
850
1030
  }
@@ -974,9 +1154,18 @@ export class UnifiedUIRenderer extends EventEmitter {
974
1154
  if (this.isGarbageOutput(event.content)) {
975
1155
  return '';
976
1156
  }
977
- // Strip any existing bullet prefix (○ or ⏺) and use consistent wrapping
978
- const cleanContent = event.content.replace(/^[○⏺]\s*/, '');
979
- return this.formatThinkingBlock(cleanContent);
1157
+ const curated = this.curateReasoningContent(event.content);
1158
+ if (!curated || this.isGarbageOutput(curated)) {
1159
+ return '';
1160
+ }
1161
+ if (!this.shouldRenderThought(curated)) {
1162
+ return '';
1163
+ }
1164
+ this.lastCuratedThought = {
1165
+ text: curated.replace(/\s+/g, ' ').trim().toLowerCase(),
1166
+ at: Date.now(),
1167
+ };
1168
+ return this.formatThinkingBlock(curated);
980
1169
  }
981
1170
  case 'tool': {
982
1171
  // Compact tool display: ⚡ToolName → result
@@ -1036,6 +1225,70 @@ export class UnifiedUIRenderer extends EventEmitter {
1036
1225
  }
1037
1226
  return false;
1038
1227
  }
1228
+ curateReasoningContent(content) {
1229
+ const normalized = content.replace(/\r\n/g, '\n').replace(/\r/g, '\n').trim();
1230
+ if (!normalized)
1231
+ return null;
1232
+ const limited = normalized.length > this.maxCuratedReasoningChars
1233
+ ? normalized.slice(0, this.maxCuratedReasoningChars)
1234
+ : normalized;
1235
+ const segments = limited
1236
+ .split('\n')
1237
+ .flatMap(line => line.split(/(?<=[.?!])\s+/))
1238
+ .map(line => line.replace(/^[•*⏺○\-\u2022]+\s*/, '').trim())
1239
+ .filter(Boolean);
1240
+ if (segments.length === 0) {
1241
+ return null;
1242
+ }
1243
+ const seen = new Set();
1244
+ const deduped = [];
1245
+ for (const segment of segments) {
1246
+ const normalizedSegment = segment.replace(/\s+/g, ' ');
1247
+ const key = normalizedSegment.toLowerCase();
1248
+ if (seen.has(key)) {
1249
+ continue;
1250
+ }
1251
+ seen.add(key);
1252
+ deduped.push(normalizedSegment);
1253
+ if (deduped.length >= this.maxCuratedReasoningLines) {
1254
+ break;
1255
+ }
1256
+ }
1257
+ if (deduped.length === 0) {
1258
+ return null;
1259
+ }
1260
+ const structured = deduped.filter(line => this.looksStructuredThought(line));
1261
+ const selected = structured.length > 0 ? structured : deduped;
1262
+ const limitedSelection = selected.slice(0, this.maxCuratedReasoningLines);
1263
+ const bulleted = limitedSelection.map(line => this.ensureReasoningBullet(line));
1264
+ return bulleted.join('\n');
1265
+ }
1266
+ ensureReasoningBullet(line) {
1267
+ if (/^([•*⏺○\-]|\d+[.)])\s/.test(line)) {
1268
+ return line;
1269
+ }
1270
+ return `• ${line}`;
1271
+ }
1272
+ looksStructuredThought(line) {
1273
+ return (/^(\d+[.)]\s|step\s*\d+|plan\b|next\b|then\b|goal\b)/i.test(line) ||
1274
+ /^[-*•]\s/.test(line) ||
1275
+ line.includes('->') ||
1276
+ line.includes('→') ||
1277
+ line.includes(': '));
1278
+ }
1279
+ shouldRenderThought(content) {
1280
+ const normalized = content.replace(/\s+/g, ' ').trim().toLowerCase();
1281
+ if (!normalized) {
1282
+ return false;
1283
+ }
1284
+ const now = Date.now();
1285
+ if (this.lastCuratedThought && this.lastCuratedThought.text === normalized) {
1286
+ if (now - this.lastCuratedThought.at < this.thoughtDedupWindowMs) {
1287
+ return false;
1288
+ }
1289
+ }
1290
+ return true;
1291
+ }
1039
1292
  /**
1040
1293
  * Format text in Claude Code style: ⏺ prefix with wrapped continuation lines
1041
1294
  * Example:
@@ -1397,7 +1650,7 @@ export class UnifiedUIRenderer extends EventEmitter {
1397
1650
  }
1398
1651
  // Build the box
1399
1652
  const result = [];
1400
- const labelText = ' thinking ';
1653
+ const labelText = ' reasoning ';
1401
1654
  const headerLine = `╭─${labelText}${'─'.repeat(Math.max(0, maxBoxWidth - labelText.length - 4))}─╮`;
1402
1655
  result.push(thinkingStyle.border(headerLine));
1403
1656
  for (const line of wrappedLines) {
@@ -1630,14 +1883,21 @@ export class UnifiedUIRenderer extends EventEmitter {
1630
1883
  }
1631
1884
  // ------------ Prompt rendering ------------
1632
1885
  renderPrompt() {
1886
+ // Don't render if disposed
1887
+ if (this.disposed)
1888
+ return;
1633
1889
  // Throttle renders to prevent excessive redraws during rapid input
1634
1890
  const now = Date.now();
1635
1891
  if (now - this.lastRenderTime < this.renderThrottleMs) {
1636
1892
  if (!this.pendingRender) {
1637
1893
  this.pendingRender = true;
1638
- setTimeout(() => {
1894
+ // Track the timer for cleanup
1895
+ this.renderThrottleTimer = setTimeout(() => {
1896
+ this.renderThrottleTimer = null;
1639
1897
  this.pendingRender = false;
1640
- this.renderPromptImmediate();
1898
+ if (!this.disposed) {
1899
+ this.renderPromptImmediate();
1900
+ }
1641
1901
  }, this.renderThrottleMs);
1642
1902
  }
1643
1903
  return;
@@ -1645,6 +1905,9 @@ export class UnifiedUIRenderer extends EventEmitter {
1645
1905
  this.renderPromptImmediate();
1646
1906
  }
1647
1907
  renderPromptImmediate() {
1908
+ // Don't render if disposed
1909
+ if (this.disposed)
1910
+ return;
1648
1911
  this.lastRenderTime = Date.now();
1649
1912
  if (!this.interactive) {
1650
1913
  this.isPromptActive = false;
@@ -2347,7 +2610,9 @@ export class UnifiedUIRenderer extends EventEmitter {
2347
2610
  }
2348
2611
  setBuffer(text, cursorPos) {
2349
2612
  this.buffer = text;
2350
- this.cursor = cursorPos ?? text.length;
2613
+ // Validate cursor position to prevent out-of-bounds issues
2614
+ const requestedCursor = cursorPos ?? text.length;
2615
+ this.cursor = Math.max(0, Math.min(requestedCursor, text.length));
2351
2616
  this.inputRenderOffset = 0;
2352
2617
  this.updateSuggestions();
2353
2618
  this.renderPrompt();