erosolar-cli 1.7.194 → 1.7.195

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 (1089) hide show
  1. package/package.json +1 -1
  2. package/dist/StringUtils.d.ts +0 -8
  3. package/dist/StringUtils.d.ts.map +0 -1
  4. package/dist/StringUtils.js +0 -11
  5. package/dist/StringUtils.js.map +0 -1
  6. package/dist/adapters/browser/index.d.ts +0 -12
  7. package/dist/adapters/browser/index.d.ts.map +0 -1
  8. package/dist/adapters/browser/index.js +0 -11
  9. package/dist/adapters/browser/index.js.map +0 -1
  10. package/dist/adapters/node/index.d.ts +0 -17
  11. package/dist/adapters/node/index.d.ts.map +0 -1
  12. package/dist/adapters/node/index.js +0 -35
  13. package/dist/adapters/node/index.js.map +0 -1
  14. package/dist/adapters/remote/index.d.ts +0 -13
  15. package/dist/adapters/remote/index.d.ts.map +0 -1
  16. package/dist/adapters/remote/index.js +0 -20
  17. package/dist/adapters/remote/index.js.map +0 -1
  18. package/dist/adapters/types.d.ts +0 -14
  19. package/dist/adapters/types.d.ts.map +0 -1
  20. package/dist/adapters/types.js +0 -2
  21. package/dist/adapters/types.js.map +0 -1
  22. package/dist/alpha-zero/agentWrapper.d.ts +0 -84
  23. package/dist/alpha-zero/agentWrapper.d.ts.map +0 -1
  24. package/dist/alpha-zero/agentWrapper.js +0 -171
  25. package/dist/alpha-zero/agentWrapper.js.map +0 -1
  26. package/dist/alpha-zero/codeEvaluator.d.ts +0 -25
  27. package/dist/alpha-zero/codeEvaluator.d.ts.map +0 -1
  28. package/dist/alpha-zero/codeEvaluator.js +0 -273
  29. package/dist/alpha-zero/codeEvaluator.js.map +0 -1
  30. package/dist/alpha-zero/competitiveRunner.d.ts +0 -66
  31. package/dist/alpha-zero/competitiveRunner.d.ts.map +0 -1
  32. package/dist/alpha-zero/competitiveRunner.js +0 -224
  33. package/dist/alpha-zero/competitiveRunner.js.map +0 -1
  34. package/dist/alpha-zero/index.d.ts +0 -67
  35. package/dist/alpha-zero/index.d.ts.map +0 -1
  36. package/dist/alpha-zero/index.js +0 -99
  37. package/dist/alpha-zero/index.js.map +0 -1
  38. package/dist/alpha-zero/introspection.d.ts +0 -128
  39. package/dist/alpha-zero/introspection.d.ts.map +0 -1
  40. package/dist/alpha-zero/introspection.js +0 -300
  41. package/dist/alpha-zero/introspection.js.map +0 -1
  42. package/dist/alpha-zero/metricsTracker.d.ts +0 -71
  43. package/dist/alpha-zero/metricsTracker.d.ts.map +0 -1
  44. package/dist/alpha-zero/metricsTracker.js +0 -209
  45. package/dist/alpha-zero/metricsTracker.js.map +0 -1
  46. package/dist/alpha-zero/security/core.d.ts +0 -125
  47. package/dist/alpha-zero/security/core.d.ts.map +0 -1
  48. package/dist/alpha-zero/security/core.js +0 -271
  49. package/dist/alpha-zero/security/core.js.map +0 -1
  50. package/dist/alpha-zero/security/google.d.ts +0 -125
  51. package/dist/alpha-zero/security/google.d.ts.map +0 -1
  52. package/dist/alpha-zero/security/google.js +0 -311
  53. package/dist/alpha-zero/security/google.js.map +0 -1
  54. package/dist/alpha-zero/security/googleLoader.d.ts +0 -17
  55. package/dist/alpha-zero/security/googleLoader.d.ts.map +0 -1
  56. package/dist/alpha-zero/security/googleLoader.js +0 -41
  57. package/dist/alpha-zero/security/googleLoader.js.map +0 -1
  58. package/dist/alpha-zero/security/index.d.ts +0 -29
  59. package/dist/alpha-zero/security/index.d.ts.map +0 -1
  60. package/dist/alpha-zero/security/index.js +0 -32
  61. package/dist/alpha-zero/security/index.js.map +0 -1
  62. package/dist/alpha-zero/security/simulation.d.ts +0 -124
  63. package/dist/alpha-zero/security/simulation.d.ts.map +0 -1
  64. package/dist/alpha-zero/security/simulation.js +0 -277
  65. package/dist/alpha-zero/security/simulation.js.map +0 -1
  66. package/dist/alpha-zero/selfModification.d.ts +0 -109
  67. package/dist/alpha-zero/selfModification.d.ts.map +0 -1
  68. package/dist/alpha-zero/selfModification.js +0 -233
  69. package/dist/alpha-zero/selfModification.js.map +0 -1
  70. package/dist/alpha-zero/types.d.ts +0 -170
  71. package/dist/alpha-zero/types.d.ts.map +0 -1
  72. package/dist/alpha-zero/types.js +0 -31
  73. package/dist/alpha-zero/types.js.map +0 -1
  74. package/dist/bin/erosolar.d.ts +0 -9
  75. package/dist/bin/erosolar.d.ts.map +0 -1
  76. package/dist/bin/erosolar.js +0 -88
  77. package/dist/bin/erosolar.js.map +0 -1
  78. package/dist/bin/selfTest.d.ts +0 -14
  79. package/dist/bin/selfTest.d.ts.map +0 -1
  80. package/dist/bin/selfTest.js +0 -304
  81. package/dist/bin/selfTest.js.map +0 -1
  82. package/dist/browser/BrowserSessionManager.d.ts +0 -307
  83. package/dist/browser/BrowserSessionManager.d.ts.map +0 -1
  84. package/dist/browser/BrowserSessionManager.js +0 -713
  85. package/dist/browser/BrowserSessionManager.js.map +0 -1
  86. package/dist/capabilities/advancedTestGenerationCapability.d.ts +0 -17
  87. package/dist/capabilities/advancedTestGenerationCapability.d.ts.map +0 -1
  88. package/dist/capabilities/advancedTestGenerationCapability.js +0 -28
  89. package/dist/capabilities/advancedTestGenerationCapability.js.map +0 -1
  90. package/dist/capabilities/agentSpawningCapability.d.ts +0 -6
  91. package/dist/capabilities/agentSpawningCapability.d.ts.map +0 -1
  92. package/dist/capabilities/agentSpawningCapability.js +0 -115
  93. package/dist/capabilities/agentSpawningCapability.js.map +0 -1
  94. package/dist/capabilities/askUserCapability.d.ts +0 -21
  95. package/dist/capabilities/askUserCapability.d.ts.map +0 -1
  96. package/dist/capabilities/askUserCapability.js +0 -155
  97. package/dist/capabilities/askUserCapability.js.map +0 -1
  98. package/dist/capabilities/bashCapability.d.ts +0 -13
  99. package/dist/capabilities/bashCapability.d.ts.map +0 -1
  100. package/dist/capabilities/bashCapability.js +0 -24
  101. package/dist/capabilities/bashCapability.js.map +0 -1
  102. package/dist/capabilities/browserAutomationCapability.d.ts +0 -37
  103. package/dist/capabilities/browserAutomationCapability.d.ts.map +0 -1
  104. package/dist/capabilities/browserAutomationCapability.js +0 -49
  105. package/dist/capabilities/browserAutomationCapability.js.map +0 -1
  106. package/dist/capabilities/cloudCapability.d.ts +0 -13
  107. package/dist/capabilities/cloudCapability.d.ts.map +0 -1
  108. package/dist/capabilities/cloudCapability.js +0 -38
  109. package/dist/capabilities/cloudCapability.js.map +0 -1
  110. package/dist/capabilities/codeAnalysisCapability.d.ts +0 -13
  111. package/dist/capabilities/codeAnalysisCapability.d.ts.map +0 -1
  112. package/dist/capabilities/codeAnalysisCapability.js +0 -24
  113. package/dist/capabilities/codeAnalysisCapability.js.map +0 -1
  114. package/dist/capabilities/codeGenerationCapability.d.ts +0 -13
  115. package/dist/capabilities/codeGenerationCapability.d.ts.map +0 -1
  116. package/dist/capabilities/codeGenerationCapability.js +0 -25
  117. package/dist/capabilities/codeGenerationCapability.js.map +0 -1
  118. package/dist/capabilities/codeQualityCapability.d.ts +0 -13
  119. package/dist/capabilities/codeQualityCapability.d.ts.map +0 -1
  120. package/dist/capabilities/codeQualityCapability.js +0 -25
  121. package/dist/capabilities/codeQualityCapability.js.map +0 -1
  122. package/dist/capabilities/dependencySecurityCapability.d.ts +0 -13
  123. package/dist/capabilities/dependencySecurityCapability.d.ts.map +0 -1
  124. package/dist/capabilities/dependencySecurityCapability.js +0 -24
  125. package/dist/capabilities/dependencySecurityCapability.js.map +0 -1
  126. package/dist/capabilities/devCapability.d.ts +0 -13
  127. package/dist/capabilities/devCapability.d.ts.map +0 -1
  128. package/dist/capabilities/devCapability.js +0 -24
  129. package/dist/capabilities/devCapability.js.map +0 -1
  130. package/dist/capabilities/editCapability.d.ts +0 -17
  131. package/dist/capabilities/editCapability.d.ts.map +0 -1
  132. package/dist/capabilities/editCapability.js +0 -27
  133. package/dist/capabilities/editCapability.js.map +0 -1
  134. package/dist/capabilities/emailCapability.d.ts +0 -12
  135. package/dist/capabilities/emailCapability.d.ts.map +0 -1
  136. package/dist/capabilities/emailCapability.js +0 -22
  137. package/dist/capabilities/emailCapability.js.map +0 -1
  138. package/dist/capabilities/enhancedCodeIntelligenceCapability.d.ts +0 -17
  139. package/dist/capabilities/enhancedCodeIntelligenceCapability.d.ts.map +0 -1
  140. package/dist/capabilities/enhancedCodeIntelligenceCapability.js +0 -28
  141. package/dist/capabilities/enhancedCodeIntelligenceCapability.js.map +0 -1
  142. package/dist/capabilities/enhancedDevWorkflowCapability.d.ts +0 -17
  143. package/dist/capabilities/enhancedDevWorkflowCapability.d.ts.map +0 -1
  144. package/dist/capabilities/enhancedDevWorkflowCapability.js +0 -28
  145. package/dist/capabilities/enhancedDevWorkflowCapability.js.map +0 -1
  146. package/dist/capabilities/enhancedGitCapability.d.ts +0 -7
  147. package/dist/capabilities/enhancedGitCapability.d.ts.map +0 -1
  148. package/dist/capabilities/enhancedGitCapability.js +0 -220
  149. package/dist/capabilities/enhancedGitCapability.js.map +0 -1
  150. package/dist/capabilities/filesystemCapability.d.ts +0 -13
  151. package/dist/capabilities/filesystemCapability.d.ts.map +0 -1
  152. package/dist/capabilities/filesystemCapability.js +0 -24
  153. package/dist/capabilities/filesystemCapability.js.map +0 -1
  154. package/dist/capabilities/frontendTestingCapability.d.ts +0 -13
  155. package/dist/capabilities/frontendTestingCapability.d.ts.map +0 -1
  156. package/dist/capabilities/frontendTestingCapability.js +0 -28
  157. package/dist/capabilities/frontendTestingCapability.js.map +0 -1
  158. package/dist/capabilities/globCapability.d.ts +0 -17
  159. package/dist/capabilities/globCapability.d.ts.map +0 -1
  160. package/dist/capabilities/globCapability.js +0 -27
  161. package/dist/capabilities/globCapability.js.map +0 -1
  162. package/dist/capabilities/index.d.ts +0 -25
  163. package/dist/capabilities/index.d.ts.map +0 -1
  164. package/dist/capabilities/index.js +0 -25
  165. package/dist/capabilities/index.js.map +0 -1
  166. package/dist/capabilities/interactionCapability.d.ts +0 -12
  167. package/dist/capabilities/interactionCapability.d.ts.map +0 -1
  168. package/dist/capabilities/interactionCapability.js +0 -22
  169. package/dist/capabilities/interactionCapability.js.map +0 -1
  170. package/dist/capabilities/learnCapability.d.ts +0 -13
  171. package/dist/capabilities/learnCapability.d.ts.map +0 -1
  172. package/dist/capabilities/learnCapability.js +0 -24
  173. package/dist/capabilities/learnCapability.js.map +0 -1
  174. package/dist/capabilities/mcpCapability.d.ts +0 -6
  175. package/dist/capabilities/mcpCapability.d.ts.map +0 -1
  176. package/dist/capabilities/mcpCapability.js +0 -19
  177. package/dist/capabilities/mcpCapability.js.map +0 -1
  178. package/dist/capabilities/notebookCapability.d.ts +0 -17
  179. package/dist/capabilities/notebookCapability.d.ts.map +0 -1
  180. package/dist/capabilities/notebookCapability.js +0 -27
  181. package/dist/capabilities/notebookCapability.js.map +0 -1
  182. package/dist/capabilities/performanceMonitoringCapability.d.ts +0 -108
  183. package/dist/capabilities/performanceMonitoringCapability.d.ts.map +0 -1
  184. package/dist/capabilities/performanceMonitoringCapability.js +0 -176
  185. package/dist/capabilities/performanceMonitoringCapability.js.map +0 -1
  186. package/dist/capabilities/planningCapability.d.ts +0 -16
  187. package/dist/capabilities/planningCapability.d.ts.map +0 -1
  188. package/dist/capabilities/planningCapability.js +0 -26
  189. package/dist/capabilities/planningCapability.js.map +0 -1
  190. package/dist/capabilities/refactoringCapability.d.ts +0 -13
  191. package/dist/capabilities/refactoringCapability.d.ts.map +0 -1
  192. package/dist/capabilities/refactoringCapability.js +0 -25
  193. package/dist/capabilities/refactoringCapability.js.map +0 -1
  194. package/dist/capabilities/repoChecksCapability.d.ts +0 -10
  195. package/dist/capabilities/repoChecksCapability.d.ts.map +0 -1
  196. package/dist/capabilities/repoChecksCapability.js +0 -24
  197. package/dist/capabilities/repoChecksCapability.js.map +0 -1
  198. package/dist/capabilities/searchCapability.d.ts +0 -13
  199. package/dist/capabilities/searchCapability.d.ts.map +0 -1
  200. package/dist/capabilities/searchCapability.js +0 -24
  201. package/dist/capabilities/searchCapability.js.map +0 -1
  202. package/dist/capabilities/skillCapability.d.ts +0 -3
  203. package/dist/capabilities/skillCapability.d.ts.map +0 -1
  204. package/dist/capabilities/skillCapability.js +0 -77
  205. package/dist/capabilities/skillCapability.js.map +0 -1
  206. package/dist/capabilities/taskManagementCapability.d.ts +0 -12
  207. package/dist/capabilities/taskManagementCapability.d.ts.map +0 -1
  208. package/dist/capabilities/taskManagementCapability.js +0 -22
  209. package/dist/capabilities/taskManagementCapability.js.map +0 -1
  210. package/dist/capabilities/testingCapability.d.ts +0 -13
  211. package/dist/capabilities/testingCapability.d.ts.map +0 -1
  212. package/dist/capabilities/testingCapability.js +0 -25
  213. package/dist/capabilities/testingCapability.js.map +0 -1
  214. package/dist/capabilities/todoCapability.d.ts +0 -19
  215. package/dist/capabilities/todoCapability.d.ts.map +0 -1
  216. package/dist/capabilities/todoCapability.js +0 -169
  217. package/dist/capabilities/todoCapability.js.map +0 -1
  218. package/dist/capabilities/toolManifest.d.ts +0 -3
  219. package/dist/capabilities/toolManifest.d.ts.map +0 -1
  220. package/dist/capabilities/toolManifest.js +0 -160
  221. package/dist/capabilities/toolManifest.js.map +0 -1
  222. package/dist/capabilities/toolRegistry.d.ts +0 -22
  223. package/dist/capabilities/toolRegistry.d.ts.map +0 -1
  224. package/dist/capabilities/toolRegistry.js +0 -115
  225. package/dist/capabilities/toolRegistry.js.map +0 -1
  226. package/dist/capabilities/validationCapability.d.ts +0 -13
  227. package/dist/capabilities/validationCapability.d.ts.map +0 -1
  228. package/dist/capabilities/validationCapability.js +0 -24
  229. package/dist/capabilities/validationCapability.js.map +0 -1
  230. package/dist/capabilities/webCapability.d.ts +0 -12
  231. package/dist/capabilities/webCapability.d.ts.map +0 -1
  232. package/dist/capabilities/webCapability.js +0 -22
  233. package/dist/capabilities/webCapability.js.map +0 -1
  234. package/dist/config.d.ts +0 -25
  235. package/dist/config.d.ts.map +0 -1
  236. package/dist/config.js +0 -140
  237. package/dist/config.js.map +0 -1
  238. package/dist/contracts/v1/agent.d.ts +0 -147
  239. package/dist/contracts/v1/agent.d.ts.map +0 -1
  240. package/dist/contracts/v1/agent.js +0 -8
  241. package/dist/contracts/v1/agent.js.map +0 -1
  242. package/dist/contracts/v1/agentProfileManifest.d.ts +0 -60
  243. package/dist/contracts/v1/agentProfileManifest.d.ts.map +0 -1
  244. package/dist/contracts/v1/agentProfileManifest.js +0 -9
  245. package/dist/contracts/v1/agentProfileManifest.js.map +0 -1
  246. package/dist/contracts/v1/agentRules.d.ts +0 -60
  247. package/dist/contracts/v1/agentRules.d.ts.map +0 -1
  248. package/dist/contracts/v1/agentRules.js +0 -10
  249. package/dist/contracts/v1/agentRules.js.map +0 -1
  250. package/dist/contracts/v1/provider.d.ts +0 -149
  251. package/dist/contracts/v1/provider.d.ts.map +0 -1
  252. package/dist/contracts/v1/provider.js +0 -7
  253. package/dist/contracts/v1/provider.js.map +0 -1
  254. package/dist/contracts/v1/tool.d.ts +0 -136
  255. package/dist/contracts/v1/tool.d.ts.map +0 -1
  256. package/dist/contracts/v1/tool.js +0 -7
  257. package/dist/contracts/v1/tool.js.map +0 -1
  258. package/dist/contracts/v1/toolAccess.d.ts +0 -43
  259. package/dist/contracts/v1/toolAccess.d.ts.map +0 -1
  260. package/dist/contracts/v1/toolAccess.js +0 -9
  261. package/dist/contracts/v1/toolAccess.js.map +0 -1
  262. package/dist/core/LazyLoader.d.ts +0 -129
  263. package/dist/core/LazyLoader.d.ts.map +0 -1
  264. package/dist/core/LazyLoader.js +0 -240
  265. package/dist/core/LazyLoader.js.map +0 -1
  266. package/dist/core/agent.d.ts +0 -144
  267. package/dist/core/agent.d.ts.map +0 -1
  268. package/dist/core/agent.js +0 -780
  269. package/dist/core/agent.js.map +0 -1
  270. package/dist/core/agentProfileManifest.d.ts +0 -3
  271. package/dist/core/agentProfileManifest.d.ts.map +0 -1
  272. package/dist/core/agentProfileManifest.js +0 -188
  273. package/dist/core/agentProfileManifest.js.map +0 -1
  274. package/dist/core/agentProfiles.d.ts +0 -22
  275. package/dist/core/agentProfiles.d.ts.map +0 -1
  276. package/dist/core/agentProfiles.js +0 -35
  277. package/dist/core/agentProfiles.js.map +0 -1
  278. package/dist/core/agentRulebook.d.ts +0 -11
  279. package/dist/core/agentRulebook.d.ts.map +0 -1
  280. package/dist/core/agentRulebook.js +0 -136
  281. package/dist/core/agentRulebook.js.map +0 -1
  282. package/dist/core/agentSchemaLoader.d.ts +0 -131
  283. package/dist/core/agentSchemaLoader.d.ts.map +0 -1
  284. package/dist/core/agentSchemaLoader.js +0 -234
  285. package/dist/core/agentSchemaLoader.js.map +0 -1
  286. package/dist/core/cliTestHarness.d.ts +0 -200
  287. package/dist/core/cliTestHarness.d.ts.map +0 -1
  288. package/dist/core/cliTestHarness.js +0 -549
  289. package/dist/core/cliTestHarness.js.map +0 -1
  290. package/dist/core/contextManager.d.ts +0 -259
  291. package/dist/core/contextManager.d.ts.map +0 -1
  292. package/dist/core/contextManager.js +0 -1057
  293. package/dist/core/contextManager.js.map +0 -1
  294. package/dist/core/contextWindow.d.ts +0 -42
  295. package/dist/core/contextWindow.d.ts.map +0 -1
  296. package/dist/core/contextWindow.js +0 -123
  297. package/dist/core/contextWindow.js.map +0 -1
  298. package/dist/core/customCommands.d.ts +0 -18
  299. package/dist/core/customCommands.d.ts.map +0 -1
  300. package/dist/core/customCommands.js +0 -81
  301. package/dist/core/customCommands.js.map +0 -1
  302. package/dist/core/errors/apiKeyErrors.d.ts +0 -11
  303. package/dist/core/errors/apiKeyErrors.d.ts.map +0 -1
  304. package/dist/core/errors/apiKeyErrors.js +0 -159
  305. package/dist/core/errors/apiKeyErrors.js.map +0 -1
  306. package/dist/core/errors/errorTypes.d.ts +0 -111
  307. package/dist/core/errors/errorTypes.d.ts.map +0 -1
  308. package/dist/core/errors/errorTypes.js +0 -348
  309. package/dist/core/errors/errorTypes.js.map +0 -1
  310. package/dist/core/errors/safetyValidator.d.ts +0 -71
  311. package/dist/core/errors/safetyValidator.d.ts.map +0 -1
  312. package/dist/core/errors/safetyValidator.js +0 -302
  313. package/dist/core/errors/safetyValidator.js.map +0 -1
  314. package/dist/core/errors.d.ts +0 -4
  315. package/dist/core/errors.d.ts.map +0 -1
  316. package/dist/core/errors.js +0 -33
  317. package/dist/core/errors.js.map +0 -1
  318. package/dist/core/isolatedVerifier.d.ts +0 -40
  319. package/dist/core/isolatedVerifier.d.ts.map +0 -1
  320. package/dist/core/isolatedVerifier.js +0 -129
  321. package/dist/core/isolatedVerifier.js.map +0 -1
  322. package/dist/core/modelDiscovery.d.ts +0 -101
  323. package/dist/core/modelDiscovery.d.ts.map +0 -1
  324. package/dist/core/modelDiscovery.js +0 -780
  325. package/dist/core/modelDiscovery.js.map +0 -1
  326. package/dist/core/multilinePasteHandler.d.ts +0 -35
  327. package/dist/core/multilinePasteHandler.d.ts.map +0 -1
  328. package/dist/core/multilinePasteHandler.js +0 -80
  329. package/dist/core/multilinePasteHandler.js.map +0 -1
  330. package/dist/core/performanceMonitor.d.ts +0 -124
  331. package/dist/core/performanceMonitor.d.ts.map +0 -1
  332. package/dist/core/performanceMonitor.js +0 -195
  333. package/dist/core/performanceMonitor.js.map +0 -1
  334. package/dist/core/preferences.d.ts +0 -31
  335. package/dist/core/preferences.d.ts.map +0 -1
  336. package/dist/core/preferences.js +0 -232
  337. package/dist/core/preferences.js.map +0 -1
  338. package/dist/core/responseVerifier.d.ts +0 -98
  339. package/dist/core/responseVerifier.d.ts.map +0 -1
  340. package/dist/core/responseVerifier.js +0 -509
  341. package/dist/core/responseVerifier.js.map +0 -1
  342. package/dist/core/resultVerification.d.ts +0 -141
  343. package/dist/core/resultVerification.d.ts.map +0 -1
  344. package/dist/core/resultVerification.js +0 -482
  345. package/dist/core/resultVerification.js.map +0 -1
  346. package/dist/core/schemaValidator.d.ts +0 -44
  347. package/dist/core/schemaValidator.d.ts.map +0 -1
  348. package/dist/core/schemaValidator.js +0 -155
  349. package/dist/core/schemaValidator.js.map +0 -1
  350. package/dist/core/secretStore.d.ts +0 -47
  351. package/dist/core/secretStore.d.ts.map +0 -1
  352. package/dist/core/secretStore.js +0 -364
  353. package/dist/core/secretStore.js.map +0 -1
  354. package/dist/core/sessionStore.d.ts +0 -33
  355. package/dist/core/sessionStore.d.ts.map +0 -1
  356. package/dist/core/sessionStore.js +0 -188
  357. package/dist/core/sessionStore.js.map +0 -1
  358. package/dist/core/testUtils.d.ts +0 -121
  359. package/dist/core/testUtils.d.ts.map +0 -1
  360. package/dist/core/testUtils.js +0 -235
  361. package/dist/core/testUtils.js.map +0 -1
  362. package/dist/core/toolPreconditions.d.ts +0 -41
  363. package/dist/core/toolPreconditions.d.ts.map +0 -1
  364. package/dist/core/toolPreconditions.js +0 -319
  365. package/dist/core/toolPreconditions.js.map +0 -1
  366. package/dist/core/toolRuntime.d.ts +0 -137
  367. package/dist/core/toolRuntime.d.ts.map +0 -1
  368. package/dist/core/toolRuntime.js +0 -375
  369. package/dist/core/toolRuntime.js.map +0 -1
  370. package/dist/core/types.d.ts +0 -306
  371. package/dist/core/types.d.ts.map +0 -1
  372. package/dist/core/types.js +0 -76
  373. package/dist/core/types.js.map +0 -1
  374. package/dist/core/unified/errors.d.ts +0 -189
  375. package/dist/core/unified/errors.d.ts.map +0 -1
  376. package/dist/core/unified/errors.js +0 -497
  377. package/dist/core/unified/errors.js.map +0 -1
  378. package/dist/core/unified/index.d.ts +0 -19
  379. package/dist/core/unified/index.d.ts.map +0 -1
  380. package/dist/core/unified/index.js +0 -68
  381. package/dist/core/unified/index.js.map +0 -1
  382. package/dist/core/unified/schema.d.ts +0 -101
  383. package/dist/core/unified/schema.d.ts.map +0 -1
  384. package/dist/core/unified/schema.js +0 -350
  385. package/dist/core/unified/schema.js.map +0 -1
  386. package/dist/core/unified/toolRuntime.d.ts +0 -179
  387. package/dist/core/unified/toolRuntime.d.ts.map +0 -1
  388. package/dist/core/unified/toolRuntime.js +0 -517
  389. package/dist/core/unified/toolRuntime.js.map +0 -1
  390. package/dist/core/unified/tools.d.ts +0 -127
  391. package/dist/core/unified/tools.d.ts.map +0 -1
  392. package/dist/core/unified/tools.js +0 -1333
  393. package/dist/core/unified/tools.js.map +0 -1
  394. package/dist/core/unified/types.d.ts +0 -352
  395. package/dist/core/unified/types.d.ts.map +0 -1
  396. package/dist/core/unified/types.js +0 -12
  397. package/dist/core/unified/types.js.map +0 -1
  398. package/dist/core/unified/version.d.ts +0 -209
  399. package/dist/core/unified/version.d.ts.map +0 -1
  400. package/dist/core/unified/version.js +0 -454
  401. package/dist/core/unified/version.js.map +0 -1
  402. package/dist/core/validationRunner.d.ts +0 -93
  403. package/dist/core/validationRunner.d.ts.map +0 -1
  404. package/dist/core/validationRunner.js +0 -740
  405. package/dist/core/validationRunner.js.map +0 -1
  406. package/dist/headless/headlessApp.d.ts +0 -5
  407. package/dist/headless/headlessApp.d.ts.map +0 -1
  408. package/dist/headless/headlessApp.js +0 -189
  409. package/dist/headless/headlessApp.js.map +0 -1
  410. package/dist/intelligence/codeIntelligence.d.ts +0 -84
  411. package/dist/intelligence/codeIntelligence.d.ts.map +0 -1
  412. package/dist/intelligence/codeIntelligence.js +0 -493
  413. package/dist/intelligence/codeIntelligence.js.map +0 -1
  414. package/dist/intelligence/docGenerator.d.ts +0 -86
  415. package/dist/intelligence/docGenerator.d.ts.map +0 -1
  416. package/dist/intelligence/docGenerator.js +0 -564
  417. package/dist/intelligence/docGenerator.js.map +0 -1
  418. package/dist/intelligence/index.d.ts +0 -51
  419. package/dist/intelligence/index.d.ts.map +0 -1
  420. package/dist/intelligence/index.js +0 -253
  421. package/dist/intelligence/index.js.map +0 -1
  422. package/dist/intelligence/refactoring.d.ts +0 -50
  423. package/dist/intelligence/refactoring.d.ts.map +0 -1
  424. package/dist/intelligence/refactoring.js +0 -354
  425. package/dist/intelligence/refactoring.js.map +0 -1
  426. package/dist/intelligence/testGenerator.d.ts +0 -74
  427. package/dist/intelligence/testGenerator.d.ts.map +0 -1
  428. package/dist/intelligence/testGenerator.js +0 -483
  429. package/dist/intelligence/testGenerator.js.map +0 -1
  430. package/dist/mcp/config.d.ts +0 -8
  431. package/dist/mcp/config.d.ts.map +0 -1
  432. package/dist/mcp/config.js +0 -252
  433. package/dist/mcp/config.js.map +0 -1
  434. package/dist/mcp/sseClient.d.ts +0 -34
  435. package/dist/mcp/sseClient.d.ts.map +0 -1
  436. package/dist/mcp/sseClient.js +0 -299
  437. package/dist/mcp/sseClient.js.map +0 -1
  438. package/dist/mcp/stdioClient.d.ts +0 -24
  439. package/dist/mcp/stdioClient.d.ts.map +0 -1
  440. package/dist/mcp/stdioClient.js +0 -179
  441. package/dist/mcp/stdioClient.js.map +0 -1
  442. package/dist/mcp/toolBridge.d.ts +0 -12
  443. package/dist/mcp/toolBridge.d.ts.map +0 -1
  444. package/dist/mcp/toolBridge.js +0 -117
  445. package/dist/mcp/toolBridge.js.map +0 -1
  446. package/dist/mcp/types.d.ts +0 -60
  447. package/dist/mcp/types.d.ts.map +0 -1
  448. package/dist/mcp/types.js +0 -2
  449. package/dist/mcp/types.js.map +0 -1
  450. package/dist/plugins/index.d.ts +0 -49
  451. package/dist/plugins/index.d.ts.map +0 -1
  452. package/dist/plugins/index.js +0 -114
  453. package/dist/plugins/index.js.map +0 -1
  454. package/dist/plugins/providers/anthropic/index.d.ts +0 -11
  455. package/dist/plugins/providers/anthropic/index.d.ts.map +0 -1
  456. package/dist/plugins/providers/anthropic/index.js +0 -38
  457. package/dist/plugins/providers/anthropic/index.js.map +0 -1
  458. package/dist/plugins/providers/deepseek/index.d.ts +0 -11
  459. package/dist/plugins/providers/deepseek/index.d.ts.map +0 -1
  460. package/dist/plugins/providers/deepseek/index.js +0 -52
  461. package/dist/plugins/providers/deepseek/index.js.map +0 -1
  462. package/dist/plugins/providers/google/index.d.ts +0 -11
  463. package/dist/plugins/providers/google/index.d.ts.map +0 -1
  464. package/dist/plugins/providers/google/index.js +0 -40
  465. package/dist/plugins/providers/google/index.js.map +0 -1
  466. package/dist/plugins/providers/index.d.ts +0 -2
  467. package/dist/plugins/providers/index.d.ts.map +0 -1
  468. package/dist/plugins/providers/index.js +0 -20
  469. package/dist/plugins/providers/index.js.map +0 -1
  470. package/dist/plugins/providers/ollama/index.d.ts +0 -21
  471. package/dist/plugins/providers/ollama/index.d.ts.map +0 -1
  472. package/dist/plugins/providers/ollama/index.js +0 -69
  473. package/dist/plugins/providers/ollama/index.js.map +0 -1
  474. package/dist/plugins/providers/openai/index.d.ts +0 -12
  475. package/dist/plugins/providers/openai/index.d.ts.map +0 -1
  476. package/dist/plugins/providers/openai/index.js +0 -39
  477. package/dist/plugins/providers/openai/index.js.map +0 -1
  478. package/dist/plugins/providers/xai/index.d.ts +0 -11
  479. package/dist/plugins/providers/xai/index.d.ts.map +0 -1
  480. package/dist/plugins/providers/xai/index.js +0 -39
  481. package/dist/plugins/providers/xai/index.js.map +0 -1
  482. package/dist/plugins/tools/agentSpawning/agentSpawningPlugin.d.ts +0 -3
  483. package/dist/plugins/tools/agentSpawning/agentSpawningPlugin.d.ts.map +0 -1
  484. package/dist/plugins/tools/agentSpawning/agentSpawningPlugin.js +0 -9
  485. package/dist/plugins/tools/agentSpawning/agentSpawningPlugin.js.map +0 -1
  486. package/dist/plugins/tools/bash/localBashPlugin.d.ts +0 -3
  487. package/dist/plugins/tools/bash/localBashPlugin.d.ts.map +0 -1
  488. package/dist/plugins/tools/bash/localBashPlugin.js +0 -14
  489. package/dist/plugins/tools/bash/localBashPlugin.js.map +0 -1
  490. package/dist/plugins/tools/browser/browserAutomationPlugin.d.ts +0 -14
  491. package/dist/plugins/tools/browser/browserAutomationPlugin.d.ts.map +0 -1
  492. package/dist/plugins/tools/browser/browserAutomationPlugin.js +0 -26
  493. package/dist/plugins/tools/browser/browserAutomationPlugin.js.map +0 -1
  494. package/dist/plugins/tools/checks/localRepoChecksPlugin.d.ts +0 -3
  495. package/dist/plugins/tools/checks/localRepoChecksPlugin.d.ts.map +0 -1
  496. package/dist/plugins/tools/checks/localRepoChecksPlugin.js +0 -14
  497. package/dist/plugins/tools/checks/localRepoChecksPlugin.js.map +0 -1
  498. package/dist/plugins/tools/cloud/cloudPlugin.d.ts +0 -3
  499. package/dist/plugins/tools/cloud/cloudPlugin.d.ts.map +0 -1
  500. package/dist/plugins/tools/cloud/cloudPlugin.js +0 -14
  501. package/dist/plugins/tools/cloud/cloudPlugin.js.map +0 -1
  502. package/dist/plugins/tools/codeAnalysis/codeAnalysisPlugin.d.ts +0 -3
  503. package/dist/plugins/tools/codeAnalysis/codeAnalysisPlugin.d.ts.map +0 -1
  504. package/dist/plugins/tools/codeAnalysis/codeAnalysisPlugin.js +0 -14
  505. package/dist/plugins/tools/codeAnalysis/codeAnalysisPlugin.js.map +0 -1
  506. package/dist/plugins/tools/codeQuality/codeQualityPlugin.d.ts +0 -3
  507. package/dist/plugins/tools/codeQuality/codeQualityPlugin.d.ts.map +0 -1
  508. package/dist/plugins/tools/codeQuality/codeQualityPlugin.js +0 -14
  509. package/dist/plugins/tools/codeQuality/codeQualityPlugin.js.map +0 -1
  510. package/dist/plugins/tools/dependency/dependencyPlugin.d.ts +0 -3
  511. package/dist/plugins/tools/dependency/dependencyPlugin.d.ts.map +0 -1
  512. package/dist/plugins/tools/dependency/dependencyPlugin.js +0 -12
  513. package/dist/plugins/tools/dependency/dependencyPlugin.js.map +0 -1
  514. package/dist/plugins/tools/development/devPlugin.d.ts +0 -3
  515. package/dist/plugins/tools/development/devPlugin.d.ts.map +0 -1
  516. package/dist/plugins/tools/development/devPlugin.js +0 -14
  517. package/dist/plugins/tools/development/devPlugin.js.map +0 -1
  518. package/dist/plugins/tools/edit/editPlugin.d.ts +0 -9
  519. package/dist/plugins/tools/edit/editPlugin.d.ts.map +0 -1
  520. package/dist/plugins/tools/edit/editPlugin.js +0 -15
  521. package/dist/plugins/tools/edit/editPlugin.js.map +0 -1
  522. package/dist/plugins/tools/email/emailPlugin.d.ts +0 -3
  523. package/dist/plugins/tools/email/emailPlugin.d.ts.map +0 -1
  524. package/dist/plugins/tools/email/emailPlugin.js +0 -12
  525. package/dist/plugins/tools/email/emailPlugin.js.map +0 -1
  526. package/dist/plugins/tools/enhancedGit/enhancedGitPlugin.d.ts +0 -3
  527. package/dist/plugins/tools/enhancedGit/enhancedGitPlugin.d.ts.map +0 -1
  528. package/dist/plugins/tools/enhancedGit/enhancedGitPlugin.js +0 -9
  529. package/dist/plugins/tools/enhancedGit/enhancedGitPlugin.js.map +0 -1
  530. package/dist/plugins/tools/filesystem/localFilesystemPlugin.d.ts +0 -3
  531. package/dist/plugins/tools/filesystem/localFilesystemPlugin.d.ts.map +0 -1
  532. package/dist/plugins/tools/filesystem/localFilesystemPlugin.js +0 -14
  533. package/dist/plugins/tools/filesystem/localFilesystemPlugin.js.map +0 -1
  534. package/dist/plugins/tools/frontendTesting/frontendTestingPlugin.d.ts +0 -3
  535. package/dist/plugins/tools/frontendTesting/frontendTestingPlugin.d.ts.map +0 -1
  536. package/dist/plugins/tools/frontendTesting/frontendTestingPlugin.js +0 -14
  537. package/dist/plugins/tools/frontendTesting/frontendTestingPlugin.js.map +0 -1
  538. package/dist/plugins/tools/glob/globPlugin.d.ts +0 -9
  539. package/dist/plugins/tools/glob/globPlugin.d.ts.map +0 -1
  540. package/dist/plugins/tools/glob/globPlugin.js +0 -15
  541. package/dist/plugins/tools/glob/globPlugin.js.map +0 -1
  542. package/dist/plugins/tools/index.d.ts +0 -3
  543. package/dist/plugins/tools/index.d.ts.map +0 -1
  544. package/dist/plugins/tools/index.js +0 -3
  545. package/dist/plugins/tools/index.js.map +0 -1
  546. package/dist/plugins/tools/interaction/interactionPlugin.d.ts +0 -3
  547. package/dist/plugins/tools/interaction/interactionPlugin.d.ts.map +0 -1
  548. package/dist/plugins/tools/interaction/interactionPlugin.js +0 -12
  549. package/dist/plugins/tools/interaction/interactionPlugin.js.map +0 -1
  550. package/dist/plugins/tools/learn/learnPlugin.d.ts +0 -3
  551. package/dist/plugins/tools/learn/learnPlugin.d.ts.map +0 -1
  552. package/dist/plugins/tools/learn/learnPlugin.js +0 -14
  553. package/dist/plugins/tools/learn/learnPlugin.js.map +0 -1
  554. package/dist/plugins/tools/mcp/mcpPlugin.d.ts +0 -3
  555. package/dist/plugins/tools/mcp/mcpPlugin.d.ts.map +0 -1
  556. package/dist/plugins/tools/mcp/mcpPlugin.js +0 -9
  557. package/dist/plugins/tools/mcp/mcpPlugin.js.map +0 -1
  558. package/dist/plugins/tools/nodeDefaults.d.ts +0 -2
  559. package/dist/plugins/tools/nodeDefaults.d.ts.map +0 -1
  560. package/dist/plugins/tools/nodeDefaults.js +0 -63
  561. package/dist/plugins/tools/nodeDefaults.js.map +0 -1
  562. package/dist/plugins/tools/notebook/notebookPlugin.d.ts +0 -9
  563. package/dist/plugins/tools/notebook/notebookPlugin.d.ts.map +0 -1
  564. package/dist/plugins/tools/notebook/notebookPlugin.js +0 -15
  565. package/dist/plugins/tools/notebook/notebookPlugin.js.map +0 -1
  566. package/dist/plugins/tools/planning/planningPlugin.d.ts +0 -9
  567. package/dist/plugins/tools/planning/planningPlugin.d.ts.map +0 -1
  568. package/dist/plugins/tools/planning/planningPlugin.js +0 -15
  569. package/dist/plugins/tools/planning/planningPlugin.js.map +0 -1
  570. package/dist/plugins/tools/refactoring/refactoringPlugin.d.ts +0 -3
  571. package/dist/plugins/tools/refactoring/refactoringPlugin.d.ts.map +0 -1
  572. package/dist/plugins/tools/refactoring/refactoringPlugin.js +0 -12
  573. package/dist/plugins/tools/refactoring/refactoringPlugin.js.map +0 -1
  574. package/dist/plugins/tools/registry.d.ts +0 -22
  575. package/dist/plugins/tools/registry.d.ts.map +0 -1
  576. package/dist/plugins/tools/registry.js +0 -58
  577. package/dist/plugins/tools/registry.js.map +0 -1
  578. package/dist/plugins/tools/search/localSearchPlugin.d.ts +0 -3
  579. package/dist/plugins/tools/search/localSearchPlugin.d.ts.map +0 -1
  580. package/dist/plugins/tools/search/localSearchPlugin.js +0 -14
  581. package/dist/plugins/tools/search/localSearchPlugin.js.map +0 -1
  582. package/dist/plugins/tools/skills/skillPlugin.d.ts +0 -3
  583. package/dist/plugins/tools/skills/skillPlugin.d.ts.map +0 -1
  584. package/dist/plugins/tools/skills/skillPlugin.js +0 -9
  585. package/dist/plugins/tools/skills/skillPlugin.js.map +0 -1
  586. package/dist/plugins/tools/taskManagement/taskManagementPlugin.d.ts +0 -3
  587. package/dist/plugins/tools/taskManagement/taskManagementPlugin.d.ts.map +0 -1
  588. package/dist/plugins/tools/taskManagement/taskManagementPlugin.js +0 -12
  589. package/dist/plugins/tools/taskManagement/taskManagementPlugin.js.map +0 -1
  590. package/dist/plugins/tools/testing/testingPlugin.d.ts +0 -3
  591. package/dist/plugins/tools/testing/testingPlugin.d.ts.map +0 -1
  592. package/dist/plugins/tools/testing/testingPlugin.js +0 -12
  593. package/dist/plugins/tools/testing/testingPlugin.js.map +0 -1
  594. package/dist/plugins/tools/validation/validationPlugin.d.ts +0 -3
  595. package/dist/plugins/tools/validation/validationPlugin.d.ts.map +0 -1
  596. package/dist/plugins/tools/validation/validationPlugin.js +0 -14
  597. package/dist/plugins/tools/validation/validationPlugin.js.map +0 -1
  598. package/dist/plugins/tools/web/webPlugin.d.ts +0 -3
  599. package/dist/plugins/tools/web/webPlugin.d.ts.map +0 -1
  600. package/dist/plugins/tools/web/webPlugin.js +0 -12
  601. package/dist/plugins/tools/web/webPlugin.js.map +0 -1
  602. package/dist/providers/anthropicProvider.d.ts +0 -41
  603. package/dist/providers/anthropicProvider.d.ts.map +0 -1
  604. package/dist/providers/anthropicProvider.js +0 -446
  605. package/dist/providers/anthropicProvider.js.map +0 -1
  606. package/dist/providers/googleProvider.d.ts +0 -36
  607. package/dist/providers/googleProvider.d.ts.map +0 -1
  608. package/dist/providers/googleProvider.js +0 -312
  609. package/dist/providers/googleProvider.js.map +0 -1
  610. package/dist/providers/openaiChatCompletionsProvider.d.ts +0 -43
  611. package/dist/providers/openaiChatCompletionsProvider.d.ts.map +0 -1
  612. package/dist/providers/openaiChatCompletionsProvider.js +0 -468
  613. package/dist/providers/openaiChatCompletionsProvider.js.map +0 -1
  614. package/dist/providers/openaiResponsesProvider.d.ts +0 -38
  615. package/dist/providers/openaiResponsesProvider.d.ts.map +0 -1
  616. package/dist/providers/openaiResponsesProvider.js +0 -364
  617. package/dist/providers/openaiResponsesProvider.js.map +0 -1
  618. package/dist/providers/providerFactory.d.ts +0 -18
  619. package/dist/providers/providerFactory.d.ts.map +0 -1
  620. package/dist/providers/providerFactory.js +0 -25
  621. package/dist/providers/providerFactory.js.map +0 -1
  622. package/dist/providers/resilientProvider.d.ts +0 -94
  623. package/dist/providers/resilientProvider.d.ts.map +0 -1
  624. package/dist/providers/resilientProvider.js +0 -370
  625. package/dist/providers/resilientProvider.js.map +0 -1
  626. package/dist/runtime/agentController.d.ts +0 -65
  627. package/dist/runtime/agentController.d.ts.map +0 -1
  628. package/dist/runtime/agentController.js +0 -353
  629. package/dist/runtime/agentController.js.map +0 -1
  630. package/dist/runtime/agentHost.d.ts +0 -61
  631. package/dist/runtime/agentHost.d.ts.map +0 -1
  632. package/dist/runtime/agentHost.js +0 -156
  633. package/dist/runtime/agentHost.js.map +0 -1
  634. package/dist/runtime/agentSession.d.ts +0 -40
  635. package/dist/runtime/agentSession.d.ts.map +0 -1
  636. package/dist/runtime/agentSession.js +0 -206
  637. package/dist/runtime/agentSession.js.map +0 -1
  638. package/dist/runtime/browser.d.ts +0 -7
  639. package/dist/runtime/browser.d.ts.map +0 -1
  640. package/dist/runtime/browser.js +0 -10
  641. package/dist/runtime/browser.js.map +0 -1
  642. package/dist/runtime/cloud.d.ts +0 -7
  643. package/dist/runtime/cloud.d.ts.map +0 -1
  644. package/dist/runtime/cloud.js +0 -10
  645. package/dist/runtime/cloud.js.map +0 -1
  646. package/dist/runtime/node.d.ts +0 -8
  647. package/dist/runtime/node.d.ts.map +0 -1
  648. package/dist/runtime/node.js +0 -11
  649. package/dist/runtime/node.js.map +0 -1
  650. package/dist/runtime/universal.d.ts +0 -21
  651. package/dist/runtime/universal.d.ts.map +0 -1
  652. package/dist/runtime/universal.js +0 -29
  653. package/dist/runtime/universal.js.map +0 -1
  654. package/dist/security/active-stack-security.d.ts +0 -112
  655. package/dist/security/active-stack-security.d.ts.map +0 -1
  656. package/dist/security/active-stack-security.js +0 -296
  657. package/dist/security/active-stack-security.js.map +0 -1
  658. package/dist/security/advanced-persistence-research.d.ts +0 -92
  659. package/dist/security/advanced-persistence-research.d.ts.map +0 -1
  660. package/dist/security/advanced-persistence-research.js +0 -195
  661. package/dist/security/advanced-persistence-research.js.map +0 -1
  662. package/dist/security/advanced-targeting.d.ts +0 -119
  663. package/dist/security/advanced-targeting.d.ts.map +0 -1
  664. package/dist/security/advanced-targeting.js +0 -233
  665. package/dist/security/advanced-targeting.js.map +0 -1
  666. package/dist/security/assessment/vulnerabilityAssessment.d.ts +0 -104
  667. package/dist/security/assessment/vulnerabilityAssessment.d.ts.map +0 -1
  668. package/dist/security/assessment/vulnerabilityAssessment.js +0 -315
  669. package/dist/security/assessment/vulnerabilityAssessment.js.map +0 -1
  670. package/dist/security/authorization/securityAuthorization.d.ts +0 -88
  671. package/dist/security/authorization/securityAuthorization.d.ts.map +0 -1
  672. package/dist/security/authorization/securityAuthorization.js +0 -172
  673. package/dist/security/authorization/securityAuthorization.js.map +0 -1
  674. package/dist/security/comprehensive-targeting.d.ts +0 -85
  675. package/dist/security/comprehensive-targeting.d.ts.map +0 -1
  676. package/dist/security/comprehensive-targeting.js +0 -438
  677. package/dist/security/comprehensive-targeting.js.map +0 -1
  678. package/dist/security/global-security-integration.d.ts +0 -91
  679. package/dist/security/global-security-integration.d.ts.map +0 -1
  680. package/dist/security/global-security-integration.js +0 -218
  681. package/dist/security/global-security-integration.js.map +0 -1
  682. package/dist/security/index.d.ts +0 -38
  683. package/dist/security/index.d.ts.map +0 -1
  684. package/dist/security/index.js +0 -47
  685. package/dist/security/index.js.map +0 -1
  686. package/dist/security/persistence-analyzer.d.ts +0 -56
  687. package/dist/security/persistence-analyzer.d.ts.map +0 -1
  688. package/dist/security/persistence-analyzer.js +0 -187
  689. package/dist/security/persistence-analyzer.js.map +0 -1
  690. package/dist/security/persistence-cli.d.ts +0 -36
  691. package/dist/security/persistence-cli.d.ts.map +0 -1
  692. package/dist/security/persistence-cli.js +0 -160
  693. package/dist/security/persistence-cli.js.map +0 -1
  694. package/dist/security/persistence-research.d.ts +0 -92
  695. package/dist/security/persistence-research.d.ts.map +0 -1
  696. package/dist/security/persistence-research.js +0 -364
  697. package/dist/security/persistence-research.js.map +0 -1
  698. package/dist/security/research/persistenceResearch.d.ts +0 -97
  699. package/dist/security/research/persistenceResearch.d.ts.map +0 -1
  700. package/dist/security/research/persistenceResearch.js +0 -282
  701. package/dist/security/research/persistenceResearch.js.map +0 -1
  702. package/dist/security/security-integration.d.ts +0 -74
  703. package/dist/security/security-integration.d.ts.map +0 -1
  704. package/dist/security/security-integration.js +0 -137
  705. package/dist/security/security-integration.js.map +0 -1
  706. package/dist/security/security-testing-framework.d.ts +0 -112
  707. package/dist/security/security-testing-framework.d.ts.map +0 -1
  708. package/dist/security/security-testing-framework.js +0 -364
  709. package/dist/security/security-testing-framework.js.map +0 -1
  710. package/dist/security/simulation/attackSimulation.d.ts +0 -93
  711. package/dist/security/simulation/attackSimulation.d.ts.map +0 -1
  712. package/dist/security/simulation/attackSimulation.js +0 -341
  713. package/dist/security/simulation/attackSimulation.js.map +0 -1
  714. package/dist/security/strategic-operations.d.ts +0 -100
  715. package/dist/security/strategic-operations.d.ts.map +0 -1
  716. package/dist/security/strategic-operations.js +0 -276
  717. package/dist/security/strategic-operations.js.map +0 -1
  718. package/dist/security/tool-security-wrapper.d.ts +0 -58
  719. package/dist/security/tool-security-wrapper.d.ts.map +0 -1
  720. package/dist/security/tool-security-wrapper.js +0 -156
  721. package/dist/security/tool-security-wrapper.js.map +0 -1
  722. package/dist/shell/autoExecutor.d.ts +0 -70
  723. package/dist/shell/autoExecutor.d.ts.map +0 -1
  724. package/dist/shell/autoExecutor.js +0 -288
  725. package/dist/shell/autoExecutor.js.map +0 -1
  726. package/dist/shell/bracketedPasteManager.d.ts +0 -128
  727. package/dist/shell/bracketedPasteManager.d.ts.map +0 -1
  728. package/dist/shell/bracketedPasteManager.enhanced.d.ts +0 -2
  729. package/dist/shell/bracketedPasteManager.enhanced.d.ts.map +0 -1
  730. package/dist/shell/bracketedPasteManager.enhanced.js +0 -4
  731. package/dist/shell/bracketedPasteManager.enhanced.js.map +0 -1
  732. package/dist/shell/bracketedPasteManager.js +0 -372
  733. package/dist/shell/bracketedPasteManager.js.map +0 -1
  734. package/dist/shell/chatBox.d.ts +0 -228
  735. package/dist/shell/chatBox.d.ts.map +0 -1
  736. package/dist/shell/chatBox.js +0 -811
  737. package/dist/shell/chatBox.js.map +0 -1
  738. package/dist/shell/claudeCodeStreamHandler.d.ts +0 -145
  739. package/dist/shell/claudeCodeStreamHandler.d.ts.map +0 -1
  740. package/dist/shell/claudeCodeStreamHandler.js +0 -312
  741. package/dist/shell/claudeCodeStreamHandler.js.map +0 -1
  742. package/dist/shell/composableMessage.d.ts +0 -183
  743. package/dist/shell/composableMessage.d.ts.map +0 -1
  744. package/dist/shell/composableMessage.js +0 -420
  745. package/dist/shell/composableMessage.js.map +0 -1
  746. package/dist/shell/fileChangeTracker.d.ts +0 -39
  747. package/dist/shell/fileChangeTracker.d.ts.map +0 -1
  748. package/dist/shell/fileChangeTracker.js +0 -64
  749. package/dist/shell/fileChangeTracker.js.map +0 -1
  750. package/dist/shell/inputQueueManager.d.ts +0 -144
  751. package/dist/shell/inputQueueManager.d.ts.map +0 -1
  752. package/dist/shell/inputQueueManager.js +0 -290
  753. package/dist/shell/inputQueueManager.js.map +0 -1
  754. package/dist/shell/interactiveShell.d.ts +0 -312
  755. package/dist/shell/interactiveShell.d.ts.map +0 -1
  756. package/dist/shell/interactiveShell.js +0 -3271
  757. package/dist/shell/interactiveShell.js.map +0 -1
  758. package/dist/shell/liveStatus.d.ts +0 -29
  759. package/dist/shell/liveStatus.d.ts.map +0 -1
  760. package/dist/shell/liveStatus.js +0 -77
  761. package/dist/shell/liveStatus.js.map +0 -1
  762. package/dist/shell/shellApp.d.ts +0 -19
  763. package/dist/shell/shellApp.d.ts.map +0 -1
  764. package/dist/shell/shellApp.js +0 -364
  765. package/dist/shell/shellApp.js.map +0 -1
  766. package/dist/shell/streamingOutputManager.d.ts +0 -114
  767. package/dist/shell/streamingOutputManager.d.ts.map +0 -1
  768. package/dist/shell/streamingOutputManager.js +0 -213
  769. package/dist/shell/streamingOutputManager.js.map +0 -1
  770. package/dist/shell/systemPrompt.d.ts +0 -3
  771. package/dist/shell/systemPrompt.d.ts.map +0 -1
  772. package/dist/shell/systemPrompt.js +0 -73
  773. package/dist/shell/systemPrompt.js.map +0 -1
  774. package/dist/shell/taskCompletionDetector.d.ts +0 -106
  775. package/dist/shell/taskCompletionDetector.d.ts.map +0 -1
  776. package/dist/shell/taskCompletionDetector.js +0 -402
  777. package/dist/shell/taskCompletionDetector.js.map +0 -1
  778. package/dist/shell/terminalInput.d.ts +0 -221
  779. package/dist/shell/terminalInput.d.ts.map +0 -1
  780. package/dist/shell/terminalInput.js +0 -1082
  781. package/dist/shell/terminalInput.js.map +0 -1
  782. package/dist/shell/terminalInputAdapter.d.ts +0 -117
  783. package/dist/shell/terminalInputAdapter.d.ts.map +0 -1
  784. package/dist/shell/terminalInputAdapter.js +0 -217
  785. package/dist/shell/terminalInputAdapter.js.map +0 -1
  786. package/dist/shell/unifiedChatBox.d.ts +0 -194
  787. package/dist/shell/unifiedChatBox.d.ts.map +0 -1
  788. package/dist/shell/unifiedChatBox.js +0 -585
  789. package/dist/shell/unifiedChatBox.js.map +0 -1
  790. package/dist/shell/updateManager.d.ts +0 -2
  791. package/dist/shell/updateManager.d.ts.map +0 -1
  792. package/dist/shell/updateManager.js +0 -111
  793. package/dist/shell/updateManager.js.map +0 -1
  794. package/dist/skills/skillRepository.d.ts +0 -103
  795. package/dist/skills/skillRepository.d.ts.map +0 -1
  796. package/dist/skills/skillRepository.js +0 -237
  797. package/dist/skills/skillRepository.js.map +0 -1
  798. package/dist/skills/types.d.ts +0 -37
  799. package/dist/skills/types.d.ts.map +0 -1
  800. package/dist/skills/types.js +0 -2
  801. package/dist/skills/types.js.map +0 -1
  802. package/dist/subagents/taskRunner.d.ts +0 -23
  803. package/dist/subagents/taskRunner.d.ts.map +0 -1
  804. package/dist/subagents/taskRunner.js +0 -271
  805. package/dist/subagents/taskRunner.js.map +0 -1
  806. package/dist/tools/advancedTestGenerationTools.d.ts +0 -21
  807. package/dist/tools/advancedTestGenerationTools.d.ts.map +0 -1
  808. package/dist/tools/advancedTestGenerationTools.js +0 -301
  809. package/dist/tools/advancedTestGenerationTools.js.map +0 -1
  810. package/dist/tools/backgroundBashTools.d.ts +0 -21
  811. package/dist/tools/backgroundBashTools.d.ts.map +0 -1
  812. package/dist/tools/backgroundBashTools.js +0 -215
  813. package/dist/tools/backgroundBashTools.js.map +0 -1
  814. package/dist/tools/bashTools.d.ts +0 -8
  815. package/dist/tools/bashTools.d.ts.map +0 -1
  816. package/dist/tools/bashTools.js +0 -227
  817. package/dist/tools/bashTools.js.map +0 -1
  818. package/dist/tools/browserAutomationTools.d.ts +0 -23
  819. package/dist/tools/browserAutomationTools.d.ts.map +0 -1
  820. package/dist/tools/browserAutomationTools.js +0 -916
  821. package/dist/tools/browserAutomationTools.js.map +0 -1
  822. package/dist/tools/cloudTools.d.ts +0 -49
  823. package/dist/tools/cloudTools.d.ts.map +0 -1
  824. package/dist/tools/cloudTools.js +0 -1258
  825. package/dist/tools/cloudTools.js.map +0 -1
  826. package/dist/tools/code-quality-dashboard.d.ts +0 -57
  827. package/dist/tools/code-quality-dashboard.d.ts.map +0 -1
  828. package/dist/tools/code-quality-dashboard.js +0 -218
  829. package/dist/tools/code-quality-dashboard.js.map +0 -1
  830. package/dist/tools/codeAnalysisTools.d.ts +0 -74
  831. package/dist/tools/codeAnalysisTools.d.ts.map +0 -1
  832. package/dist/tools/codeAnalysisTools.js +0 -664
  833. package/dist/tools/codeAnalysisTools.js.map +0 -1
  834. package/dist/tools/codeGenerationTools.d.ts +0 -3
  835. package/dist/tools/codeGenerationTools.d.ts.map +0 -1
  836. package/dist/tools/codeGenerationTools.js +0 -439
  837. package/dist/tools/codeGenerationTools.js.map +0 -1
  838. package/dist/tools/codeQualityTools.d.ts +0 -3
  839. package/dist/tools/codeQualityTools.d.ts.map +0 -1
  840. package/dist/tools/codeQualityTools.js +0 -296
  841. package/dist/tools/codeQualityTools.js.map +0 -1
  842. package/dist/tools/dependencyTools.d.ts +0 -3
  843. package/dist/tools/dependencyTools.d.ts.map +0 -1
  844. package/dist/tools/dependencyTools.js +0 -283
  845. package/dist/tools/dependencyTools.js.map +0 -1
  846. package/dist/tools/devTools.d.ts +0 -10
  847. package/dist/tools/devTools.d.ts.map +0 -1
  848. package/dist/tools/devTools.js +0 -2305
  849. package/dist/tools/devTools.js.map +0 -1
  850. package/dist/tools/diffUtils.d.ts +0 -36
  851. package/dist/tools/diffUtils.d.ts.map +0 -1
  852. package/dist/tools/diffUtils.js +0 -528
  853. package/dist/tools/diffUtils.js.map +0 -1
  854. package/dist/tools/editTools.d.ts +0 -29
  855. package/dist/tools/editTools.d.ts.map +0 -1
  856. package/dist/tools/editTools.js +0 -419
  857. package/dist/tools/editTools.js.map +0 -1
  858. package/dist/tools/emailTools.d.ts +0 -21
  859. package/dist/tools/emailTools.d.ts.map +0 -1
  860. package/dist/tools/emailTools.js +0 -449
  861. package/dist/tools/emailTools.js.map +0 -1
  862. package/dist/tools/enhancedCodeIntelligenceTools.d.ts +0 -27
  863. package/dist/tools/enhancedCodeIntelligenceTools.d.ts.map +0 -1
  864. package/dist/tools/enhancedCodeIntelligenceTools.js +0 -418
  865. package/dist/tools/enhancedCodeIntelligenceTools.js.map +0 -1
  866. package/dist/tools/enhancedDevWorkflowTools.d.ts +0 -15
  867. package/dist/tools/enhancedDevWorkflowTools.d.ts.map +0 -1
  868. package/dist/tools/enhancedDevWorkflowTools.js +0 -303
  869. package/dist/tools/enhancedDevWorkflowTools.js.map +0 -1
  870. package/dist/tools/fileTools.d.ts +0 -3
  871. package/dist/tools/fileTools.d.ts.map +0 -1
  872. package/dist/tools/fileTools.js +0 -252
  873. package/dist/tools/fileTools.js.map +0 -1
  874. package/dist/tools/frontendTestingTools.d.ts +0 -35
  875. package/dist/tools/frontendTestingTools.d.ts.map +0 -1
  876. package/dist/tools/frontendTestingTools.js +0 -1254
  877. package/dist/tools/frontendTestingTools.js.map +0 -1
  878. package/dist/tools/globTools.d.ts +0 -15
  879. package/dist/tools/globTools.d.ts.map +0 -1
  880. package/dist/tools/globTools.js +0 -174
  881. package/dist/tools/globTools.js.map +0 -1
  882. package/dist/tools/grepTools.d.ts +0 -19
  883. package/dist/tools/grepTools.d.ts.map +0 -1
  884. package/dist/tools/grepTools.js +0 -339
  885. package/dist/tools/grepTools.js.map +0 -1
  886. package/dist/tools/interactionTools.d.ts +0 -13
  887. package/dist/tools/interactionTools.d.ts.map +0 -1
  888. package/dist/tools/interactionTools.js +0 -171
  889. package/dist/tools/interactionTools.js.map +0 -1
  890. package/dist/tools/learnTools.d.ts +0 -152
  891. package/dist/tools/learnTools.d.ts.map +0 -1
  892. package/dist/tools/learnTools.js +0 -1819
  893. package/dist/tools/learnTools.js.map +0 -1
  894. package/dist/tools/notebookEditTools.d.ts +0 -15
  895. package/dist/tools/notebookEditTools.d.ts.map +0 -1
  896. package/dist/tools/notebookEditTools.js +0 -197
  897. package/dist/tools/notebookEditTools.js.map +0 -1
  898. package/dist/tools/planningTools.d.ts +0 -11
  899. package/dist/tools/planningTools.d.ts.map +0 -1
  900. package/dist/tools/planningTools.js +0 -47
  901. package/dist/tools/planningTools.js.map +0 -1
  902. package/dist/tools/refactoringTools.d.ts +0 -3
  903. package/dist/tools/refactoringTools.d.ts.map +0 -1
  904. package/dist/tools/refactoringTools.js +0 -294
  905. package/dist/tools/refactoringTools.js.map +0 -1
  906. package/dist/tools/repoChecksTools.d.ts +0 -3
  907. package/dist/tools/repoChecksTools.d.ts.map +0 -1
  908. package/dist/tools/repoChecksTools.js +0 -161
  909. package/dist/tools/repoChecksTools.js.map +0 -1
  910. package/dist/tools/searchTools.d.ts +0 -3
  911. package/dist/tools/searchTools.d.ts.map +0 -1
  912. package/dist/tools/searchTools.js +0 -207
  913. package/dist/tools/searchTools.js.map +0 -1
  914. package/dist/tools/skillTools.d.ts +0 -8
  915. package/dist/tools/skillTools.d.ts.map +0 -1
  916. package/dist/tools/skillTools.js +0 -178
  917. package/dist/tools/skillTools.js.map +0 -1
  918. package/dist/tools/softwareEngineeringTools.d.ts +0 -7
  919. package/dist/tools/softwareEngineeringTools.d.ts.map +0 -1
  920. package/dist/tools/softwareEngineeringTools.js +0 -338
  921. package/dist/tools/softwareEngineeringTools.js.map +0 -1
  922. package/dist/tools/taskManagementTools.d.ts +0 -10
  923. package/dist/tools/taskManagementTools.d.ts.map +0 -1
  924. package/dist/tools/taskManagementTools.js +0 -157
  925. package/dist/tools/taskManagementTools.js.map +0 -1
  926. package/dist/tools/testingTools.d.ts +0 -3
  927. package/dist/tools/testingTools.d.ts.map +0 -1
  928. package/dist/tools/testingTools.js +0 -233
  929. package/dist/tools/testingTools.js.map +0 -1
  930. package/dist/tools/validationTools.d.ts +0 -7
  931. package/dist/tools/validationTools.d.ts.map +0 -1
  932. package/dist/tools/validationTools.js +0 -278
  933. package/dist/tools/validationTools.js.map +0 -1
  934. package/dist/tools/webTools.d.ts +0 -3
  935. package/dist/tools/webTools.d.ts.map +0 -1
  936. package/dist/tools/webTools.js +0 -495
  937. package/dist/tools/webTools.js.map +0 -1
  938. package/dist/ui/FixedInputArea.d.ts +0 -108
  939. package/dist/ui/FixedInputArea.d.ts.map +0 -1
  940. package/dist/ui/FixedInputArea.js +0 -312
  941. package/dist/ui/FixedInputArea.js.map +0 -1
  942. package/dist/ui/ShellUIAdapter.d.ts +0 -141
  943. package/dist/ui/ShellUIAdapter.d.ts.map +0 -1
  944. package/dist/ui/ShellUIAdapter.js +0 -680
  945. package/dist/ui/ShellUIAdapter.js.map +0 -1
  946. package/dist/ui/UnifiedUIController.d.ts +0 -70
  947. package/dist/ui/UnifiedUIController.d.ts.map +0 -1
  948. package/dist/ui/UnifiedUIController.js +0 -190
  949. package/dist/ui/UnifiedUIController.js.map +0 -1
  950. package/dist/ui/advancedTheme.d.ts +0 -246
  951. package/dist/ui/advancedTheme.d.ts.map +0 -1
  952. package/dist/ui/advancedTheme.js +0 -478
  953. package/dist/ui/advancedTheme.js.map +0 -1
  954. package/dist/ui/animation/AnimationScheduler.d.ts +0 -192
  955. package/dist/ui/animation/AnimationScheduler.d.ts.map +0 -1
  956. package/dist/ui/animation/AnimationScheduler.js +0 -432
  957. package/dist/ui/animation/AnimationScheduler.js.map +0 -1
  958. package/dist/ui/codeHighlighter.d.ts +0 -6
  959. package/dist/ui/codeHighlighter.d.ts.map +0 -1
  960. package/dist/ui/codeHighlighter.js +0 -855
  961. package/dist/ui/codeHighlighter.js.map +0 -1
  962. package/dist/ui/collapsibleContent.d.ts +0 -57
  963. package/dist/ui/collapsibleContent.d.ts.map +0 -1
  964. package/dist/ui/collapsibleContent.js +0 -106
  965. package/dist/ui/collapsibleContent.js.map +0 -1
  966. package/dist/ui/designSystem.d.ts +0 -26
  967. package/dist/ui/designSystem.d.ts.map +0 -1
  968. package/dist/ui/designSystem.js +0 -122
  969. package/dist/ui/designSystem.js.map +0 -1
  970. package/dist/ui/diffViewer.d.ts +0 -42
  971. package/dist/ui/diffViewer.d.ts.map +0 -1
  972. package/dist/ui/diffViewer.js +0 -343
  973. package/dist/ui/diffViewer.js.map +0 -1
  974. package/dist/ui/display.d.ts +0 -295
  975. package/dist/ui/display.d.ts.map +0 -1
  976. package/dist/ui/display.js +0 -1469
  977. package/dist/ui/display.js.map +0 -1
  978. package/dist/ui/errorFormatter.d.ts +0 -54
  979. package/dist/ui/errorFormatter.d.ts.map +0 -1
  980. package/dist/ui/errorFormatter.js +0 -251
  981. package/dist/ui/errorFormatter.js.map +0 -1
  982. package/dist/ui/gitDisplay.d.ts +0 -45
  983. package/dist/ui/gitDisplay.d.ts.map +0 -1
  984. package/dist/ui/gitDisplay.js +0 -215
  985. package/dist/ui/gitDisplay.js.map +0 -1
  986. package/dist/ui/gitFormatter.d.ts +0 -29
  987. package/dist/ui/gitFormatter.d.ts.map +0 -1
  988. package/dist/ui/gitFormatter.js +0 -203
  989. package/dist/ui/gitFormatter.js.map +0 -1
  990. package/dist/ui/interrupts/InterruptManager.d.ts +0 -142
  991. package/dist/ui/interrupts/InterruptManager.d.ts.map +0 -1
  992. package/dist/ui/interrupts/InterruptManager.js +0 -439
  993. package/dist/ui/interrupts/InterruptManager.js.map +0 -1
  994. package/dist/ui/keyboardShortcuts.d.ts +0 -49
  995. package/dist/ui/keyboardShortcuts.d.ts.map +0 -1
  996. package/dist/ui/keyboardShortcuts.js +0 -128
  997. package/dist/ui/keyboardShortcuts.js.map +0 -1
  998. package/dist/ui/layout.d.ts +0 -17
  999. package/dist/ui/layout.d.ts.map +0 -1
  1000. package/dist/ui/layout.js +0 -140
  1001. package/dist/ui/layout.js.map +0 -1
  1002. package/dist/ui/logFormatter.d.ts +0 -70
  1003. package/dist/ui/logFormatter.d.ts.map +0 -1
  1004. package/dist/ui/logFormatter.js +0 -323
  1005. package/dist/ui/logFormatter.js.map +0 -1
  1006. package/dist/ui/orchestration/StatusOrchestrator.d.ts +0 -156
  1007. package/dist/ui/orchestration/StatusOrchestrator.d.ts.map +0 -1
  1008. package/dist/ui/orchestration/StatusOrchestrator.js +0 -406
  1009. package/dist/ui/orchestration/StatusOrchestrator.js.map +0 -1
  1010. package/dist/ui/outputMode.d.ts +0 -22
  1011. package/dist/ui/outputMode.d.ts.map +0 -1
  1012. package/dist/ui/outputMode.js +0 -40
  1013. package/dist/ui/outputMode.js.map +0 -1
  1014. package/dist/ui/outputSummarizer.d.ts +0 -52
  1015. package/dist/ui/outputSummarizer.d.ts.map +0 -1
  1016. package/dist/ui/outputSummarizer.js +0 -242
  1017. package/dist/ui/outputSummarizer.js.map +0 -1
  1018. package/dist/ui/persistentPrompt.d.ts +0 -545
  1019. package/dist/ui/persistentPrompt.d.ts.map +0 -1
  1020. package/dist/ui/persistentPrompt.js +0 -1529
  1021. package/dist/ui/persistentPrompt.js.map +0 -1
  1022. package/dist/ui/progressBar.d.ts +0 -51
  1023. package/dist/ui/progressBar.d.ts.map +0 -1
  1024. package/dist/ui/progressBar.js +0 -153
  1025. package/dist/ui/progressBar.js.map +0 -1
  1026. package/dist/ui/progressIndicator.d.ts +0 -69
  1027. package/dist/ui/progressIndicator.d.ts.map +0 -1
  1028. package/dist/ui/progressIndicator.js +0 -145
  1029. package/dist/ui/progressIndicator.js.map +0 -1
  1030. package/dist/ui/richText.d.ts +0 -6
  1031. package/dist/ui/richText.d.ts.map +0 -1
  1032. package/dist/ui/richText.js +0 -391
  1033. package/dist/ui/richText.js.map +0 -1
  1034. package/dist/ui/shortcutsHelp.d.ts +0 -23
  1035. package/dist/ui/shortcutsHelp.d.ts.map +0 -1
  1036. package/dist/ui/shortcutsHelp.js +0 -89
  1037. package/dist/ui/shortcutsHelp.js.map +0 -1
  1038. package/dist/ui/streamingIndicators.d.ts +0 -42
  1039. package/dist/ui/streamingIndicators.d.ts.map +0 -1
  1040. package/dist/ui/streamingIndicators.js +0 -155
  1041. package/dist/ui/streamingIndicators.js.map +0 -1
  1042. package/dist/ui/tableFormatter.d.ts +0 -31
  1043. package/dist/ui/tableFormatter.d.ts.map +0 -1
  1044. package/dist/ui/tableFormatter.js +0 -186
  1045. package/dist/ui/tableFormatter.js.map +0 -1
  1046. package/dist/ui/telemetry/UITelemetry.d.ts +0 -181
  1047. package/dist/ui/telemetry/UITelemetry.d.ts.map +0 -1
  1048. package/dist/ui/telemetry/UITelemetry.js +0 -446
  1049. package/dist/ui/telemetry/UITelemetry.js.map +0 -1
  1050. package/dist/ui/textHighlighter.d.ts +0 -83
  1051. package/dist/ui/textHighlighter.d.ts.map +0 -1
  1052. package/dist/ui/textHighlighter.js +0 -267
  1053. package/dist/ui/textHighlighter.js.map +0 -1
  1054. package/dist/ui/theme.d.ts +0 -103
  1055. package/dist/ui/theme.d.ts.map +0 -1
  1056. package/dist/ui/theme.js +0 -128
  1057. package/dist/ui/theme.js.map +0 -1
  1058. package/dist/ui/thinkingTracker.d.ts +0 -51
  1059. package/dist/ui/thinkingTracker.d.ts.map +0 -1
  1060. package/dist/ui/thinkingTracker.js +0 -115
  1061. package/dist/ui/thinkingTracker.js.map +0 -1
  1062. package/dist/ui/toolDisplay.d.ts +0 -151
  1063. package/dist/ui/toolDisplay.d.ts.map +0 -1
  1064. package/dist/ui/toolDisplay.js +0 -1338
  1065. package/dist/ui/toolDisplay.js.map +0 -1
  1066. package/dist/ui/toolDisplayAdapter.d.ts +0 -66
  1067. package/dist/ui/toolDisplayAdapter.d.ts.map +0 -1
  1068. package/dist/ui/toolDisplayAdapter.js +0 -356
  1069. package/dist/ui/toolDisplayAdapter.js.map +0 -1
  1070. package/dist/ui/treeVisualizer.d.ts +0 -56
  1071. package/dist/ui/treeVisualizer.d.ts.map +0 -1
  1072. package/dist/ui/treeVisualizer.js +0 -247
  1073. package/dist/ui/treeVisualizer.js.map +0 -1
  1074. package/dist/utils/asyncUtils.d.ts +0 -95
  1075. package/dist/utils/asyncUtils.d.ts.map +0 -1
  1076. package/dist/utils/asyncUtils.js +0 -286
  1077. package/dist/utils/asyncUtils.js.map +0 -1
  1078. package/dist/utils/errorUtils.d.ts +0 -16
  1079. package/dist/utils/errorUtils.d.ts.map +0 -1
  1080. package/dist/utils/errorUtils.js +0 -66
  1081. package/dist/utils/errorUtils.js.map +0 -1
  1082. package/dist/workspace.d.ts +0 -8
  1083. package/dist/workspace.d.ts.map +0 -1
  1084. package/dist/workspace.js +0 -107
  1085. package/dist/workspace.js.map +0 -1
  1086. package/dist/workspace.validator.d.ts +0 -49
  1087. package/dist/workspace.validator.d.ts.map +0 -1
  1088. package/dist/workspace.validator.js +0 -214
  1089. package/dist/workspace.validator.js.map +0 -1
@@ -1,3271 +0,0 @@
1
- import { stdin as input, stdout as output, exit } from 'node:process';
2
- import { exec } from 'node:child_process';
3
- import { promisify } from 'node:util';
4
- import { display } from '../ui/display.js';
5
- import { formatUserPrompt, theme } from '../ui/theme.js';
6
- import { getContextWindowTokens } from '../core/contextWindow.js';
7
- import { ensureSecretForProvider, getSecretDefinitionForProvider, getSecretValue, listSecretDefinitions, maskSecret, setSecretValue, } from '../core/secretStore.js';
8
- import { saveActiveProfilePreference, saveModelPreference, loadToolSettings, saveToolSettings, clearToolSettings, clearActiveProfilePreference, loadSessionPreferences, saveSessionPreferences, } from '../core/preferences.js';
9
- import { buildEnabledToolSet, evaluateToolPermissions, getToolToggleOptions, } from '../capabilities/toolRegistry.js';
10
- import { detectApiKeyError } from '../core/errors/apiKeyErrors.js';
11
- import { buildWorkspaceContext } from '../workspace.js';
12
- import { buildInteractiveSystemPrompt } from './systemPrompt.js';
13
- import { getTaskCompletionDetector, resetTaskCompletionDetector, } from './taskCompletionDetector.js';
14
- import { discoverAllModels, quickCheckProviders, getCachedDiscoveredModels, sortModelsByPriority } from '../core/modelDiscovery.js';
15
- import { getModels, getSlashCommands, getProviders } from '../core/agentSchemaLoader.js';
16
- import { clearAutosaveSnapshot, deleteSession, listSessions, loadAutosaveSnapshot, loadSessionById, saveAutosaveSnapshot, saveSessionSnapshot, } from '../core/sessionStore.js';
17
- import { buildCustomCommandPrompt, loadCustomSlashCommands, } from '../core/customCommands.js';
18
- import { SkillRepository } from '../skills/skillRepository.js';
19
- import { createSkillTools } from '../tools/skillTools.js';
20
- import { FileChangeTracker } from './fileChangeTracker.js';
21
- import { formatShortcutsHelp } from '../ui/shortcutsHelp.js';
22
- import { MetricsTracker } from '../alpha-zero/index.js';
23
- import { listAvailablePlugins } from '../plugins/index.js';
24
- import { TerminalInputAdapter } from './terminalInputAdapter.js';
25
- const execAsync = promisify(exec);
26
- const DROPDOWN_COLORS = [
27
- theme.primary,
28
- theme.info,
29
- theme.accent,
30
- theme.secondary,
31
- theme.success,
32
- theme.warning,
33
- ];
34
- // Load MODEL_PRESETS from centralized schema
35
- const MODEL_PRESETS = getModels().map((model) => ({
36
- id: model.id,
37
- label: model.label,
38
- provider: model.provider,
39
- description: model.description ?? '',
40
- reasoningEffort: model.reasoningEffort,
41
- temperature: model.temperature,
42
- maxTokens: model.maxTokens,
43
- }));
44
- // Load BASE_SLASH_COMMANDS from centralized schema
45
- const BASE_SLASH_COMMANDS = getSlashCommands().map((cmd) => ({
46
- command: cmd.command,
47
- description: cmd.description,
48
- }));
49
- // Load PROVIDER_LABELS from centralized schema
50
- const PROVIDER_LABELS = Object.fromEntries(getProviders().map((provider) => [provider.id, provider.label]));
51
- // Allow enough time for paste detection to kick in before flushing buffered lines
52
- const CONTEXT_USAGE_THRESHOLD = 0.9;
53
- const CONTEXT_RECENT_MESSAGE_COUNT = 12;
54
- const CONTEXT_CLEANUP_CHARS_PER_CHUNK = 6000;
55
- const CONTEXT_CLEANUP_MAX_OUTPUT_TOKENS = 800;
56
- const CONTEXT_CLEANUP_SYSTEM_PROMPT = `You condense earlier IDE collaboration logs so the agent can keep working.
57
- - Merge any prior summary with the new conversation chunk.
58
- - Capture key decisions, TODOs, file edits, tool observations, and open questions.
59
- - Clearly distinguish resolved work from outstanding follow-ups.
60
- - Keep the response under roughly 200 words, prefer short bullet lists.
61
- - Never call tools or run shell commands; respond with plain Markdown text only.`;
62
- export class InteractiveShell {
63
- agent = null;
64
- profile;
65
- profileLabel;
66
- workingDir;
67
- runtimeSession;
68
- baseSystemPrompt;
69
- workspaceOptions;
70
- sessionState;
71
- isProcessing = false;
72
- shuttingDown = false;
73
- pendingInteraction = null;
74
- pendingSecretRetry = null;
75
- terminalInput;
76
- currentInput = '';
77
- pendingCleanup = null;
78
- cleanupInProgress = false;
79
- slashPreviewVisible = false;
80
- skillRepository;
81
- skillToolHandlers = new Map();
82
- thinkingMode = 'balanced';
83
- agentMenu;
84
- slashCommands;
85
- bannerSessionState = null;
86
- statusTracker;
87
- uiAdapter;
88
- _fileChangeTracker = new FileChangeTracker(); // Reserved for future file tracking features
89
- alphaZeroMetrics; // Alpha Zero 2 performance tracking
90
- statusSubscription = null;
91
- followUpQueue = [];
92
- isDrainingQueue = false;
93
- activeContextWindowTokens = null;
94
- sessionPreferences;
95
- autosaveEnabled;
96
- autoContinueEnabled;
97
- editGuardMode = 'display-edits';
98
- pendingPermissionInput = null;
99
- pendingHistoryLoad = null;
100
- cachedHistory = [];
101
- activeSessionId = null;
102
- activeSessionTitle = null;
103
- sessionResumeNotice = null;
104
- customCommands;
105
- customCommandMap;
106
- sessionRestoreConfig;
107
- _enabledPlugins;
108
- // Cached provider status for unified status bar display after streaming
109
- cachedProviderStatus = [];
110
- // Auto-test tracking
111
- autoTestInFlight = false;
112
- lastAutoTestRun = null;
113
- constructor(config) {
114
- this.profile = config.profile;
115
- this.profileLabel = config.profileLabel;
116
- this.workingDir = config.workingDir;
117
- this.runtimeSession = config.session;
118
- this.baseSystemPrompt = config.baseSystemPrompt;
119
- this.workspaceOptions = { ...config.workspaceOptions };
120
- this.sessionPreferences = loadSessionPreferences();
121
- this.thinkingMode = this.sessionPreferences.thinkingMode;
122
- this.autosaveEnabled = this.sessionPreferences.autosave;
123
- this.autoContinueEnabled = this.sessionPreferences.autoContinue;
124
- this.sessionRestoreConfig = config.sessionRestore ?? { mode: 'none' };
125
- this._enabledPlugins = config.enabledPlugins ?? [];
126
- this.initializeSessionHistory();
127
- this.sessionState = {
128
- provider: config.initialModel.provider,
129
- model: config.initialModel.model,
130
- temperature: config.initialModel.temperature,
131
- maxTokens: config.initialModel.maxTokens,
132
- reasoningEffort: config.initialModel.reasoningEffort,
133
- };
134
- this.applyPresetReasoningDefaults();
135
- // The welcome banner only includes model + provider on launch, so mark that as the initial state.
136
- this.bannerSessionState = {
137
- model: this.sessionState.model,
138
- provider: this.sessionState.provider,
139
- };
140
- this.agentMenu = config.agentSelection ?? null;
141
- this.slashCommands = [...BASE_SLASH_COMMANDS];
142
- if (this.agentMenu) {
143
- this.slashCommands.push({
144
- command: '/agents',
145
- description: 'Select the default agent profile (applies on next launch)',
146
- });
147
- }
148
- this.customCommands = loadCustomSlashCommands();
149
- this.customCommandMap = new Map(this.customCommands.map((command) => [command.command, command]));
150
- for (const custom of this.customCommands) {
151
- this.slashCommands.push({
152
- command: custom.command,
153
- description: `${custom.description} (custom)`,
154
- });
155
- }
156
- // Add /plugins command
157
- this.slashCommands.push({
158
- command: '/plugins',
159
- description: 'Show available and loaded plugins',
160
- });
161
- this.statusTracker = config.statusTracker;
162
- this.uiAdapter = config.uiAdapter;
163
- // Set up file change tracking callback
164
- this.uiAdapter.setFileChangeCallback((path, type, additions, removals) => {
165
- this._fileChangeTracker.recordChange(path, type, additions, removals);
166
- });
167
- // Set up tool status callback to update status during tool execution
168
- this.uiAdapter.setToolStatusCallback((status) => {
169
- this.updateStatusMessage(status ?? null);
170
- });
171
- this.skillRepository = new SkillRepository({
172
- workingDir: this.workingDir,
173
- env: process.env,
174
- });
175
- for (const definition of createSkillTools({ repository: this.skillRepository })) {
176
- this.skillToolHandlers.set(definition.name, definition.handler);
177
- }
178
- // Initialize unified terminal input handler
179
- this.terminalInput = new TerminalInputAdapter(input, output, {
180
- onSubmit: (text) => this.processInput(text),
181
- onQueue: (text) => this.handleQueuedInput(text),
182
- onInterrupt: () => this.handleInterrupt(),
183
- onChange: (text) => this.handleInputChange(text),
184
- onEditModeChange: (mode) => this.handleEditModeChange(mode),
185
- });
186
- // Register output interceptor for cursor positioning during streaming
187
- this.terminalInput.registerOutputInterceptor(display);
188
- // Initialize Alpha Zero 2 metrics tracking
189
- this.alphaZeroMetrics = new MetricsTracker(`${this.profile}-${Date.now()}`);
190
- this.setupStatusTracking();
191
- this.refreshContextGauge();
192
- this.terminalInput.start();
193
- this.rebuildAgent();
194
- this.setupHandlers();
195
- this.refreshBannerSessionInfo();
196
- }
197
- initializeSessionHistory() {
198
- this.cachedHistory = [];
199
- this.pendingHistoryLoad = null;
200
- this.activeSessionId = null;
201
- this.activeSessionTitle = null;
202
- this.sessionResumeNotice = null;
203
- // Handle explicit session restore requests via CLI flags
204
- if (this.sessionRestoreConfig.mode === 'session-id' && this.sessionRestoreConfig.sessionId) {
205
- const stored = loadSessionById(this.sessionRestoreConfig.sessionId);
206
- if (stored) {
207
- this.cachedHistory = stored.messages;
208
- this.pendingHistoryLoad = stored.messages;
209
- this.activeSessionId = stored.id;
210
- this.activeSessionTitle = stored.title;
211
- this.sessionResumeNotice = `Resumed session "${stored.title}".`;
212
- return;
213
- }
214
- display.showWarning(`Session "${this.sessionRestoreConfig.sessionId}" not found. Starting fresh session.`);
215
- return;
216
- }
217
- if (this.sessionRestoreConfig.mode === 'autosave') {
218
- const autosave = loadAutosaveSnapshot(this.profile);
219
- if (autosave) {
220
- this.cachedHistory = autosave.messages;
221
- this.pendingHistoryLoad = autosave.messages;
222
- this.activeSessionId = null;
223
- this.activeSessionTitle = autosave.title;
224
- this.sessionResumeNotice = 'Restored last autosaved session.';
225
- return;
226
- }
227
- display.showWarning('No autosaved session found. Starting fresh session.');
228
- }
229
- // Default: Start fresh (mode === 'none')
230
- }
231
- showSessionResumeNotice() {
232
- if (!this.sessionResumeNotice) {
233
- return;
234
- }
235
- display.showInfo(this.sessionResumeNotice);
236
- this.sessionResumeNotice = null;
237
- }
238
- async start(initialPrompt) {
239
- if (initialPrompt) {
240
- display.newLine();
241
- console.log(`${formatUserPrompt(this.profileLabel || this.profile)}${initialPrompt}`);
242
- await this.processInputBlock(initialPrompt);
243
- return;
244
- }
245
- // Ensure the terminal input is visible
246
- this.terminalInput.render();
247
- }
248
- /**
249
- * TerminalInputAdapter submit handler
250
- */
251
- processInput(text) {
252
- const approved = this.resolveEditPermission(text);
253
- if (!approved) {
254
- this.handleInputChange('');
255
- return;
256
- }
257
- this.handleInputChange('');
258
- void this.processInputBlock(approved).catch((err) => {
259
- display.showError(err instanceof Error ? err.message : String(err), err);
260
- });
261
- }
262
- /**
263
- * TerminalInputAdapter queue handler (streaming mode)
264
- */
265
- handleQueuedInput(text) {
266
- // Keep adapter queue trimmed so hints stay accurate
267
- this.terminalInput.dequeue();
268
- this.followUpQueue.push({ type: 'request', text });
269
- display.showInfo(`Queued: "${text}"`);
270
- this.refreshQueueIndicators();
271
- this.scheduleQueueProcessing();
272
- this.handleInputChange('');
273
- }
274
- /**
275
- * TerminalInputAdapter change handler
276
- */
277
- handleInputChange(text) {
278
- this.currentInput = text;
279
- this.handleSlashCommandPreviewChange();
280
- }
281
- /**
282
- * Edit guard mode change handler (Shift+Tab from terminal input)
283
- */
284
- handleEditModeChange(mode) {
285
- this.editGuardMode = mode;
286
- this.pendingPermissionInput = null;
287
- if (mode === 'ask-permission') {
288
- display.showSystemMessage('🛡️ Ask-to-edit mode enabled. Confirm each request before sending.');
289
- }
290
- else {
291
- display.showSystemMessage('✏️ Display edits mode enabled.');
292
- }
293
- this.terminalInput.render();
294
- }
295
- /**
296
- * Gate submissions when edit permission mode is active.
297
- * Returns the text to send when approved, or null when waiting for confirmation.
298
- */
299
- resolveEditPermission(text) {
300
- if (this.editGuardMode !== 'ask-permission') {
301
- this.pendingPermissionInput = null;
302
- return text;
303
- }
304
- const trimmed = text.trim();
305
- const lower = trimmed.toLowerCase();
306
- if (this.pendingPermissionInput === null) {
307
- this.pendingPermissionInput = text;
308
- this.showPermissionPrompt(text, false);
309
- return null;
310
- }
311
- if (!trimmed || lower === 'y' || lower === 'yes') {
312
- const toSend = this.pendingPermissionInput;
313
- this.pendingPermissionInput = null;
314
- return toSend;
315
- }
316
- if (['n', 'no', 'cancel', '/cancel'].includes(lower)) {
317
- this.pendingPermissionInput = null;
318
- display.showInfo('Request cancelled.');
319
- this.terminalInput.render();
320
- return null;
321
- }
322
- // Treat any other input as a replacement request that also needs confirmation
323
- this.pendingPermissionInput = text;
324
- this.showPermissionPrompt(text, true);
325
- return null;
326
- }
327
- showPermissionPrompt(text, updated) {
328
- const singleLine = text.replace(/\s+/g, ' ').trim();
329
- const preview = singleLine.length > 120 ? `${singleLine.slice(0, 117)}...` : singleLine;
330
- const prefix = updated ? 'Updated request captured.' : 'Edit permission required.';
331
- display.showSystemMessage([
332
- `${prefix} Press Enter again (or type "yes") to allow edits, or type "cancel" to abort.`,
333
- preview ? `Pending: "${preview}"` : '',
334
- ]
335
- .filter(Boolean)
336
- .join('\n'));
337
- this.terminalInput.render();
338
- }
339
- /**
340
- * TerminalInputAdapter interrupt handler (Ctrl+C with empty buffer)
341
- */
342
- handleInterrupt() {
343
- if (this.isProcessing && this.agent) {
344
- this.agent.requestCancellation();
345
- display.showWarning('Cancelling current operation... (Ctrl+C again to force quit)');
346
- return;
347
- }
348
- this.shutdown();
349
- }
350
- /**
351
- * Gracefully tear down the shell and exit
352
- */
353
- shutdown() {
354
- if (this.shuttingDown) {
355
- return;
356
- }
357
- this.shuttingDown = true;
358
- // Stop any active spinner to prevent process hang
359
- display.stopThinking(false);
360
- this.teardownStatusTracking();
361
- // Clear any pending cleanup to prevent hanging
362
- this.pendingCleanup = null;
363
- // Dispose terminal input handler
364
- this.terminalInput.dispose();
365
- // Dispose unified UI adapter
366
- this.uiAdapter.dispose();
367
- display.newLine();
368
- const highlightedEmail = theme.info('support@ero.solar');
369
- const infoMessage = [
370
- 'Thank you to Anthropic for allowing me to use Claude Code to build erosolar-cli.',
371
- 'https://www.anthropic.com/news/disrupting-AI-espionage',
372
- '',
373
- `Email ${highlightedEmail} with any bugs or feedback`,
374
- 'GitHub: https://github.com/ErosolarAI/erosolar-by-bo',
375
- 'npm: https://www.npmjs.com/package/erosolar-cli',
376
- ].join('\n');
377
- display.showInfo(infoMessage);
378
- exit(0);
379
- }
380
- /**
381
- * Update status bar message
382
- */
383
- updateStatusMessage(_message) {
384
- this.terminalInput.render();
385
- }
386
- async handleToolSettingsInput(input) {
387
- const pending = this.pendingInteraction;
388
- if (!pending || pending.type !== 'tool-settings') {
389
- return;
390
- }
391
- const trimmed = input.trim();
392
- if (!trimmed) {
393
- display.showWarning('Enter a number, "save", "defaults", or "cancel".');
394
- this.terminalInput.render();
395
- return;
396
- }
397
- const normalized = trimmed.toLowerCase();
398
- if (normalized === 'cancel') {
399
- this.pendingInteraction = null;
400
- display.showInfo('Tool selection cancelled.');
401
- this.terminalInput.render();
402
- return;
403
- }
404
- if (normalized === 'defaults') {
405
- pending.selection = buildEnabledToolSet(null);
406
- this.renderToolMenu(pending);
407
- this.terminalInput.render();
408
- return;
409
- }
410
- if (normalized === 'save') {
411
- await this.persistToolSelection(pending);
412
- this.pendingInteraction = null;
413
- this.terminalInput.render();
414
- return;
415
- }
416
- const choice = Number.parseInt(trimmed, 10);
417
- if (Number.isFinite(choice)) {
418
- const option = pending.options[choice - 1];
419
- if (!option) {
420
- display.showWarning('That option is not available.');
421
- }
422
- else {
423
- if (pending.selection.has(option.id)) {
424
- pending.selection.delete(option.id);
425
- }
426
- else {
427
- pending.selection.add(option.id);
428
- }
429
- this.renderToolMenu(pending);
430
- }
431
- this.terminalInput.render();
432
- return;
433
- }
434
- display.showWarning('Enter a number, "save", "defaults", or "cancel".');
435
- this.terminalInput.render();
436
- }
437
- async persistToolSelection(interaction) {
438
- if (setsEqual(interaction.selection, interaction.initialSelection)) {
439
- display.showInfo('No changes to save.');
440
- return;
441
- }
442
- const defaults = buildEnabledToolSet(null);
443
- if (setsEqual(interaction.selection, defaults)) {
444
- clearToolSettings();
445
- display.showInfo('Tool settings cleared. Defaults will be used on the next launch.');
446
- return;
447
- }
448
- const ordered = interaction.options
449
- .map((option) => option.id)
450
- .filter((id) => interaction.selection.has(id));
451
- saveToolSettings({ enabledTools: ordered });
452
- display.showInfo('Tool settings saved. Restart the CLI to apply them.');
453
- }
454
- async handleAgentSelectionInput(input) {
455
- const pending = this.pendingInteraction;
456
- if (!pending || pending.type !== 'agent-selection') {
457
- return;
458
- }
459
- if (!this.agentMenu) {
460
- this.pendingInteraction = null;
461
- display.showWarning('Agent selection is unavailable in this CLI.');
462
- this.terminalInput.render();
463
- return;
464
- }
465
- const trimmed = input.trim();
466
- if (!trimmed) {
467
- display.showWarning('Enter a number or type "cancel".');
468
- this.terminalInput.render();
469
- return;
470
- }
471
- if (trimmed.toLowerCase() === 'cancel') {
472
- this.pendingInteraction = null;
473
- display.showInfo('Agent selection cancelled.');
474
- this.terminalInput.render();
475
- return;
476
- }
477
- const choice = Number.parseInt(trimmed, 10);
478
- if (!Number.isFinite(choice)) {
479
- display.showWarning('Please enter a valid number.');
480
- this.terminalInput.render();
481
- return;
482
- }
483
- const option = pending.options[choice - 1];
484
- if (!option) {
485
- display.showWarning('That option is not available.');
486
- this.terminalInput.render();
487
- return;
488
- }
489
- await this.persistAgentSelection(option.name);
490
- this.pendingInteraction = null;
491
- this.terminalInput.render();
492
- }
493
- async persistAgentSelection(profileName) {
494
- if (!this.agentMenu) {
495
- return;
496
- }
497
- const currentDefault = this.agentMenu.persistedProfile ?? this.agentMenu.defaultProfile;
498
- if (profileName === currentDefault) {
499
- display.showInfo(`${this.agentMenuLabel(profileName)} is already configured for the next launch.`);
500
- return;
501
- }
502
- if (profileName === this.agentMenu.defaultProfile) {
503
- clearActiveProfilePreference();
504
- this.agentMenu.persistedProfile = null;
505
- display.showInfo(`${this.agentMenuLabel(profileName)} restored as the default agent. Restart the CLI to switch.`);
506
- return;
507
- }
508
- saveActiveProfilePreference(profileName);
509
- this.agentMenu.persistedProfile = profileName;
510
- display.showInfo(`${this.agentMenuLabel(profileName)} will load the next time you start the CLI. Restart to switch now.`);
511
- }
512
- setupHandlers() {
513
- // Handle terminal resize
514
- output.on('resize', () => {
515
- this.terminalInput.handleResize();
516
- });
517
- // Show initial input UI
518
- this.terminalInput.render();
519
- }
520
- setupStatusTracking() {
521
- this.statusSubscription = this.statusTracker.subscribe((_state) => {
522
- // Status tracking callback - currently no-op
523
- });
524
- this.setIdleStatus();
525
- }
526
- teardownStatusTracking() {
527
- if (this.statusSubscription) {
528
- this.statusSubscription();
529
- this.statusSubscription = null;
530
- }
531
- this.statusTracker.reset();
532
- }
533
- setIdleStatus(detail) {
534
- this.statusTracker.setBase('Ready for prompts', {
535
- detail: this.describeStatusDetail(detail),
536
- tone: 'success',
537
- });
538
- }
539
- setProcessingStatus(detail) {
540
- this.statusTracker.setBase('Working on your request', {
541
- detail: this.describeStatusDetail(detail),
542
- tone: 'info',
543
- });
544
- }
545
- describeStatusDetail(detail) {
546
- const parts = [detail?.trim() || this.describeModelDetail()];
547
- const queued = this.followUpQueue.length;
548
- if (queued > 0) {
549
- parts.push(`${queued} follow-up${queued === 1 ? '' : 's'} queued`);
550
- }
551
- return parts.join(' • ');
552
- }
553
- describeModelDetail() {
554
- const provider = this.providerLabel(this.sessionState.provider);
555
- return `${provider} · ${this.sessionState.model}`;
556
- }
557
- refreshContextGauge() {
558
- const tokens = getContextWindowTokens(this.sessionState.model);
559
- this.activeContextWindowTokens =
560
- typeof tokens === 'number' && Number.isFinite(tokens) ? tokens : null;
561
- }
562
- updateContextUsage(percentage) {
563
- this.uiAdapter.updateContextUsage(percentage);
564
- this.terminalInput.setContextUsage(percentage);
565
- }
566
- handleSlashCommandPreviewChange() {
567
- if (this.pendingInteraction) {
568
- this.slashPreviewVisible = false;
569
- return;
570
- }
571
- const shouldShow = this.shouldShowSlashCommandPreview();
572
- if (shouldShow && !this.slashPreviewVisible) {
573
- this.slashPreviewVisible = true;
574
- this.showSlashCommandPreview();
575
- return;
576
- }
577
- if (!shouldShow && this.slashPreviewVisible) {
578
- this.slashPreviewVisible = false;
579
- this.uiAdapter.hideSlashCommandPreview();
580
- }
581
- }
582
- shouldShowSlashCommandPreview() {
583
- const line = this.currentInput ?? '';
584
- if (!line.trim()) {
585
- return false;
586
- }
587
- const trimmed = line.trimStart();
588
- return trimmed.startsWith('/');
589
- }
590
- showSlashCommandPreview() {
591
- // Filter commands based on current input
592
- const line = this.currentInput ?? '';
593
- const trimmed = line.trimStart();
594
- // Filter commands that match the current input
595
- const filtered = this.slashCommands.filter(cmd => cmd.command.startsWith(trimmed) || trimmed === '/');
596
- // Show in the unified UI with dynamic overlay
597
- this.uiAdapter.showSlashCommandPreview(filtered);
598
- // Don't reprompt - this causes flickering
599
- }
600
- /**
601
- * Ensure the terminal input is ready for interactive input.
602
- */
603
- ensureReadlineReady() {
604
- this.terminalInput.render();
605
- }
606
- refreshQueueIndicators() {
607
- if (this.isProcessing) {
608
- this.setProcessingStatus();
609
- }
610
- else {
611
- this.setIdleStatus();
612
- }
613
- this.terminalInput.render();
614
- }
615
- enqueueFollowUpAction(action) {
616
- this.followUpQueue.push(action);
617
- const normalized = action.text.replace(/\s+/g, ' ').trim();
618
- const previewLimit = 80;
619
- const preview = normalized.length > previewLimit ? `${normalized.slice(0, previewLimit - 3)}...` : normalized;
620
- const position = this.followUpQueue.length === 1 ? 'to run next' : `#${this.followUpQueue.length} in queue`;
621
- const label = action.type === 'continuous' ? 'continuous command' : 'follow-up';
622
- // Show immediate acknowledgment with checkmark
623
- if (preview) {
624
- display.showInfo(`✓ ${theme.info(label)} ${position}: ${theme.ui.muted(preview)}`);
625
- }
626
- else {
627
- display.showInfo(`✓ ${theme.info(label)} queued ${position}.`);
628
- }
629
- this.refreshQueueIndicators();
630
- this.scheduleQueueProcessing();
631
- // Re-show the prompt so user can continue typing more follow-ups
632
- this.terminalInput.render();
633
- }
634
- scheduleQueueProcessing() {
635
- if (!this.followUpQueue.length) {
636
- this.refreshQueueIndicators();
637
- return;
638
- }
639
- queueMicrotask(() => {
640
- void this.processQueuedActions();
641
- });
642
- }
643
- /**
644
- * Process queued follow-up actions.
645
- */
646
- async processQueuedActions() {
647
- if (this.isDrainingQueue || this.isProcessing || !this.followUpQueue.length) {
648
- return;
649
- }
650
- this.isDrainingQueue = true;
651
- try {
652
- while (!this.isProcessing && this.followUpQueue.length) {
653
- const next = this.followUpQueue.shift();
654
- const remaining = this.followUpQueue.length;
655
- const label = next.type === 'continuous' ? 'continuous command' : 'follow-up';
656
- const suffix = remaining ? ` (${remaining} left after this)` : '';
657
- display.showSystemMessage(`▶ Running queued ${label}${suffix}.`);
658
- this.refreshQueueIndicators();
659
- if (next.type === 'continuous') {
660
- await this.processContinuousRequest(next.text);
661
- }
662
- else {
663
- await this.processRequest(next.text);
664
- }
665
- }
666
- }
667
- finally {
668
- this.isDrainingQueue = false;
669
- this.refreshQueueIndicators();
670
- }
671
- }
672
- async processInputBlock(line, _wasRapidMultiLine = false) {
673
- this.slashPreviewVisible = false;
674
- this.uiAdapter.hideSlashCommandPreview();
675
- const trimmed = line.trim();
676
- if (await this.handlePendingInteraction(trimmed)) {
677
- return;
678
- }
679
- if (!trimmed) {
680
- return;
681
- }
682
- const lower = trimmed.toLowerCase();
683
- if (lower === 'exit' || lower === 'quit') {
684
- this.shutdown();
685
- return;
686
- }
687
- if (lower === 'clear') {
688
- display.clear();
689
- this.terminalInput.render();
690
- return;
691
- }
692
- if (lower === 'help') {
693
- this.showHelp();
694
- this.terminalInput.render();
695
- return;
696
- }
697
- if (trimmed.startsWith('/')) {
698
- await this.processSlashCommand(trimmed);
699
- return;
700
- }
701
- // Check for continuous/infinite loop commands
702
- if (this.isContinuousCommand(trimmed)) {
703
- await this.processContinuousRequest(trimmed);
704
- this.terminalInput.render();
705
- return;
706
- }
707
- // Direct execution for all inputs, including multi-line pastes
708
- await this.processRequest(trimmed);
709
- this.terminalInput.render();
710
- }
711
- /**
712
- * Check if the command is a continuous/infinite loop command
713
- * These commands run until the task is complete or user interrupts
714
- */
715
- isContinuousCommand(input) {
716
- const lower = input.toLowerCase().trim();
717
- const patterns = [
718
- /^(keep going|continue|finish|until done|run until done|complete|finish it|keep working)/i,
719
- /\b(until done|until complete|until finished|to completion|to the end)\b/i,
720
- /^(do it|just do it|make it work|fix it all|finish everything)\b/i,
721
- ];
722
- return patterns.some(pattern => pattern.test(lower));
723
- }
724
- /**
725
- * Check if the request is a self-improvement task
726
- * These requests should use git to track changes
727
- */
728
- isSelfImprovementRequest(input) {
729
- const lower = input.toLowerCase();
730
- const patterns = [
731
- /\b(improve|enhance|upgrade|refactor|optimize)\b.*\b(codebase|code|project|app|application)\b/i,
732
- /\b(self[- ]?improv|self[- ]?modif|self[- ]?updat)/i,
733
- /\b(make.*better|add.*feature|fix.*bug|implement)/i,
734
- /\b(ability to code|coding capabilit)/i,
735
- ];
736
- return patterns.some(pattern => pattern.test(lower));
737
- }
738
- async handlePendingInteraction(input) {
739
- if (!this.pendingInteraction) {
740
- return false;
741
- }
742
- switch (this.pendingInteraction.type) {
743
- case 'model-provider':
744
- await this.handleModelProviderSelection(input);
745
- return true;
746
- case 'model':
747
- await this.handleModelSelection(input);
748
- return true;
749
- case 'secret-select':
750
- await this.handleSecretSelection(input);
751
- return true;
752
- case 'secret-input':
753
- await this.handleSecretInput(input);
754
- return true;
755
- case 'tool-settings':
756
- await this.handleToolSettingsInput(input);
757
- return true;
758
- case 'agent-selection':
759
- await this.handleAgentSelectionInput(input);
760
- return true;
761
- default:
762
- return false;
763
- }
764
- }
765
- async processSlashCommand(input) {
766
- const [command] = input.split(/\s+/);
767
- if (!command) {
768
- display.showWarning('Enter a slash command.');
769
- this.terminalInput.render();
770
- return;
771
- }
772
- switch (command) {
773
- case '/model':
774
- this.showModelMenu();
775
- break;
776
- case '/secrets':
777
- this.showSecretsMenu();
778
- break;
779
- case '/tools':
780
- this.showToolsMenu();
781
- break;
782
- case '/doctor':
783
- this.runDoctor();
784
- break;
785
- case '/checks':
786
- await this.runRepoChecksCommand();
787
- break;
788
- case '/context':
789
- await this.refreshWorkspaceContextCommand(input);
790
- break;
791
- case '/agents':
792
- this.showAgentsMenu();
793
- break;
794
- case '/sessions':
795
- await this.handleSessionCommand(input);
796
- break;
797
- case '/skills':
798
- await this.handleSkillsCommand(input);
799
- break;
800
- case '/thinking':
801
- this.handleThinkingCommand(input);
802
- break;
803
- case '/autocontinue':
804
- this.handleAutoContinueCommand(input);
805
- break;
806
- case '/shortcuts':
807
- case '/keys':
808
- this.handleShortcutsCommand();
809
- break;
810
- case '/changes':
811
- case '/summary':
812
- this.showFileChangeSummary();
813
- break;
814
- case '/metrics':
815
- case '/stats':
816
- case '/perf':
817
- this.showAlphaZeroMetrics();
818
- break;
819
- case '/suggestions':
820
- case '/improve':
821
- this.showImprovementSuggestions();
822
- break;
823
- case '/plugins':
824
- this.showPluginStatus();
825
- break;
826
- case '/provider':
827
- await this.handleProviderCommand(input);
828
- break;
829
- case '/providers':
830
- this.showConfiguredProviders();
831
- break;
832
- case '/local':
833
- await this.handleLocalCommand(input);
834
- break;
835
- case '/discover':
836
- await this.discoverModelsCommand();
837
- break;
838
- default:
839
- if (!(await this.tryCustomSlashCommand(command, input))) {
840
- display.showWarning(`Unknown command "${command}".`);
841
- }
842
- break;
843
- }
844
- this.terminalInput.render();
845
- }
846
- async tryCustomSlashCommand(command, fullInput) {
847
- const custom = this.customCommandMap.get(command);
848
- if (!custom) {
849
- return false;
850
- }
851
- const args = fullInput.slice(command.length).trim();
852
- if (custom.requireInput && !args) {
853
- display.showWarning(`${command} requires additional input.`);
854
- return true;
855
- }
856
- const prompt = buildCustomCommandPrompt(custom, args, {
857
- workspace: this.workingDir,
858
- profile: this.profile,
859
- provider: this.sessionState.provider,
860
- model: this.sessionState.model,
861
- }).trim();
862
- if (!prompt) {
863
- display.showWarning(`Custom command ${command} did not produce any text. Check ${custom.source} for errors.`);
864
- return true;
865
- }
866
- display.showInfo(`Running ${command} from ${custom.source}...`);
867
- await this.processRequest(prompt);
868
- return true;
869
- }
870
- showHelp() {
871
- const info = [
872
- this.buildSlashCommandList('Available Commands:'),
873
- '',
874
- 'Type your request in natural language and press Enter.',
875
- ];
876
- display.showSystemMessage(info.join('\n'));
877
- }
878
- runDoctor() {
879
- const lines = [];
880
- lines.push(theme.bold('Environment diagnostics'));
881
- lines.push('');
882
- lines.push(`${theme.secondary('Workspace')}: ${this.workingDir}`);
883
- lines.push('');
884
- lines.push(theme.bold('Provider credentials'));
885
- const providerDefinition = getSecretDefinitionForProvider(this.sessionState.provider);
886
- if (providerDefinition) {
887
- const currentValue = getSecretValue(providerDefinition.id);
888
- if (currentValue) {
889
- lines.push(`${theme.success('✓')} ${providerDefinition.label} configured (${providerDefinition.envVar}).`);
890
- }
891
- else {
892
- lines.push(`${theme.warning('⚠')} Missing ${providerDefinition.label} (${providerDefinition.envVar}). Run /secrets to configure it.`);
893
- }
894
- }
895
- else {
896
- lines.push(`${theme.secondary('•')} ${this.providerLabel(this.sessionState.provider)} does not require an API key.`);
897
- }
898
- lines.push('');
899
- lines.push(theme.bold('Tool suites'));
900
- const toolSettings = loadToolSettings();
901
- const selection = buildEnabledToolSet(toolSettings);
902
- const permissions = evaluateToolPermissions(selection);
903
- const options = getToolToggleOptions();
904
- const enabledLabels = options
905
- .filter((option) => selection.has(option.id))
906
- .map((option) => option.label);
907
- lines.push(`Enabled: ${enabledLabels.length ? enabledLabels.join(', ') : 'none'}`);
908
- if (!permissions.warnings.length) {
909
- lines.push(theme.success('All enabled suites loaded successfully.'));
910
- }
911
- else {
912
- lines.push(theme.warning('Issues detected:'));
913
- for (const warning of permissions.warnings) {
914
- const detail = this.describeToolWarning(warning);
915
- lines.push(` - ${detail}`);
916
- }
917
- }
918
- display.showSystemMessage(lines.join('\n'));
919
- }
920
- async runRepoChecksCommand() {
921
- if (this.isProcessing) {
922
- display.showWarning('Wait for the active response to finish before running checks.');
923
- return;
924
- }
925
- const call = {
926
- id: 'manual-run-repo-checks',
927
- name: 'run_repo_checks',
928
- arguments: {},
929
- };
930
- display.showInfo('Running repo checks (npm test/build/lint when available)...');
931
- const output = await this.runtimeSession.toolRuntime.execute(call);
932
- display.showSystemMessage(output);
933
- }
934
- async refreshWorkspaceContextCommand(input) {
935
- if (this.isProcessing) {
936
- display.showWarning('Wait for the active response to finish before refreshing the snapshot.');
937
- return;
938
- }
939
- const { overrides, error } = this.parseContextOverrideTokens(input);
940
- if (error) {
941
- display.showWarning(`${error} ${this.describeContextOverrideUsage()}`);
942
- return;
943
- }
944
- if (overrides) {
945
- this.workspaceOptions = { ...this.workspaceOptions, ...overrides };
946
- }
947
- display.showInfo('Refreshing workspace snapshot...');
948
- const context = buildWorkspaceContext(this.workingDir, this.workspaceOptions);
949
- const profileConfig = this.runtimeSession.refreshWorkspaceContext(context);
950
- const tools = this.runtimeSession.toolRuntime.listProviderTools();
951
- this.baseSystemPrompt = buildInteractiveSystemPrompt(profileConfig.systemPrompt, profileConfig.label, tools);
952
- if (this.rebuildAgent()) {
953
- display.showInfo(`Workspace snapshot refreshed (${this.describeWorkspaceOptions()}).`);
954
- this.resetChatBoxAfterModelSwap();
955
- }
956
- else {
957
- display.showWarning('Workspace snapshot refreshed, but the agent failed to rebuild. Run /doctor for details.');
958
- }
959
- }
960
- parseContextOverrideTokens(input) {
961
- const overrides = {};
962
- let hasOverride = false;
963
- const tokens = input
964
- .trim()
965
- .split(/\s+/)
966
- .slice(1);
967
- for (const token of tokens) {
968
- if (!token) {
969
- continue;
970
- }
971
- const [rawKey, rawValue] = token.split('=');
972
- if (!rawKey || !rawValue) {
973
- return { overrides: null, error: `Invalid option "${token}".` };
974
- }
975
- const key = rawKey.toLowerCase();
976
- const value = Number.parseInt(rawValue, 10);
977
- if (!Number.isFinite(value) || value <= 0) {
978
- return { overrides: null, error: `Value for "${key}" must be a positive integer.` };
979
- }
980
- switch (key) {
981
- case 'depth':
982
- overrides.treeDepth = value;
983
- hasOverride = true;
984
- break;
985
- case 'entries':
986
- overrides.maxEntries = value;
987
- hasOverride = true;
988
- break;
989
- case 'excerpt':
990
- case 'doc':
991
- case 'docs':
992
- overrides.docExcerptLimit = value;
993
- hasOverride = true;
994
- break;
995
- default:
996
- return { overrides: null, error: `Unknown option "${key}".` };
997
- }
998
- }
999
- return { overrides: hasOverride ? overrides : null };
1000
- }
1001
- async handleSessionCommand(input) {
1002
- const tokens = input
1003
- .trim()
1004
- .split(/\s+/)
1005
- .slice(1);
1006
- const action = (tokens.shift() ?? 'list').toLowerCase();
1007
- switch (action) {
1008
- case '':
1009
- case 'list':
1010
- this.showSessionList();
1011
- return;
1012
- case 'save':
1013
- await this.saveSessionCommand(tokens.join(' ').trim());
1014
- return;
1015
- case 'load':
1016
- await this.loadSessionCommand(tokens.join(' ').trim());
1017
- return;
1018
- case 'delete':
1019
- case 'remove':
1020
- this.deleteSessionCommand(tokens.join(' ').trim());
1021
- return;
1022
- case 'new':
1023
- this.newSessionCommand(tokens.join(' ').trim());
1024
- return;
1025
- case 'autosave':
1026
- this.toggleAutosaveCommand(tokens[0]);
1027
- return;
1028
- case 'clear':
1029
- this.clearAutosaveCommand();
1030
- return;
1031
- default:
1032
- display.showWarning('Usage: /sessions [list|save <title>|load <id>|delete <id>|new <title>|autosave on|off|clear]');
1033
- return;
1034
- }
1035
- }
1036
- async handleSkillsCommand(input) {
1037
- const raw = input.slice('/skills'.length).trim();
1038
- const tokens = raw ? raw.split(/\s+/).filter(Boolean) : [];
1039
- let refresh = false;
1040
- const filtered = [];
1041
- for (const token of tokens) {
1042
- if (token === '--refresh' || token === '-r') {
1043
- refresh = true;
1044
- continue;
1045
- }
1046
- filtered.push(token);
1047
- }
1048
- let mode = filtered.shift()?.toLowerCase() ?? 'list';
1049
- if (mode === 'refresh') {
1050
- refresh = true;
1051
- mode = 'list';
1052
- }
1053
- try {
1054
- switch (mode) {
1055
- case '':
1056
- case 'list': {
1057
- const query = filtered.join(' ');
1058
- const output = await this.invokeSkillTool('ListSkills', {
1059
- query: query || undefined,
1060
- refresh_cache: refresh,
1061
- });
1062
- display.showSystemMessage(output);
1063
- break;
1064
- }
1065
- case 'show':
1066
- case 'view': {
1067
- const identifier = filtered.shift();
1068
- if (!identifier) {
1069
- display.showWarning('Usage: /skills show <skill-id> [sections=metadata,body]');
1070
- return;
1071
- }
1072
- let sectionsArg;
1073
- for (let i = 0; i < filtered.length; i += 1) {
1074
- const token = filtered[i];
1075
- if (!token) {
1076
- continue;
1077
- }
1078
- if (token.startsWith('sections=')) {
1079
- sectionsArg = token.slice('sections='.length);
1080
- filtered.splice(i, 1);
1081
- break;
1082
- }
1083
- }
1084
- const sections = sectionsArg
1085
- ? sectionsArg
1086
- .split(',')
1087
- .map((section) => section.trim())
1088
- .filter(Boolean)
1089
- : undefined;
1090
- const output = await this.invokeSkillTool('Skill', {
1091
- skill: identifier,
1092
- sections,
1093
- refresh_cache: refresh,
1094
- });
1095
- display.showSystemMessage(output);
1096
- break;
1097
- }
1098
- default:
1099
- display.showWarning('Usage: /skills [list|refresh|show <id> [sections=a,b]]');
1100
- break;
1101
- }
1102
- }
1103
- catch (error) {
1104
- const message = error instanceof Error ? error.message : String(error);
1105
- display.showError(`Skill command failed: ${message}`);
1106
- }
1107
- }
1108
- async invokeSkillTool(name, args) {
1109
- const handler = this.skillToolHandlers.get(name);
1110
- if (!handler) {
1111
- throw new Error(`Skill tool "${name}" is not registered.`);
1112
- }
1113
- const result = await handler(args);
1114
- return typeof result === 'string' ? result : JSON.stringify(result, null, 2);
1115
- }
1116
- handleThinkingCommand(input) {
1117
- const value = input.slice('/thinking'.length).trim().toLowerCase();
1118
- if (!value) {
1119
- display.showInfo(`Thinking mode is currently ${theme.info(this.thinkingMode)}. Usage: /thinking [concise|balanced|extended]`);
1120
- return;
1121
- }
1122
- if (value !== 'concise' && value !== 'balanced' && value !== 'extended') {
1123
- display.showWarning('Usage: /thinking [concise|balanced|extended]');
1124
- return;
1125
- }
1126
- if (this.isProcessing) {
1127
- display.showWarning('Wait until the current request finishes before changing thinking mode.');
1128
- return;
1129
- }
1130
- this.thinkingMode = value;
1131
- saveSessionPreferences({ thinkingMode: this.thinkingMode });
1132
- if (this.rebuildAgent()) {
1133
- this.resetChatBoxAfterModelSwap();
1134
- }
1135
- const descriptions = {
1136
- concise: 'Hides internal reasoning and responds directly.',
1137
- balanced: 'Shows short thoughts only when helpful.',
1138
- extended: 'Always emits a <thinking> block before the final response.',
1139
- };
1140
- display.showInfo(`Thinking mode set to ${theme.info(value)} – ${descriptions[this.thinkingMode]}`);
1141
- }
1142
- handleShortcutsCommand() {
1143
- // Display keyboard shortcuts help (Claude Code style)
1144
- display.showSystemMessage(formatShortcutsHelp());
1145
- }
1146
- showFileChangeSummary() {
1147
- const summary = this._fileChangeTracker.getSummary();
1148
- const changes = this._fileChangeTracker.getAllChanges();
1149
- if (changes.length === 0) {
1150
- display.showInfo('No files modified in this session.');
1151
- return;
1152
- }
1153
- const lines = [];
1154
- lines.push(theme.bold('Session File Changes'));
1155
- lines.push('');
1156
- lines.push(`${theme.info('•')} ${summary.files} file${summary.files === 1 ? '' : 's'} modified`);
1157
- lines.push(`${theme.info('•')} ${theme.success('+' + summary.additions)} ${theme.error('-' + summary.removals)} lines`);
1158
- lines.push('');
1159
- // Group changes by file
1160
- const fileMap = new Map();
1161
- for (const change of changes) {
1162
- const existing = fileMap.get(change.path) || { edits: 0, writes: 0, additions: 0, removals: 0 };
1163
- if (change.type === 'edit') {
1164
- existing.edits++;
1165
- }
1166
- else if (change.type === 'write') {
1167
- existing.writes++;
1168
- }
1169
- existing.additions += change.additions;
1170
- existing.removals += change.removals;
1171
- fileMap.set(change.path, existing);
1172
- }
1173
- // Display each file
1174
- for (const [path, stats] of fileMap) {
1175
- const operations = [];
1176
- if (stats.edits > 0)
1177
- operations.push(`${stats.edits} edit${stats.edits === 1 ? '' : 's'}`);
1178
- if (stats.writes > 0)
1179
- operations.push(`${stats.writes} write${stats.writes === 1 ? '' : 's'}`);
1180
- const opsText = operations.join(', ');
1181
- const diffText = `${theme.success('+' + stats.additions)} ${theme.error('-' + stats.removals)}`;
1182
- lines.push(` ${theme.dim(path)}`);
1183
- lines.push(` ${opsText} • ${diffText}`);
1184
- }
1185
- display.showSystemMessage(lines.join('\n'));
1186
- }
1187
- showAlphaZeroMetrics() {
1188
- const summary = this.alphaZeroMetrics.getPerformanceSummary();
1189
- display.showSystemMessage(summary);
1190
- }
1191
- showImprovementSuggestions() {
1192
- const suggestions = this.alphaZeroMetrics.getImprovementSuggestions();
1193
- if (suggestions.length === 0) {
1194
- display.showInfo('No improvement suggestions at this time. Keep using the shell to generate metrics!');
1195
- return;
1196
- }
1197
- const lines = [
1198
- theme.bold('Improvement Suggestions (Alpha Zero 2):'),
1199
- '',
1200
- ];
1201
- for (let i = 0; i < suggestions.length; i++) {
1202
- const suggestion = suggestions[i];
1203
- const severityColor = suggestion.severity === 'high'
1204
- ? theme.error
1205
- : suggestion.severity === 'medium'
1206
- ? theme.warning
1207
- : theme.info;
1208
- lines.push(`${i + 1}. [${severityColor(suggestion.severity.toUpperCase())}] ${suggestion.message}`);
1209
- if (suggestion.suggestedAction) {
1210
- lines.push(` ${theme.dim('Action:')} ${suggestion.suggestedAction}`);
1211
- }
1212
- }
1213
- display.showSystemMessage(lines.join('\n'));
1214
- }
1215
- showPluginStatus() {
1216
- const available = listAvailablePlugins();
1217
- const lines = [];
1218
- lines.push(theme.bold('Plugin Status'));
1219
- lines.push('');
1220
- if (available.length === 0) {
1221
- lines.push(theme.secondary('No plugins registered.'));
1222
- }
1223
- else {
1224
- lines.push(theme.secondary('Available Plugins:'));
1225
- lines.push('');
1226
- for (const pluginId of available) {
1227
- const isEnabled = this._enabledPlugins.includes(pluginId);
1228
- const status = isEnabled
1229
- ? theme.success('[ENABLED]')
1230
- : theme.dim('[available]');
1231
- const displayName = pluginId.replace(/-/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase());
1232
- lines.push(` ${status} ${theme.bold(displayName)}`);
1233
- lines.push(` ${theme.dim(`ID: ${pluginId}`)}`);
1234
- lines.push('');
1235
- }
1236
- }
1237
- lines.push(theme.secondary('CLI Flags:'));
1238
- lines.push(' --alpha-zero Enable Alpha Zero 2 RL framework');
1239
- lines.push(' --coding Enable enhanced coding tools');
1240
- lines.push(' --security Enable security research tools');
1241
- lines.push(' --all-plugins Enable all optional plugins');
1242
- display.showSystemMessage(lines.join('\n'));
1243
- }
1244
- showSessionList() {
1245
- const sessions = listSessions(this.profile);
1246
- const lines = [];
1247
- lines.push(theme.bold('Saved sessions'));
1248
- lines.push('Use "/sessions save <title>" to persist history or "/sessions load <id>" to resume.');
1249
- lines.push('');
1250
- if (!sessions.length) {
1251
- lines.push(theme.secondary('No saved sessions yet.'));
1252
- }
1253
- else {
1254
- sessions.forEach((session, index) => {
1255
- const prefix = `${index + 1}.`;
1256
- const label = session.title || '(untitled)';
1257
- const relative = this.describeRelativeTime(session.updatedAt);
1258
- const active = this.activeSessionId && session.id === this.activeSessionId
1259
- ? ` ${theme.success('[active]')}`
1260
- : '';
1261
- const messageCount = `${session.messageCount} msg`;
1262
- const shortId = this.formatSessionId(session.id);
1263
- lines.push(`${prefix.padEnd(3)} ${label} ${theme.secondary(`(${messageCount}, ${relative}, ${shortId})`)}${active}`);
1264
- });
1265
- }
1266
- lines.push('');
1267
- lines.push(`Autosave: ${this.autosaveEnabled ? theme.success('on') : theme.warning('off')} (toggle via "/sessions autosave on|off")`);
1268
- display.showSystemMessage(lines.join('\n'));
1269
- }
1270
- async saveSessionCommand(title) {
1271
- const agent = this.agent;
1272
- if (!agent) {
1273
- display.showWarning('Start a conversation before saving a session.');
1274
- return;
1275
- }
1276
- const history = agent.getHistory();
1277
- if (!history || history.length <= 1) {
1278
- display.showWarning('You need at least one user message before saving a session.');
1279
- return;
1280
- }
1281
- const summary = saveSessionSnapshot({
1282
- id: this.activeSessionId ?? undefined,
1283
- title: title || this.activeSessionTitle || null,
1284
- profile: this.profile,
1285
- provider: this.sessionState.provider,
1286
- model: this.sessionState.model,
1287
- workspaceRoot: this.workingDir,
1288
- messages: history,
1289
- });
1290
- this.cachedHistory = history;
1291
- this.updateActiveSession(summary, true);
1292
- this.sessionResumeNotice = null;
1293
- this.autosaveIfEnabled();
1294
- display.showInfo(`Session saved as "${summary.title}" (id ${this.formatSessionId(summary.id)}).`);
1295
- }
1296
- async loadSessionCommand(selector) {
1297
- const summary = this.resolveSessionBySelector(selector);
1298
- if (!summary) {
1299
- display.showWarning('No session matches that selection.');
1300
- return;
1301
- }
1302
- const stored = loadSessionById(summary.id);
1303
- if (!stored) {
1304
- display.showWarning('Failed to load that session. It may have been corrupted or deleted.');
1305
- return;
1306
- }
1307
- this.cachedHistory = stored.messages;
1308
- this.updateActiveSession(summary, true);
1309
- this.sessionResumeNotice = `Loaded session "${summary.title}".`;
1310
- if (this.agent) {
1311
- this.agent.loadHistory(stored.messages);
1312
- this.sessionResumeNotice = null;
1313
- display.showInfo(`Loaded session "${summary.title}".`);
1314
- this.refreshContextGauge();
1315
- this.captureHistorySnapshot();
1316
- this.pendingHistoryLoad = null;
1317
- }
1318
- else {
1319
- this.pendingHistoryLoad = stored.messages;
1320
- display.showInfo(`Session "${summary.title}" queued to load once the agent is ready.`);
1321
- }
1322
- this.autosaveIfEnabled();
1323
- }
1324
- deleteSessionCommand(selector) {
1325
- const summary = this.resolveSessionBySelector(selector);
1326
- if (!summary) {
1327
- display.showWarning('No session matches that selection.');
1328
- return;
1329
- }
1330
- if (!deleteSession(summary.id)) {
1331
- display.showWarning('Unable to delete that session.');
1332
- return;
1333
- }
1334
- display.showInfo(`Deleted session "${summary.title}".`);
1335
- if (this.activeSessionId === summary.id) {
1336
- this.activeSessionId = null;
1337
- this.activeSessionTitle = null;
1338
- saveSessionPreferences({ lastSessionId: null });
1339
- }
1340
- }
1341
- newSessionCommand(title) {
1342
- if (this.agent) {
1343
- this.agent.clearHistory();
1344
- this.cachedHistory = this.agent.getHistory();
1345
- this.pendingHistoryLoad = null;
1346
- }
1347
- if (!this.agent) {
1348
- this.cachedHistory = [];
1349
- this.pendingHistoryLoad = [];
1350
- }
1351
- this.activeSessionId = null;
1352
- this.activeSessionTitle = title || null;
1353
- this.sessionResumeNotice = null;
1354
- saveSessionPreferences({ lastSessionId: null });
1355
- clearAutosaveSnapshot(this.profile);
1356
- display.showInfo('Started a new empty session.');
1357
- this.refreshContextGauge();
1358
- }
1359
- toggleAutosaveCommand(value) {
1360
- if (!value) {
1361
- display.showWarning('Usage: /sessions autosave on|off');
1362
- return;
1363
- }
1364
- const normalized = value.toLowerCase();
1365
- if (normalized !== 'on' && normalized !== 'off') {
1366
- display.showWarning('Usage: /sessions autosave on|off');
1367
- return;
1368
- }
1369
- this.autosaveEnabled = normalized === 'on';
1370
- saveSessionPreferences({ autosave: this.autosaveEnabled });
1371
- display.showInfo(`Autosave ${this.autosaveEnabled ? 'enabled' : 'disabled'}.`);
1372
- if (!this.autosaveEnabled) {
1373
- clearAutosaveSnapshot(this.profile);
1374
- }
1375
- else {
1376
- this.autosaveIfEnabled();
1377
- }
1378
- }
1379
- clearAutosaveCommand() {
1380
- clearAutosaveSnapshot(this.profile);
1381
- display.showInfo('Cleared autosave history.');
1382
- }
1383
- handleAutoContinueCommand(input) {
1384
- const tokens = input.split(/\s+/).slice(1);
1385
- const value = tokens[0]?.toLowerCase();
1386
- if (!value) {
1387
- // Show current status
1388
- display.showInfo(`Auto-continue is ${this.autoContinueEnabled ? 'enabled' : 'disabled'}. ` +
1389
- `Use /autocontinue on|off to toggle.`);
1390
- return;
1391
- }
1392
- if (value !== 'on' && value !== 'off') {
1393
- display.showWarning('Usage: /autocontinue on|off');
1394
- return;
1395
- }
1396
- this.autoContinueEnabled = value === 'on';
1397
- saveSessionPreferences({ autoContinue: this.autoContinueEnabled });
1398
- // Update the current agent if it exists
1399
- if (this.agent) {
1400
- this.agent.setAutoContinue(this.autoContinueEnabled);
1401
- }
1402
- display.showInfo(`Auto-continue ${this.autoContinueEnabled ? 'enabled' : 'disabled'}. ` +
1403
- (this.autoContinueEnabled
1404
- ? 'The model will be auto-prompted to continue when it expresses intent but does not use tools.'
1405
- : 'The model will not be auto-prompted to continue.'));
1406
- }
1407
- updateActiveSession(summary, remember = false) {
1408
- this.activeSessionId = summary?.id ?? null;
1409
- this.activeSessionTitle = summary?.title ?? null;
1410
- if (remember) {
1411
- saveSessionPreferences({ lastSessionId: summary?.id ?? null });
1412
- }
1413
- }
1414
- resolveSessionBySelector(selector) {
1415
- const sessions = listSessions(this.profile);
1416
- if (!sessions.length) {
1417
- return null;
1418
- }
1419
- if (!selector) {
1420
- return sessions[0] ?? null;
1421
- }
1422
- const trimmed = selector.trim();
1423
- if (!trimmed) {
1424
- return sessions[0] ?? null;
1425
- }
1426
- const index = Number.parseInt(trimmed, 10);
1427
- if (Number.isFinite(index)) {
1428
- const entry = sessions[index - 1];
1429
- return entry ?? null;
1430
- }
1431
- const match = sessions.find((session) => session.id.startsWith(trimmed));
1432
- return match ?? null;
1433
- }
1434
- formatSessionId(id) {
1435
- return id.length > 8 ? `${id.slice(0, 8)}…` : id;
1436
- }
1437
- describeRelativeTime(timestamp) {
1438
- const updated = Date.parse(timestamp);
1439
- if (!updated) {
1440
- return 'unknown';
1441
- }
1442
- const deltaMs = Date.now() - updated;
1443
- const minutes = Math.round(deltaMs / 60000);
1444
- if (minutes < 1) {
1445
- return 'just now';
1446
- }
1447
- if (minutes < 60) {
1448
- return `${minutes}m ago`;
1449
- }
1450
- const hours = Math.round(minutes / 60);
1451
- if (hours < 24) {
1452
- return `${hours}h ago`;
1453
- }
1454
- const days = Math.round(hours / 24);
1455
- return `${days}d ago`;
1456
- }
1457
- captureHistorySnapshot() {
1458
- if (!this.agent) {
1459
- return;
1460
- }
1461
- this.cachedHistory = this.agent.getHistory();
1462
- }
1463
- autosaveIfEnabled() {
1464
- if (!this.autosaveEnabled) {
1465
- return;
1466
- }
1467
- if (!this.cachedHistory || this.cachedHistory.length <= 1) {
1468
- return;
1469
- }
1470
- saveAutosaveSnapshot(this.profile, {
1471
- provider: this.sessionState.provider,
1472
- model: this.sessionState.model,
1473
- workspaceRoot: this.workingDir,
1474
- title: this.activeSessionTitle,
1475
- messages: this.cachedHistory,
1476
- });
1477
- }
1478
- describeWorkspaceOptions() {
1479
- const depth = this.workspaceOptions.treeDepth ?? 'default';
1480
- const entries = this.workspaceOptions.maxEntries ?? 'default';
1481
- const excerpt = this.workspaceOptions.docExcerptLimit ?? 'default';
1482
- return `depth=${depth}, entries=${entries}, excerpt=${excerpt}`;
1483
- }
1484
- describeContextOverrideUsage() {
1485
- return 'Usage: /context [depth=<n>] [entries=<n>] [excerpt=<n>]';
1486
- }
1487
- describeToolWarning(warning) {
1488
- if (warning.reason === 'missing-secret' && warning.secretId) {
1489
- return `${warning.label}: missing ${warning.secretId}. Use /secrets to configure it.`;
1490
- }
1491
- return `${warning.label}: ${warning.reason}.`;
1492
- }
1493
- buildSlashCommandList(header) {
1494
- const lines = [theme.gradient.primary(header), ''];
1495
- for (const command of this.slashCommands) {
1496
- lines.push(`${theme.primary(command.command)} - ${command.description}`);
1497
- }
1498
- return lines.join('\n');
1499
- }
1500
- async showModelMenu() {
1501
- display.showSystemMessage(theme.ui.muted('Fetching latest models from providers...'));
1502
- // Fetch live models from all configured providers
1503
- const providerStatuses = await quickCheckProviders();
1504
- const providerOptions = this.buildProviderOptionsWithDiscovery(providerStatuses);
1505
- if (!providerOptions.length) {
1506
- display.showWarning('No providers are available.');
1507
- return;
1508
- }
1509
- const lines = [
1510
- theme.bold('Select a provider:'),
1511
- ...providerOptions.map((option, index) => {
1512
- const isCurrent = option.provider === this.sessionState.provider;
1513
- const countLabel = `${option.modelCount} model${option.modelCount === 1 ? '' : 's'}`;
1514
- const latestLabel = option.latestModel ? theme.success(` (latest: ${option.latestModel})`) : '';
1515
- const label = this.colorizeDropdownLine(`${index + 1}. ${option.label} — ${countLabel}${latestLabel}`, index);
1516
- const suffix = isCurrent ? ` ${theme.primary('• current')}` : '';
1517
- return `${label}${suffix}`;
1518
- }),
1519
- 'Type the number of the provider to continue, or type "cancel".',
1520
- ];
1521
- display.showSystemMessage(lines.join('\n'));
1522
- this.pendingInteraction = { type: 'model-provider', options: providerOptions };
1523
- }
1524
- buildProviderOptions() {
1525
- const counts = new Map();
1526
- for (const preset of MODEL_PRESETS) {
1527
- counts.set(preset.provider, (counts.get(preset.provider) ?? 0) + 1);
1528
- }
1529
- const orderedProviders = [];
1530
- const seen = new Set();
1531
- for (const preset of MODEL_PRESETS) {
1532
- if (seen.has(preset.provider)) {
1533
- continue;
1534
- }
1535
- seen.add(preset.provider);
1536
- orderedProviders.push(preset.provider);
1537
- }
1538
- return orderedProviders.map((provider) => ({
1539
- provider,
1540
- label: this.providerLabel(provider),
1541
- modelCount: counts.get(provider) ?? 0,
1542
- }));
1543
- }
1544
- buildProviderOptionsWithDiscovery(providerStatuses) {
1545
- // Merge static presets with discovered models
1546
- const providerData = new Map();
1547
- // Initialize with static presets
1548
- for (const preset of MODEL_PRESETS) {
1549
- const existing = providerData.get(preset.provider);
1550
- if (existing) {
1551
- existing.count++;
1552
- }
1553
- else {
1554
- providerData.set(preset.provider, {
1555
- count: 1,
1556
- latestModel: '',
1557
- discoveredModels: [],
1558
- });
1559
- }
1560
- }
1561
- // Merge in discovered models from API
1562
- for (const status of providerStatuses) {
1563
- if (!status.available)
1564
- continue;
1565
- const existing = providerData.get(status.provider);
1566
- if (existing) {
1567
- existing.latestModel = status.latestModel;
1568
- }
1569
- else {
1570
- providerData.set(status.provider, {
1571
- count: 1,
1572
- latestModel: status.latestModel,
1573
- discoveredModels: [],
1574
- });
1575
- }
1576
- }
1577
- // Also check cached discovered models for additional models
1578
- const cachedModels = getCachedDiscoveredModels();
1579
- for (const model of cachedModels) {
1580
- const existing = providerData.get(model.provider);
1581
- if (existing && !existing.discoveredModels.includes(model.id)) {
1582
- existing.discoveredModels.push(model.id);
1583
- }
1584
- }
1585
- // Build ordered list (same order as static presets)
1586
- const orderedProviders = [];
1587
- const seen = new Set();
1588
- for (const preset of MODEL_PRESETS) {
1589
- if (!seen.has(preset.provider)) {
1590
- seen.add(preset.provider);
1591
- orderedProviders.push(preset.provider);
1592
- }
1593
- }
1594
- // Add any providers that only have discovered models
1595
- for (const status of providerStatuses) {
1596
- if (status.available && !seen.has(status.provider)) {
1597
- seen.add(status.provider);
1598
- orderedProviders.push(status.provider);
1599
- }
1600
- }
1601
- return orderedProviders.map((provider) => {
1602
- const data = providerData.get(provider);
1603
- return {
1604
- provider,
1605
- label: this.providerLabel(provider),
1606
- modelCount: data?.count ?? 0,
1607
- latestModel: data?.latestModel,
1608
- discoveredModels: data?.discoveredModels ?? [],
1609
- };
1610
- });
1611
- }
1612
- showProviderModels(option) {
1613
- // Start with static presets
1614
- const staticModels = MODEL_PRESETS.filter((preset) => preset.provider === option.provider);
1615
- // Build combined list with latest model at top if discovered
1616
- const allModels = [];
1617
- const seenIds = new Set();
1618
- // If we have a latestModel from discovery, add it first if not in static list
1619
- if (option.latestModel && !staticModels.some(m => m.id === option.latestModel)) {
1620
- allModels.push({
1621
- id: option.latestModel,
1622
- label: option.latestModel,
1623
- provider: option.provider,
1624
- description: `Latest ${this.providerLabel(option.provider)} model (auto-discovered)`,
1625
- });
1626
- seenIds.add(option.latestModel);
1627
- }
1628
- // Add static models
1629
- for (const model of staticModels) {
1630
- if (!seenIds.has(model.id)) {
1631
- allModels.push(model);
1632
- seenIds.add(model.id);
1633
- }
1634
- }
1635
- // Add any additional discovered models not in static list
1636
- if (option.discoveredModels) {
1637
- const sortedDiscovered = sortModelsByPriority(option.provider, option.discoveredModels);
1638
- for (const modelId of sortedDiscovered) {
1639
- if (!seenIds.has(modelId)) {
1640
- allModels.push({
1641
- id: modelId,
1642
- label: modelId,
1643
- provider: option.provider,
1644
- description: `${this.providerLabel(option.provider)} model (auto-discovered)`,
1645
- });
1646
- seenIds.add(modelId);
1647
- }
1648
- }
1649
- }
1650
- if (!allModels.length) {
1651
- display.showWarning(`No models available for ${option.label}.`);
1652
- this.pendingInteraction = null;
1653
- return;
1654
- }
1655
- const lines = [
1656
- theme.bold(`Select a model from ${option.label}:`),
1657
- ...allModels.map((preset, index) => {
1658
- const isCurrent = preset.id === this.sessionState.model;
1659
- const isLatest = preset.id === option.latestModel;
1660
- const latestBadge = isLatest ? theme.success(' ★ LATEST') : '';
1661
- const label = this.colorizeDropdownLine(`${index + 1}. ${preset.label}${latestBadge}`, index);
1662
- const suffix = isCurrent ? ` ${theme.primary('• current')}` : '';
1663
- const description = this.colorizeDropdownLine(` ${preset.description}`, index);
1664
- return `${label}${suffix}\n${description}`;
1665
- }),
1666
- 'Type the number of the model to select it, type "back" to change provider, or type "cancel".',
1667
- ];
1668
- display.showSystemMessage(lines.join('\n'));
1669
- this.pendingInteraction = { type: 'model', provider: option.provider, options: allModels };
1670
- }
1671
- showSecretsMenu() {
1672
- const definitions = listSecretDefinitions();
1673
- const lines = [
1674
- theme.bold('Manage Secrets:'),
1675
- ...definitions.map((definition, index) => {
1676
- const value = getSecretValue(definition.id);
1677
- const status = value ? maskSecret(value) : theme.warning('not set');
1678
- const providers = definition.providers.map((id) => this.providerLabel(id)).join(', ');
1679
- const label = this.colorizeDropdownLine(`${index + 1}. ${definition.label} (${providers})`, index);
1680
- return `${label} — ${status}`;
1681
- }),
1682
- 'Enter the number to update a key, or type "cancel".',
1683
- ];
1684
- display.showSystemMessage(lines.join('\n'));
1685
- this.pendingInteraction = { type: 'secret-select', options: definitions };
1686
- }
1687
- showToolsMenu() {
1688
- const options = getToolToggleOptions();
1689
- if (!options.length) {
1690
- display.showWarning('No configurable tools are available.');
1691
- return;
1692
- }
1693
- const selection = buildEnabledToolSet(loadToolSettings());
1694
- const interaction = {
1695
- type: 'tool-settings',
1696
- options,
1697
- selection,
1698
- initialSelection: new Set(selection),
1699
- };
1700
- this.pendingInteraction = interaction;
1701
- this.renderToolMenu(interaction);
1702
- }
1703
- renderToolMenu(interaction) {
1704
- const lines = [
1705
- theme.bold('Select which tools are enabled (changes apply on next launch):'),
1706
- ...interaction.options.map((option, index) => this.formatToolOptionLine(option, index, interaction.selection)),
1707
- '',
1708
- 'Enter the number to toggle, "save" to persist, "defaults" to restore recommended tools, or "cancel".',
1709
- ];
1710
- display.showSystemMessage(lines.join('\n'));
1711
- }
1712
- formatToolOptionLine(option, index, selection) {
1713
- const enabled = selection.has(option.id);
1714
- const checkbox = enabled ? theme.primary('[x]') : theme.ui.muted('[ ]');
1715
- const details = [option.description];
1716
- if (option.requiresSecret) {
1717
- const hasSecret = Boolean(getSecretValue(option.requiresSecret));
1718
- const status = hasSecret ? theme.success('API key set') : theme.warning('API key missing');
1719
- details.push(status);
1720
- }
1721
- const numberLabel = this.colorizeDropdownLine(`${index + 1}.`, index);
1722
- const optionLabel = this.colorizeDropdownLine(option.label, index);
1723
- const detailLine = this.colorizeDropdownLine(` ${details.join(' • ')}`, index);
1724
- return `${numberLabel} ${checkbox} ${optionLabel}\n${detailLine}`;
1725
- }
1726
- showAgentsMenu() {
1727
- if (!this.agentMenu) {
1728
- display.showWarning('Agent selection is not available in this CLI.');
1729
- return;
1730
- }
1731
- const lines = [
1732
- theme.bold('Select the default agent profile (changes apply on next launch):'),
1733
- ...this.agentMenu.options.map((option, index) => this.formatAgentOptionLine(option, index)),
1734
- '',
1735
- 'Enter the number to save it, or type "cancel".',
1736
- ];
1737
- display.showSystemMessage(lines.join('\n'));
1738
- this.pendingInteraction = { type: 'agent-selection', options: this.agentMenu.options };
1739
- }
1740
- formatAgentOptionLine(option, index) {
1741
- const numberLabel = this.colorizeDropdownLine(`${index + 1}. ${option.label}`, index);
1742
- if (!this.agentMenu) {
1743
- return numberLabel;
1744
- }
1745
- const badges = [];
1746
- const nextProfile = this.agentMenu.persistedProfile ?? this.agentMenu.defaultProfile;
1747
- if (option.name === nextProfile) {
1748
- badges.push(theme.primary('next launch'));
1749
- }
1750
- if (option.name === this.profile) {
1751
- badges.push(theme.success('current session'));
1752
- }
1753
- const badgeSuffix = badges.length ? ` ${badges.join(' • ')}` : '';
1754
- const rows = [
1755
- `${numberLabel}${badgeSuffix}`,
1756
- ` ${this.providerLabel(option.defaultProvider)} • ${option.defaultModel}`,
1757
- ];
1758
- if (option.description?.trim()) {
1759
- rows.push(` ${option.description.trim()}`);
1760
- }
1761
- return rows.join('\n');
1762
- }
1763
- async handleModelProviderSelection(input) {
1764
- const pending = this.pendingInteraction;
1765
- if (!pending || pending.type !== 'model-provider') {
1766
- return;
1767
- }
1768
- const trimmed = input.trim();
1769
- if (!trimmed) {
1770
- display.showWarning('Enter a number or type cancel.');
1771
- this.terminalInput.render();
1772
- return;
1773
- }
1774
- if (trimmed.toLowerCase() === 'cancel') {
1775
- this.pendingInteraction = null;
1776
- display.showInfo('Model selection cancelled.');
1777
- this.terminalInput.render();
1778
- return;
1779
- }
1780
- const choice = Number.parseInt(trimmed, 10);
1781
- if (!Number.isFinite(choice)) {
1782
- display.showWarning('Please enter a valid number.');
1783
- this.terminalInput.render();
1784
- return;
1785
- }
1786
- const option = pending.options[choice - 1];
1787
- if (!option) {
1788
- display.showWarning('That option is not available.');
1789
- this.terminalInput.render();
1790
- return;
1791
- }
1792
- this.showProviderModels(option);
1793
- this.terminalInput.render();
1794
- }
1795
- async handleModelSelection(input) {
1796
- const pending = this.pendingInteraction;
1797
- if (!pending || pending.type !== 'model') {
1798
- return;
1799
- }
1800
- const trimmed = input.trim();
1801
- if (!trimmed) {
1802
- display.showWarning('Enter a number, type "back", or type "cancel".');
1803
- this.terminalInput.render();
1804
- return;
1805
- }
1806
- if (trimmed.toLowerCase() === 'back') {
1807
- this.showModelMenu();
1808
- this.terminalInput.render();
1809
- return;
1810
- }
1811
- if (trimmed.toLowerCase() === 'cancel') {
1812
- this.pendingInteraction = null;
1813
- display.showInfo('Model selection cancelled.');
1814
- this.terminalInput.render();
1815
- return;
1816
- }
1817
- const choice = Number.parseInt(trimmed, 10);
1818
- if (!Number.isFinite(choice)) {
1819
- display.showWarning('Please enter a valid number.');
1820
- this.terminalInput.render();
1821
- return;
1822
- }
1823
- const preset = pending.options[choice - 1];
1824
- if (!preset) {
1825
- display.showWarning('That option is not available.');
1826
- this.terminalInput.render();
1827
- return;
1828
- }
1829
- this.pendingInteraction = null;
1830
- await this.applyModelPreset(preset);
1831
- this.terminalInput.render();
1832
- }
1833
- async applyModelPreset(preset) {
1834
- try {
1835
- ensureSecretForProvider(preset.provider);
1836
- }
1837
- catch (error) {
1838
- this.handleAgentSetupError(error, () => this.applyModelPreset(preset), preset.provider);
1839
- return;
1840
- }
1841
- this.sessionState = {
1842
- provider: preset.provider,
1843
- model: preset.id,
1844
- temperature: preset.temperature,
1845
- maxTokens: preset.maxTokens,
1846
- reasoningEffort: preset.reasoningEffort,
1847
- };
1848
- this.applyPresetReasoningDefaults();
1849
- if (this.rebuildAgent()) {
1850
- display.showInfo(`Switched to ${preset.label}.`);
1851
- this.refreshBannerSessionInfo();
1852
- this.persistSessionPreference();
1853
- this.resetChatBoxAfterModelSwap();
1854
- }
1855
- }
1856
- async handleSecretSelection(input) {
1857
- const pending = this.pendingInteraction;
1858
- if (!pending || pending.type !== 'secret-select') {
1859
- return;
1860
- }
1861
- const trimmed = input.trim();
1862
- if (!trimmed) {
1863
- display.showWarning('Enter a number or type cancel.');
1864
- this.terminalInput.render();
1865
- return;
1866
- }
1867
- if (trimmed.toLowerCase() === 'cancel') {
1868
- this.pendingInteraction = null;
1869
- display.showInfo('Secret management cancelled.');
1870
- this.terminalInput.render();
1871
- return;
1872
- }
1873
- const choice = Number.parseInt(trimmed, 10);
1874
- if (!Number.isFinite(choice)) {
1875
- display.showWarning('Please enter a valid number.');
1876
- this.terminalInput.render();
1877
- return;
1878
- }
1879
- const secret = pending.options[choice - 1];
1880
- if (!secret) {
1881
- display.showWarning('That option is not available.');
1882
- this.terminalInput.render();
1883
- return;
1884
- }
1885
- display.showSystemMessage(`Enter a new value for ${secret.label} or type "cancel".`);
1886
- this.pendingInteraction = { type: 'secret-input', secret };
1887
- this.terminalInput.render();
1888
- }
1889
- async handleSecretInput(input) {
1890
- const pending = this.pendingInteraction;
1891
- if (!pending || pending.type !== 'secret-input') {
1892
- return;
1893
- }
1894
- const trimmed = input.trim();
1895
- if (!trimmed) {
1896
- display.showWarning('Enter a value or type cancel.');
1897
- this.terminalInput.render();
1898
- return;
1899
- }
1900
- if (trimmed.toLowerCase() === 'cancel') {
1901
- this.pendingInteraction = null;
1902
- this.pendingSecretRetry = null;
1903
- display.showInfo('Secret unchanged.');
1904
- this.terminalInput.render();
1905
- return;
1906
- }
1907
- try {
1908
- setSecretValue(pending.secret.id, trimmed);
1909
- display.showInfo(`${pending.secret.label} updated.`);
1910
- this.pendingInteraction = null;
1911
- const deferred = this.pendingSecretRetry;
1912
- this.pendingSecretRetry = null;
1913
- if (pending.secret.providers.includes(this.sessionState.provider)) {
1914
- if (this.rebuildAgent()) {
1915
- this.resetChatBoxAfterModelSwap();
1916
- }
1917
- }
1918
- if (deferred) {
1919
- await deferred();
1920
- }
1921
- }
1922
- catch (error) {
1923
- const message = error instanceof Error ? error.message : String(error);
1924
- display.showError(message);
1925
- this.pendingInteraction = null;
1926
- this.pendingSecretRetry = null;
1927
- }
1928
- this.terminalInput.render();
1929
- }
1930
- async processRequest(request) {
1931
- if (this.isProcessing) {
1932
- this.enqueueFollowUpAction({ type: 'request', text: request });
1933
- return;
1934
- }
1935
- if (!this.agent && !this.rebuildAgent()) {
1936
- display.showWarning('Configure an API key via /secrets before sending requests.');
1937
- return;
1938
- }
1939
- const agent = this.agent;
1940
- if (!agent) {
1941
- return;
1942
- }
1943
- this.isProcessing = true;
1944
- this.terminalInput.setStreaming(true);
1945
- const requestStartTime = Date.now(); // Alpha Zero 2 timing
1946
- this.uiAdapter.startProcessing('Working on your request');
1947
- this.setProcessingStatus();
1948
- let responseText = '';
1949
- try {
1950
- // Add visual separator between user prompt and AI response
1951
- display.newLine();
1952
- // Claude Code style: Show unified streaming header before response
1953
- // This provides visual consistency with the startup Ready bar
1954
- display.showStreamingHeader();
1955
- display.showThinking('Responding...');
1956
- // Stream responses so users immediately see progress like Claude Code
1957
- responseText = await agent.send(request, true);
1958
- await this.awaitPendingCleanup();
1959
- this.captureHistorySnapshot();
1960
- this.autosaveIfEnabled();
1961
- // Track metrics with Alpha Zero 2
1962
- const elapsedMs = Date.now() - requestStartTime;
1963
- this.alphaZeroMetrics.recordMessage(elapsedMs);
1964
- if (!responseText?.trim()) {
1965
- display.showWarning('The provider returned an empty response. Check your API key/provider selection or retry the prompt.');
1966
- }
1967
- }
1968
- catch (error) {
1969
- const handled = this.handleProviderError(error, () => this.processRequest(request));
1970
- if (!handled) {
1971
- // Pass full error object for enhanced formatting with stack trace
1972
- display.showError(error instanceof Error ? error.message : String(error), error);
1973
- }
1974
- }
1975
- finally {
1976
- display.stopThinking(false);
1977
- this.isProcessing = false;
1978
- this.terminalInput.setStreaming(false);
1979
- this.uiAdapter.endProcessing('Ready for prompts');
1980
- this.setIdleStatus();
1981
- display.newLine();
1982
- this.updateStatusMessage(null);
1983
- // Claude Code style: Show unified status bar before prompt
1984
- // This creates consistent UI between startup and post-streaming
1985
- this.showUnifiedStatusBar();
1986
- // CRITICAL: Ensure readline prompt is active for user input
1987
- // Claude Code style: New prompt naturally appears at bottom
1988
- this.ensureReadlineReady();
1989
- this.terminalInput.render();
1990
- this.scheduleQueueProcessing();
1991
- this.refreshQueueIndicators();
1992
- }
1993
- }
1994
- /**
1995
- * Process a continuous/infinite loop request.
1996
- * Runs the agent in a loop until:
1997
- * 1. The agent indicates completion (verified by AI confirmation)
1998
- * 2. User interrupts (Ctrl+C)
1999
- * 3. Maximum iterations reached (safety limit)
2000
- *
2001
- * Uses intelligent task completion detection with AI verification
2002
- * to ensure tasks are truly complete before stopping.
2003
- *
2004
- * Context is automatically managed - overflow errors trigger auto-recovery.
2005
- */
2006
- async processContinuousRequest(initialRequest) {
2007
- const MAX_ITERATIONS = 100; // Safety limit to prevent truly infinite loops
2008
- if (this.isProcessing) {
2009
- this.enqueueFollowUpAction({ type: 'continuous', text: initialRequest });
2010
- return;
2011
- }
2012
- if (!this.agent && !this.rebuildAgent()) {
2013
- display.showWarning('Configure an API key via /secrets before sending requests.');
2014
- return;
2015
- }
2016
- const agent = this.agent;
2017
- if (!agent) {
2018
- return;
2019
- }
2020
- this.isProcessing = true;
2021
- this.terminalInput.setStreaming(true);
2022
- const overallStartTime = Date.now();
2023
- // Initialize the task completion detector
2024
- const completionDetector = getTaskCompletionDetector();
2025
- completionDetector.reset();
2026
- display.showSystemMessage(`🔄 Starting continuous execution mode. Press Ctrl+C to stop.`);
2027
- display.showSystemMessage(`📊 Using intelligent task completion detection with AI verification.`);
2028
- this.uiAdapter.startProcessing('Continuous execution mode');
2029
- this.setProcessingStatus();
2030
- // Claude Code style: Show unified streaming header before response
2031
- display.showStreamingHeader();
2032
- let iteration = 0;
2033
- let lastResponse = '';
2034
- let consecutiveNoProgress = 0;
2035
- const MAX_NO_PROGRESS = 5; // Increased to allow more attempts before giving up
2036
- let pendingVerification = false;
2037
- let verificationAttempts = 0;
2038
- const MAX_VERIFICATION_ATTEMPTS = 2;
2039
- try {
2040
- // Enhance initial prompt with git context for self-improvement tasks
2041
- let currentPrompt = initialRequest;
2042
- if (this.isSelfImprovementRequest(initialRequest)) {
2043
- currentPrompt = `${initialRequest}
2044
-
2045
- IMPORTANT: You have full git access. After making improvements:
2046
- 1. Use bash to run: git status (see changes)
2047
- 2. Use bash to run: git add -A (stage changes)
2048
- 3. Use bash to run: git commit -m "descriptive message" (commit)
2049
- 4. Use bash to run: git push (when milestone reached)
2050
-
2051
- Commit frequently with descriptive messages. Push when ready.
2052
- When truly finished with ALL tasks, explicitly state "TASK_FULLY_COMPLETE".`;
2053
- }
2054
- while (iteration < MAX_ITERATIONS) {
2055
- iteration++;
2056
- display.showSystemMessage(`\n📍 Iteration ${iteration}/${MAX_ITERATIONS}`);
2057
- this.updateStatusMessage(`Working on iteration ${iteration}...`);
2058
- try {
2059
- // Send the request and capture the response (streaming disabled)
2060
- display.showThinking('Responding...');
2061
- const response = await agent.send(currentPrompt, true);
2062
- await this.awaitPendingCleanup();
2063
- this.captureHistorySnapshot();
2064
- this.autosaveIfEnabled();
2065
- // Track metrics
2066
- const elapsedMs = Date.now() - overallStartTime;
2067
- this.alphaZeroMetrics.recordMessage(elapsedMs);
2068
- if (!response?.trim()) {
2069
- display.showWarning('Model returned an empty response. Retrying this iteration...');
2070
- consecutiveNoProgress++;
2071
- currentPrompt = `${initialRequest}
2072
-
2073
- The previous reply was empty. Resume the task now: take the next action, call the necessary tools, and report progress.`;
2074
- continue;
2075
- }
2076
- // Extract tools used from the response (look for tool call patterns)
2077
- const toolsUsed = this.extractToolsFromResponse(response);
2078
- completionDetector.recordToolCall.bind(completionDetector);
2079
- toolsUsed.forEach(tool => completionDetector.recordToolCall(tool, true, true));
2080
- // Use intelligent completion detection
2081
- const completionAnalysis = completionDetector.analyzeCompletion(response, toolsUsed);
2082
- display.showSystemMessage(`📈 Completion confidence: ${(completionAnalysis.confidence * 100).toFixed(0)}%`);
2083
- // Check for explicit TASK_FULLY_COMPLETE marker (highest priority)
2084
- // BUT: Don't terminate if the response also indicates work is incomplete
2085
- if (response.includes('TASK_FULLY_COMPLETE')) {
2086
- const hasContradiction = this.responseIndicatesIncompleteWork(response);
2087
- if (hasContradiction) {
2088
- display.showSystemMessage(`\n⚠️ TASK_FULLY_COMPLETE detected but response indicates incomplete work. Continuing...`);
2089
- // Override the completion signal - the AI is contradicting itself
2090
- currentPrompt = `You marked the task as TASK_FULLY_COMPLETE but also indicated that work is still pending or not integrated. Please clarify:
2091
-
2092
- 1. Is ALL the originally requested work actually complete and functional?
2093
- 2. If there are parts that are "ready but not integrated" or "implemented but not connected", those are NOT complete.
2094
- 3. Only say TASK_FULLY_COMPLETE when the user's original request is 100% fulfilled.
2095
-
2096
- What remains to be done? Continue with the next step.`;
2097
- await new Promise(resolve => setTimeout(resolve, 500));
2098
- continue;
2099
- }
2100
- display.showSystemMessage(`\n✅ Task explicitly marked complete after ${iteration} iteration(s).`);
2101
- break;
2102
- }
2103
- // High confidence completion without verification needed
2104
- if (completionAnalysis.isComplete && completionAnalysis.confidence >= 0.85) {
2105
- display.showSystemMessage(`\n✅ Task completed with high confidence after ${iteration} iteration(s).`);
2106
- display.showSystemMessage(` Reason: ${completionAnalysis.reason}`);
2107
- break;
2108
- }
2109
- // Medium confidence - run verification round
2110
- if (completionAnalysis.shouldVerify && completionAnalysis.verificationPrompt && !pendingVerification) {
2111
- if (verificationAttempts < MAX_VERIFICATION_ATTEMPTS) {
2112
- display.showSystemMessage(`\n🔍 Running verification round (confidence: ${(completionAnalysis.confidence * 100).toFixed(0)}%)...`);
2113
- pendingVerification = true;
2114
- verificationAttempts++;
2115
- currentPrompt = completionAnalysis.verificationPrompt;
2116
- await new Promise(resolve => setTimeout(resolve, 500));
2117
- continue;
2118
- }
2119
- }
2120
- // If we were in verification mode, check the result
2121
- if (pendingVerification) {
2122
- pendingVerification = false;
2123
- if (completionDetector.isVerificationConfirmed(response)) {
2124
- display.showSystemMessage(`\n✅ Task completion verified by AI after ${iteration} iteration(s).`);
2125
- break;
2126
- }
2127
- else {
2128
- display.showSystemMessage(`🔄 Verification indicates more work needed. Continuing...`);
2129
- }
2130
- }
2131
- // Check for no progress (same response multiple times)
2132
- const responseChanged = response !== lastResponse;
2133
- if (!responseChanged) {
2134
- consecutiveNoProgress++;
2135
- if (consecutiveNoProgress >= MAX_NO_PROGRESS) {
2136
- // Before giving up, ask one final verification
2137
- if (verificationAttempts < MAX_VERIFICATION_ATTEMPTS) {
2138
- display.showSystemMessage(`\n⚠️ No progress for ${MAX_NO_PROGRESS} iterations. Running final verification...`);
2139
- currentPrompt = `I notice you may be stuck or finished. Please confirm:
2140
-
2141
- 1. Is the original task FULLY complete?
2142
- 2. If yes, respond with exactly: "TASK_FULLY_COMPLETE"
2143
- 3. If no, what specific action should be taken next?
2144
-
2145
- Be explicit about the current state.`;
2146
- verificationAttempts++;
2147
- consecutiveNoProgress = 0;
2148
- await new Promise(resolve => setTimeout(resolve, 500));
2149
- continue;
2150
- }
2151
- display.showSystemMessage(`\n⚠️ No progress detected for ${MAX_NO_PROGRESS} iterations and verification exhausted. Stopping.`);
2152
- break;
2153
- }
2154
- }
2155
- else {
2156
- consecutiveNoProgress = 0;
2157
- }
2158
- lastResponse = response;
2159
- // Prepare next iteration prompt - explicitly encourage progress reporting
2160
- currentPrompt = `Continue with the next step. Remember:
2161
- - Use bash to run git commands (git status, git add, git commit, git push)
2162
- - Commit your changes with descriptive messages after completing improvements
2163
- - Push changes when a logical milestone is reached
2164
- - If all tasks are complete, respond with exactly: "TASK_FULLY_COMPLETE"
2165
- - If there are errors or blockers, explain what's preventing progress
2166
-
2167
- What's the next action?`;
2168
- // Small delay between iterations to prevent rate limiting
2169
- await new Promise(resolve => setTimeout(resolve, 500));
2170
- }
2171
- catch (error) {
2172
- display.stopThinking(false);
2173
- // Handle context overflow specially - the agent should auto-recover
2174
- // but if it propagates here, we continue the loop
2175
- if (this.isContextOverflowError(error)) {
2176
- display.showSystemMessage(`⚡ Context overflow handled. Continuing with reduced context...`);
2177
- // The agent.ts should have already handled recovery
2178
- // Continue to next iteration
2179
- continue;
2180
- }
2181
- // For other errors, check if handled by provider error handler
2182
- const handled = this.handleProviderError(error, () => this.processContinuousRequest(initialRequest));
2183
- if (!handled) {
2184
- display.showError(error instanceof Error ? error.message : String(error), error);
2185
- break;
2186
- }
2187
- }
2188
- }
2189
- if (iteration >= MAX_ITERATIONS) {
2190
- display.showWarning(`\n⚠️ Reached maximum iterations (${MAX_ITERATIONS}). Stopping to prevent infinite loop.`);
2191
- }
2192
- }
2193
- finally {
2194
- const totalElapsed = Date.now() - overallStartTime;
2195
- const minutes = Math.floor(totalElapsed / 60000);
2196
- const seconds = Math.floor((totalElapsed % 60000) / 1000);
2197
- display.showSystemMessage(`\n🏁 Continuous execution completed: ${iteration} iterations, ${minutes}m ${seconds}s total`);
2198
- // Reset completion detector for next task
2199
- resetTaskCompletionDetector();
2200
- this.isProcessing = false;
2201
- this.terminalInput.setStreaming(false);
2202
- this.updateStatusMessage(null);
2203
- this.uiAdapter.endProcessing('Ready for prompts');
2204
- this.setIdleStatus();
2205
- display.newLine();
2206
- // Claude Code style: Show unified status bar before prompt
2207
- // This creates consistent UI between startup and post-streaming
2208
- this.showUnifiedStatusBar();
2209
- // CRITICAL: Ensure readline prompt is active for user input
2210
- // Claude Code style: New prompt naturally appears at bottom
2211
- this.ensureReadlineReady();
2212
- this.scheduleQueueProcessing();
2213
- this.refreshQueueIndicators();
2214
- }
2215
- }
2216
- /**
2217
- * Check if a response contains indicators that work is actually incomplete,
2218
- * even if it also contains TASK_FULLY_COMPLETE marker.
2219
- * This catches contradictory responses where the AI says "done" but also "not integrated yet".
2220
- */
2221
- responseIndicatesIncompleteWork(response) {
2222
- // Patterns that indicate work isn't actually complete
2223
- // Organized by category for maintainability
2224
- const incompletePatterns = [
2225
- // === INTEGRATION/DEPLOYMENT STATE ===
2226
- // "hasn't been integrated/implemented/connected yet"
2227
- /hasn'?t\s+been\s+(integrated|implemented|connected|deployed|added|completed|tested|verified)\s*(yet|still)?/i,
2228
- // "not yet integrated/implemented" or "not integrated"
2229
- /not\s+(yet\s+)?(integrated|implemented|connected|deployed|functional|working|complete|tested|verified)/i,
2230
- // "ready for integration" = NOT integrated
2231
- /ready\s+(for|to\s+be)\s+(integration|integrated|connected|deployed|testing|review)/i,
2232
- // "needs to be integrated"
2233
- /needs?\s+to\s+be\s+(integrated|connected|deployed|added|hooked|wired|tested|reviewed|merged)/i,
2234
- // Passive voice: "was not performed/completed"
2235
- /was\s+not\s+(performed|completed|implemented|deployed|integrated|tested)/i,
2236
- // "the [X] service hasn't been"
2237
- /the\s+\w+\s+(service|module|component|feature)\s+hasn'?t\s+been/i,
2238
- // === PARTIAL/INCOMPLETE STATE ===
2239
- // "still stores/uses/has" (current bad state persists)
2240
- /still\s+(stores?|uses?|has|contains?|needs?|requires?|missing|lacks?|broken)/i,
2241
- // Partial completion: "partially", "mostly", "almost"
2242
- /\b(partially|mostly|almost|nearly|not\s+fully)\s+(complete|done|finished|implemented|working)/i,
2243
- // Explicit partial: "part of", "some of", "half of"
2244
- /\b(only\s+)?(part|some|half|portion)\s+of\s+(the\s+)?(task|work|feature|implementation)/i,
2245
- // === QUALIFIER WORDS (uncertain completion) ===
2246
- // "should be complete", "appears complete", "theoretically"
2247
- /\b(should|might|may|could|appears?\s+to)\s+be\s+(complete|done|working|functional)/i,
2248
- /\btheoretically\s+(complete|done|working|functional)/i,
2249
- // "assuming", "if everything works"
2250
- /\b(assuming|provided|if)\s+(everything|it|this|that)\s+(works?|is\s+correct)/i,
2251
- // === SELF-CONTRADICTION PHRASES ===
2252
- // "done but...", "complete except...", "finished however..."
2253
- /\b(done|complete|finished)\s+(but|except|however|although|though)/i,
2254
- // "however" followed by incomplete indicator
2255
- /however[,\s].{0,50}?(hasn'?t|not\s+yet|still\s+needs?|pending|remains?|missing|broken|failing)/i,
2256
- // "but" followed by negative state
2257
- /\bbut\s+.{0,30}?(not|hasn'?t|won'?t|can'?t|doesn'?t|isn'?t|wasn'?t)/i,
2258
- // === FUTURE TENSE / DEFERRED WORK ===
2259
- // "will need to", "will require"
2260
- /will\s+(need\s+to|require|have\s+to)\s+(integrate|connect|deploy|complete|implement|test|fix)/i,
2261
- // Deferred: "left as", "deferred", "postponed", "out of scope"
2262
- /\b(left\s+as|deferred|postponed|out\s+of\s+scope|for\s+later|in\s+a\s+future)/i,
2263
- // Time-dependent: "after restart", "takes effect after", "once you"
2264
- /\b(after\s+(restart|reboot|redeploy)|takes?\s+effect\s+after|once\s+you)/i,
2265
- // === REMAINING WORK INDICATORS ===
2266
- // "remaining tasks", "outstanding items"
2267
- /\b(remaining|outstanding|pending|leftover)\s+(tasks?|items?|work|issues?|steps?)/i,
2268
- // "X more to do", "still have to"
2269
- /\b(more\s+to\s+do|still\s+have\s+to|yet\s+to\s+be\s+done)/i,
2270
- // Explicit blockers
2271
- /\b(blocker|blocked\s+by|waiting\s+(for|on)|depends?\s+on)/i,
2272
- // === ERROR/FAILURE STATE ===
2273
- // "failing tests", "build errors"
2274
- /\b(failing|broken|erroring)\s+(tests?|builds?|checks?|validations?)/i,
2275
- // "tests? (are )?(still )?failing"
2276
- /\btests?\s+(are\s+)?(still\s+)?failing/i,
2277
- // "errors? to (address|fix)"
2278
- /\b(errors?|warnings?|issues?)\s+to\s+(address|fix|resolve)/i,
2279
- // "doesn't work", "isn't working", "not working"
2280
- /\b(doesn'?t|isn'?t|not)\s+(work|working|functional|functioning)/i,
2281
- // === MANUAL STEPS REQUIRED ===
2282
- // "you'll need to", "manually run", "requires user"
2283
- /\b(you('ll|\s+will)\s+need\s+to|manually\s+(run|configure|set|update)|requires?\s+user)/i,
2284
- // "run this command", "execute the following"
2285
- /\b(run\s+this|execute\s+the\s+following|apply\s+the\s+migration)/i,
2286
- // === TODO/FIXME IN PROSE ===
2287
- // TODO or FIXME mentioned as remaining work (not in code blocks)
2288
- /\b(todo|fixme|hack|xxx):\s/i,
2289
- // "need to add", "should implement"
2290
- /\b(need\s+to|should|must)\s+(add|implement|create|write|build|fix)\b/i,
2291
- // === SCOPE LIMITATIONS ===
2292
- // "didn't have time", "ran out of time"
2293
- /\b(didn'?t|did\s+not)\s+have\s+(time|chance|opportunity)/i,
2294
- // "beyond scope", "outside scope"
2295
- /\b(beyond|outside)\s+(the\s+)?scope/i,
2296
- // "for now" (temporary state)
2297
- /\b(for\s+now|at\s+this\s+point|currently)\s*.{0,20}?(not|without|lacks?|missing)/i,
2298
- ];
2299
- for (const pattern of incompletePatterns) {
2300
- if (pattern.test(response)) {
2301
- return true;
2302
- }
2303
- }
2304
- return false;
2305
- }
2306
- /**
2307
- * Extract tool names from a response by looking for tool call patterns
2308
- */
2309
- extractToolsFromResponse(response) {
2310
- const tools = [];
2311
- // Look for common tool call patterns in the response
2312
- const toolPatterns = [
2313
- /(?:running|executing|called?|using)\s+(?:the\s+)?(\w+(?:_\w+)*)\s+tool/gi,
2314
- /tool[:\s]+(\w+(?:_\w+)*)/gi,
2315
- /⎿\s*(\w+)/g, // Tool result prefix pattern
2316
- /(?:read_file|edit_file|Edit|bash|grep|glob|search)/gi,
2317
- ];
2318
- for (const pattern of toolPatterns) {
2319
- let match;
2320
- while ((match = pattern.exec(response)) !== null) {
2321
- const toolName = match[1] || match[0];
2322
- if (toolName && !tools.includes(toolName.toLowerCase())) {
2323
- tools.push(toolName.toLowerCase());
2324
- }
2325
- }
2326
- }
2327
- return tools;
2328
- }
2329
- /**
2330
- * Check if an error is a context overflow error
2331
- */
2332
- isContextOverflowError(error) {
2333
- if (!(error instanceof Error))
2334
- return false;
2335
- const message = error.message.toLowerCase();
2336
- return (message.includes('context length') ||
2337
- (message.includes('token') && (message.includes('limit') || message.includes('exceed') || message.includes('maximum'))) ||
2338
- message.includes('too long') ||
2339
- message.includes('too many tokens') ||
2340
- message.includes('max_tokens') ||
2341
- message.includes('context window'));
2342
- }
2343
- async awaitPendingCleanup() {
2344
- if (!this.pendingCleanup) {
2345
- return;
2346
- }
2347
- let timeoutId = null;
2348
- try {
2349
- // Add timeout to prevent indefinite hangs (10 second max wait)
2350
- const CLEANUP_TIMEOUT_MS = 10000;
2351
- const timeoutPromise = new Promise((_, reject) => {
2352
- timeoutId = setTimeout(() => reject(new Error('Cleanup timed out')), CLEANUP_TIMEOUT_MS);
2353
- });
2354
- await Promise.race([this.pendingCleanup, timeoutPromise]);
2355
- }
2356
- catch (error) {
2357
- const message = error instanceof Error ? error.message : String(error);
2358
- display.showWarning(`Context cleanup failed: ${message}`);
2359
- }
2360
- finally {
2361
- // Clear timeout to prevent leaking timers
2362
- if (timeoutId) {
2363
- clearTimeout(timeoutId);
2364
- }
2365
- this.pendingCleanup = null;
2366
- }
2367
- }
2368
- getLatestFileChangeTimestamp() {
2369
- const changes = this._fileChangeTracker.getAllChanges();
2370
- if (!changes.length) {
2371
- return null;
2372
- }
2373
- let latest = 0;
2374
- for (const change of changes) {
2375
- latest = Math.max(latest, change.timestamp);
2376
- }
2377
- return latest || null;
2378
- }
2379
- isTestToolCall(entry) {
2380
- const name = entry.toolName.toLowerCase();
2381
- if (name === 'run_tests' || name === 'run_repo_checks' || name === 'run_build') {
2382
- return true;
2383
- }
2384
- if (name === 'bash' || name === 'execute_bash') {
2385
- const command = String(entry.args['command'] ?? '').toLowerCase();
2386
- return command.includes('npm test') || command.includes('yarn test') || command.includes('pnpm test');
2387
- }
2388
- return false;
2389
- }
2390
- getLatestTestTimestamp() {
2391
- const history = this.runtimeSession.toolRuntime.getToolHistory?.() ?? [];
2392
- let latest = this.lastAutoTestRun;
2393
- for (const entry of history) {
2394
- if (this.isTestToolCall(entry)) {
2395
- latest = latest ? Math.max(latest, entry.timestamp) : entry.timestamp;
2396
- }
2397
- }
2398
- return latest;
2399
- }
2400
- formatCommandError(error) {
2401
- const parts = [error?.stdout, error?.stderr, error?.message].filter((part) => typeof part === 'string' && part.trim());
2402
- return parts.join('\n').trim();
2403
- }
2404
- async enforceAutoTests(trigger) {
2405
- if (this.autoTestInFlight) {
2406
- return;
2407
- }
2408
- const latestChange = this.getLatestFileChangeTimestamp();
2409
- if (!latestChange) {
2410
- return;
2411
- }
2412
- const latestTest = this.getLatestTestTimestamp();
2413
- if (latestTest && latestChange <= latestTest) {
2414
- return;
2415
- }
2416
- this.autoTestInFlight = true;
2417
- const command = 'npm test -- --runInBand';
2418
- display.showSystemMessage(`🧪 Auto-testing recent changes (${trigger}) with "${command}"...`);
2419
- this.updateStatusMessage('Running tests automatically...');
2420
- try {
2421
- const { stdout, stderr } = await execAsync(command, {
2422
- cwd: this.workingDir,
2423
- timeout: 10 * 60 * 1000,
2424
- maxBuffer: 10 * 1024 * 1024,
2425
- });
2426
- this.lastAutoTestRun = Date.now();
2427
- const outputText = [stdout, stderr].filter(Boolean).join('\n').trim();
2428
- display.showSystemMessage('✅ Auto-tests finished.');
2429
- if (outputText) {
2430
- process.stdout.write(`${outputText}\n`);
2431
- }
2432
- this.statusTracker.clearOverride('tests');
2433
- }
2434
- catch (error) {
2435
- this.lastAutoTestRun = Date.now();
2436
- const message = this.formatCommandError(error);
2437
- display.showWarning('⚠️ Auto-tests failed. Review output below.');
2438
- if (message) {
2439
- process.stdout.write(`${message}\n`);
2440
- }
2441
- this.statusTracker.pushOverride('tests', 'Tests failing', {
2442
- detail: 'Auto-run npm test failed',
2443
- tone: 'danger',
2444
- });
2445
- }
2446
- finally {
2447
- this.updateStatusMessage(null);
2448
- this.autoTestInFlight = false;
2449
- }
2450
- }
2451
- rebuildAgent() {
2452
- const previousHistory = this.agent ? this.agent.getHistory() : this.cachedHistory;
2453
- try {
2454
- ensureSecretForProvider(this.sessionState.provider);
2455
- this.runtimeSession.updateToolContext(this.sessionState);
2456
- const selection = {
2457
- provider: this.sessionState.provider,
2458
- model: this.sessionState.model,
2459
- temperature: this.sessionState.temperature,
2460
- maxTokens: this.sessionState.maxTokens,
2461
- systemPrompt: this.buildSystemPrompt(),
2462
- reasoningEffort: this.sessionState.reasoningEffort,
2463
- autoContinue: this.autoContinueEnabled,
2464
- };
2465
- this.agent = this.runtimeSession.createAgent(selection, {
2466
- onStreamChunk: (chunk) => {
2467
- // Claude Code style: Stream output through display module
2468
- // The output interceptor automatically refreshes the fixed input area
2469
- // after each chunk, keeping cursor at the chat box
2470
- if (display.isSpinnerActive()) {
2471
- display.stopThinking(false);
2472
- display.stream('\n');
2473
- }
2474
- display.stream(chunk);
2475
- },
2476
- onAssistantMessage: (content, metadata) => {
2477
- const enriched = this.buildDisplayMetadata(metadata);
2478
- // Update spinner based on message type
2479
- if (metadata.isFinal) {
2480
- // Skip display if content was already streamed to avoid double-display
2481
- if (!metadata.wasStreamed) {
2482
- const parsed = this.splitThinkingResponse(content);
2483
- if (parsed?.thinking) {
2484
- const summary = this.extractThoughtSummary(parsed.thinking);
2485
- if (summary) {
2486
- display.updateThinking(`💭 ${summary}`);
2487
- }
2488
- display.showAssistantMessage(parsed.thinking, { ...enriched, isFinal: false });
2489
- }
2490
- const finalContent = parsed?.response?.trim() || content;
2491
- if (finalContent) {
2492
- display.showAssistantMessage(finalContent, enriched);
2493
- }
2494
- }
2495
- // Show status line at end (Claude Code style: "• Context X% used • Ready for prompts (2s)")
2496
- display.stopThinking();
2497
- // Calculate context usage
2498
- let contextInfo;
2499
- if (enriched.contextWindowTokens && metadata.usage) {
2500
- const total = this.totalTokens(metadata.usage);
2501
- if (total && total > 0) {
2502
- const percentage = Math.round((total / enriched.contextWindowTokens) * 100);
2503
- contextInfo = { percentage, tokens: total };
2504
- }
2505
- }
2506
- display.showStatusLine('Ready for prompts', enriched.elapsedMs, contextInfo);
2507
- void this.enforceAutoTests('final-response');
2508
- }
2509
- else {
2510
- // Non-final message = narrative text before tool calls (Claude Code style)
2511
- // Stop spinner and show the narrative text directly
2512
- display.stopThinking();
2513
- // Skip display if content was already streamed to avoid double-display
2514
- if (!metadata.wasStreamed) {
2515
- display.showNarrative(content.trim());
2516
- }
2517
- // The isProcessing flag already shows "⏳ Processing..." - no need for duplicate status
2518
- this.terminalInput.render();
2519
- return;
2520
- }
2521
- const cleanup = this.handleContextTelemetry(metadata, enriched);
2522
- if (cleanup) {
2523
- this.pendingCleanup = cleanup;
2524
- }
2525
- },
2526
- onContextSquishing: (message) => {
2527
- // Show notification in UI when auto context squishing occurs
2528
- display.showSystemMessage(`🔄 ${message}`);
2529
- this.statusTracker.pushOverride('context-squish', 'Auto-squishing context', {
2530
- detail: 'Reducing conversation history to fit within token limits',
2531
- tone: 'warning',
2532
- });
2533
- },
2534
- onContextRecovery: (attempt, maxAttempts, message) => {
2535
- // Show recovery progress in UI
2536
- display.showSystemMessage(`⚡ Context Recovery (${attempt}/${maxAttempts}): ${message}`);
2537
- },
2538
- onContextPruned: (removedCount, stats) => {
2539
- // Clear squish overlay if active
2540
- this.statusTracker.clearOverride('context-squish');
2541
- // Show notification that context was pruned
2542
- const method = stats['method'];
2543
- const percentage = stats['percentage'];
2544
- if (method === 'emergency-recovery') {
2545
- display.showSystemMessage(`✅ Context recovery complete. Removed ${removedCount} messages. Context now at ${percentage ?? 'unknown'}%`);
2546
- }
2547
- // Update context usage in UI
2548
- if (typeof percentage === 'number') {
2549
- this.updateContextUsage(percentage);
2550
- }
2551
- // Ensure prompt remains visible at bottom after context messages
2552
- this.terminalInput.render();
2553
- },
2554
- onContinueAfterRecovery: () => {
2555
- // Update UI to show we're continuing after context recovery
2556
- display.showSystemMessage(`🔄 Continuing after context recovery...`);
2557
- this.updateStatusMessage('Retrying with reduced context...');
2558
- this.terminalInput.render();
2559
- },
2560
- onAutoContinue: (attempt, maxAttempts, _message) => {
2561
- // Show auto-continue progress in UI
2562
- display.showSystemMessage(`🔄 Auto-continue (${attempt}/${maxAttempts}): Model expressed intent, prompting to act...`);
2563
- this.updateStatusMessage('Auto-continuing...');
2564
- this.terminalInput.render();
2565
- },
2566
- onCancelled: () => {
2567
- // Update UI to show operation was cancelled
2568
- display.showWarning('Operation cancelled.');
2569
- this.updateStatusMessage(null);
2570
- this.terminalInput.setStreaming(false);
2571
- this.terminalInput.render();
2572
- },
2573
- onVerificationNeeded: () => {
2574
- void this.enforceAutoTests('verification');
2575
- },
2576
- });
2577
- const historyToLoad = (this.pendingHistoryLoad && this.pendingHistoryLoad.length
2578
- ? this.pendingHistoryLoad
2579
- : previousHistory && previousHistory.length
2580
- ? previousHistory
2581
- : null) ?? null;
2582
- if (historyToLoad && historyToLoad.length) {
2583
- this.agent.loadHistory(historyToLoad);
2584
- this.cachedHistory = historyToLoad;
2585
- }
2586
- else {
2587
- this.cachedHistory = [];
2588
- }
2589
- this.pendingHistoryLoad = null;
2590
- this.showSessionResumeNotice();
2591
- return true;
2592
- }
2593
- catch (error) {
2594
- this.agent = null;
2595
- this.handleAgentSetupError(error, () => this.rebuildAgent(), this.sessionState.provider);
2596
- return false;
2597
- }
2598
- }
2599
- /**
2600
- * Reset the unified input box to a fresh state after model/provider swap.
2601
- * Ensures the input area is visible and ready for input, just like on startup.
2602
- */
2603
- resetChatBoxAfterModelSwap() {
2604
- this.updateStatusMessage(null);
2605
- this.terminalInput.setStreaming(false);
2606
- this.terminalInput.render();
2607
- this.ensureReadlineReady();
2608
- }
2609
- buildSystemPrompt() {
2610
- const providerLabel = this.providerLabel(this.sessionState.provider);
2611
- const lines = [
2612
- this.baseSystemPrompt.trim(),
2613
- '',
2614
- 'ACTIVE RUNTIME METADATA:',
2615
- `- CLI profile: ${this.profileLabel} (${this.profile})`,
2616
- `- Provider: ${providerLabel} (${this.sessionState.provider})`,
2617
- `- Model: ${this.sessionState.model}`,
2618
- ];
2619
- if (typeof this.sessionState.temperature === 'number') {
2620
- lines.push(`- Temperature: ${this.sessionState.temperature}`);
2621
- }
2622
- if (typeof this.sessionState.maxTokens === 'number') {
2623
- lines.push(`- Max tokens: ${this.sessionState.maxTokens}`);
2624
- }
2625
- lines.push('', 'Use these values when describing your identity or answering model/provider questions. If anything feels stale, call the `profile_details` tool before responding.');
2626
- const thinkingDirective = this.buildThinkingDirective();
2627
- if (thinkingDirective) {
2628
- lines.push('', thinkingDirective);
2629
- }
2630
- return lines.join('\n').trim();
2631
- }
2632
- buildThinkingDirective() {
2633
- switch (this.thinkingMode) {
2634
- case 'concise':
2635
- return 'Concise thinking mode is enabled: respond directly with the final answer and skip <thinking> blocks unless the user explicitly asks for your reasoning.';
2636
- case 'extended':
2637
- return [
2638
- 'Extended thinking mode is enabled. Format every reply as:',
2639
- '<thinking>',
2640
- 'Detailed multi-step reasoning (reference tool runs/files when relevant, keep secrets redacted, no code blocks unless citing filenames).',
2641
- '</thinking>',
2642
- '<response>',
2643
- 'Final answer with actionable next steps and any code/commands requested.',
2644
- '</response>',
2645
- ].join('\n');
2646
- case 'balanced':
2647
- default:
2648
- return 'Balanced thinking mode: include a short <thinking>...</thinking> block before <response> when the reasoning is non-trivial; skip it for simple answers.';
2649
- }
2650
- }
2651
- buildDisplayMetadata(metadata) {
2652
- return {
2653
- ...metadata,
2654
- contextWindowTokens: this.activeContextWindowTokens,
2655
- };
2656
- }
2657
- handleContextTelemetry(metadata, displayMetadata) {
2658
- if (!metadata.isFinal) {
2659
- return null;
2660
- }
2661
- const windowTokens = displayMetadata.contextWindowTokens;
2662
- if (!windowTokens || windowTokens <= 0) {
2663
- return null;
2664
- }
2665
- const total = this.totalTokens(metadata.usage);
2666
- if (total === null) {
2667
- return null;
2668
- }
2669
- const usageRatio = total / windowTokens;
2670
- // Always update context usage in the UI
2671
- const percentUsed = Math.round(usageRatio * 100);
2672
- this.updateContextUsage(percentUsed);
2673
- if (usageRatio < CONTEXT_USAGE_THRESHOLD) {
2674
- return null;
2675
- }
2676
- if (!this.agent || this.cleanupInProgress) {
2677
- return null;
2678
- }
2679
- return this.runContextCleanup(windowTokens, total);
2680
- }
2681
- totalTokens(usage) {
2682
- if (!usage) {
2683
- return null;
2684
- }
2685
- if (typeof usage.totalTokens === 'number' && Number.isFinite(usage.totalTokens)) {
2686
- return usage.totalTokens;
2687
- }
2688
- const input = typeof usage.inputTokens === 'number' ? usage.inputTokens : 0;
2689
- const output = typeof usage.outputTokens === 'number' ? usage.outputTokens : 0;
2690
- const sum = input + output;
2691
- return sum > 0 ? sum : null;
2692
- }
2693
- async runContextCleanup(windowTokens, totalTokens) {
2694
- if (!this.agent) {
2695
- return;
2696
- }
2697
- this.cleanupInProgress = true;
2698
- const cleanupStatusId = 'context-cleanup';
2699
- let cleanupOverlayActive = false;
2700
- try {
2701
- const history = this.agent.getHistory();
2702
- const { system, conversation } = this.partitionHistory(history);
2703
- if (!conversation.length) {
2704
- return;
2705
- }
2706
- const preserveCount = Math.min(conversation.length, CONTEXT_RECENT_MESSAGE_COUNT);
2707
- const preserved = conversation.slice(conversation.length - preserveCount);
2708
- const toSummarize = conversation.slice(0, conversation.length - preserveCount);
2709
- if (!toSummarize.length) {
2710
- return;
2711
- }
2712
- cleanupOverlayActive = true;
2713
- this.statusTracker.pushOverride(cleanupStatusId, 'Running context cleanup', {
2714
- detail: `Summarizing ${toSummarize.length} earlier messages`,
2715
- tone: 'warning',
2716
- });
2717
- const percentUsed = Math.round((totalTokens / windowTokens) * 100);
2718
- // Update context usage in unified UI
2719
- this.updateContextUsage(percentUsed);
2720
- display.showSystemMessage([
2721
- `Context usage: ${totalTokens.toLocaleString('en-US')} of ${windowTokens.toLocaleString('en-US')} tokens`,
2722
- `(${percentUsed}% full). Running automatic cleanup...`,
2723
- ].join(' '));
2724
- const summary = await this.buildContextSummary(toSummarize);
2725
- if (!summary) {
2726
- throw new Error('Summary could not be generated.');
2727
- }
2728
- const trimmed = this.buildTrimmedHistory(system, summary, preserved);
2729
- this.agent.loadHistory(trimmed);
2730
- display.showSystemMessage(`Context cleanup complete. Summarized ${toSummarize.length} earlier messages and preserved the latest ${preserved.length}.`);
2731
- }
2732
- finally {
2733
- if (cleanupOverlayActive) {
2734
- this.statusTracker.clearOverride(cleanupStatusId);
2735
- }
2736
- this.cleanupInProgress = false;
2737
- }
2738
- }
2739
- partitionHistory(history) {
2740
- const system = [];
2741
- const conversation = [];
2742
- for (const message of history) {
2743
- if (message.role === 'system') {
2744
- if (system.length === 0) {
2745
- system.push(message);
2746
- }
2747
- continue;
2748
- }
2749
- conversation.push(message);
2750
- }
2751
- return { system, conversation };
2752
- }
2753
- async buildContextSummary(messages) {
2754
- const chunks = this.buildSummaryChunks(messages);
2755
- if (!chunks.length) {
2756
- return null;
2757
- }
2758
- const summarizer = this.runtimeSession.createAgent({
2759
- provider: this.sessionState.provider,
2760
- model: this.sessionState.model,
2761
- temperature: 0,
2762
- maxTokens: Math.min(this.sessionState.maxTokens ?? CONTEXT_CLEANUP_MAX_OUTPUT_TOKENS, CONTEXT_CLEANUP_MAX_OUTPUT_TOKENS),
2763
- systemPrompt: CONTEXT_CLEANUP_SYSTEM_PROMPT,
2764
- }, {});
2765
- let runningSummary = '';
2766
- for (const chunk of chunks) {
2767
- const prompt = this.buildSummaryPrompt(chunk, runningSummary);
2768
- runningSummary = (await summarizer.send(prompt)).trim();
2769
- summarizer.clearHistory();
2770
- }
2771
- return runningSummary || null;
2772
- }
2773
- buildSummaryChunks(messages) {
2774
- const serialized = messages.map((message) => this.serializeMessage(message)).filter((text) => text.length > 0);
2775
- if (!serialized.length) {
2776
- return [];
2777
- }
2778
- const chunks = [];
2779
- let buffer = '';
2780
- for (const entry of serialized) {
2781
- const segment = buffer ? `\n\n${entry}` : entry;
2782
- if (buffer && buffer.length + segment.length > CONTEXT_CLEANUP_CHARS_PER_CHUNK) {
2783
- chunks.push(buffer.trim());
2784
- buffer = entry;
2785
- continue;
2786
- }
2787
- buffer += buffer ? `\n\n${entry}` : entry;
2788
- }
2789
- if (buffer.trim()) {
2790
- chunks.push(buffer.trim());
2791
- }
2792
- return chunks;
2793
- }
2794
- serializeMessage(message) {
2795
- const role = this.describeRole(message);
2796
- const parts = [`${role}:`];
2797
- const content = message.content?.trim() ?? '';
2798
- if (content) {
2799
- parts.push(content);
2800
- }
2801
- if (message.role === 'assistant' && message.toolCalls && message.toolCalls.length > 0) {
2802
- parts.push('Tool calls:', ...message.toolCalls.map((call) => {
2803
- const args = JSON.stringify(call.arguments ?? {});
2804
- return `- ${call.name} ${args}`;
2805
- }));
2806
- }
2807
- return parts.join('\n').trim();
2808
- }
2809
- describeRole(message) {
2810
- switch (message.role) {
2811
- case 'assistant':
2812
- return 'Assistant';
2813
- case 'user':
2814
- return 'User';
2815
- case 'tool':
2816
- return `Tool(${message.name ?? message.toolCallId ?? 'result'})`;
2817
- case 'system':
2818
- default:
2819
- return 'System';
2820
- }
2821
- }
2822
- buildSummaryPrompt(chunk, existingSummary) {
2823
- const sections = [];
2824
- if (existingSummary) {
2825
- sections.push(`Existing summary:\n${existingSummary}`);
2826
- }
2827
- sections.push(`Conversation chunk:\n${chunk}`);
2828
- sections.push([
2829
- 'Instructions:',
2830
- '- Merge the chunk into the running summary.',
2831
- '- Preserve critical TODOs, bugs, test gaps, and file references.',
2832
- '- Call out what is resolved vs. still pending.',
2833
- '- Keep the output concise (<= 200 words) using short headings or bullets.',
2834
- ].join('\n'));
2835
- return sections.join('\n\n');
2836
- }
2837
- buildTrimmedHistory(systemMessages, summary, preserved) {
2838
- const history = [];
2839
- if (systemMessages.length > 0) {
2840
- history.push(systemMessages[0]);
2841
- }
2842
- else {
2843
- history.push({ role: 'system', content: this.buildSystemPrompt() });
2844
- }
2845
- history.push({
2846
- role: 'system',
2847
- content: [
2848
- 'Condensed context summary (auto cleanup):',
2849
- summary.trim(),
2850
- `Last updated: ${new Date().toISOString()}`,
2851
- ].join('\n\n'),
2852
- });
2853
- history.push(...preserved);
2854
- return history;
2855
- }
2856
- handleAgentSetupError(error, retryAction, providerOverride) {
2857
- this.pendingInteraction = null;
2858
- const provider = providerOverride ?? this.sessionState.provider;
2859
- const apiKeyIssue = detectApiKeyError(error, provider);
2860
- if (apiKeyIssue) {
2861
- this.handleApiKeyIssue(apiKeyIssue, retryAction);
2862
- return;
2863
- }
2864
- this.pendingSecretRetry = null;
2865
- const message = error instanceof Error ? error.message : String(error);
2866
- display.showError(message);
2867
- }
2868
- handleProviderError(error, retryAction) {
2869
- const apiKeyIssue = detectApiKeyError(error, this.sessionState.provider);
2870
- if (!apiKeyIssue) {
2871
- return false;
2872
- }
2873
- this.handleApiKeyIssue(apiKeyIssue, retryAction);
2874
- return true;
2875
- }
2876
- handleApiKeyIssue(info, retryAction) {
2877
- const secret = info.secret ?? null;
2878
- const providerLabel = info.provider ? this.providerLabel(info.provider) : 'the selected provider';
2879
- if (!secret) {
2880
- this.pendingSecretRetry = null;
2881
- const guidance = 'Run "/secrets" to configure the required API key or export it (e.g., EXPORT KEY=value) before launching the CLI.';
2882
- const baseMessage = info.type === 'missing'
2883
- ? `An API key is required before using ${providerLabel}.`
2884
- : `API authentication failed for ${providerLabel}.`;
2885
- display.showWarning(`${baseMessage} ${guidance}`.trim());
2886
- return;
2887
- }
2888
- const isMissing = info.type === 'missing';
2889
- if (!isMissing && info.message && info.message.trim()) {
2890
- display.showWarning(info.message.trim());
2891
- }
2892
- const prefix = isMissing
2893
- ? `${secret.label} is required before you can use ${providerLabel}.`
2894
- : `${secret.label} appears to be invalid for ${providerLabel}.`;
2895
- display.showWarning(prefix);
2896
- this.pendingSecretRetry = retryAction ?? null;
2897
- this.pendingInteraction = { type: 'secret-input', secret };
2898
- this.showSecretGuidance(secret, isMissing);
2899
- }
2900
- showSecretGuidance(secret, promptForInput) {
2901
- const lines = [];
2902
- if (promptForInput) {
2903
- lines.push(`Enter a new value for ${secret.label} or type "cancel".`);
2904
- }
2905
- else {
2906
- lines.push(`Update the stored value for ${secret.label} or type "cancel".`);
2907
- }
2908
- lines.push(`Tip: run "/secrets" anytime to manage credentials or export ${secret.envVar}=<value> before launching the CLI.`);
2909
- display.showSystemMessage(lines.join('\n'));
2910
- }
2911
- colorizeDropdownLine(text, index) {
2912
- if (!DROPDOWN_COLORS.length) {
2913
- return text;
2914
- }
2915
- const color = DROPDOWN_COLORS[index % DROPDOWN_COLORS.length];
2916
- return color(text);
2917
- }
2918
- findModelPreset(modelId) {
2919
- return MODEL_PRESETS.find((preset) => preset.id === modelId);
2920
- }
2921
- applyPresetReasoningDefaults() {
2922
- if (this.sessionState.reasoningEffort) {
2923
- return;
2924
- }
2925
- const preset = this.findModelPreset(this.sessionState.model);
2926
- if (preset?.reasoningEffort) {
2927
- this.sessionState.reasoningEffort = preset.reasoningEffort;
2928
- }
2929
- }
2930
- refreshBannerSessionInfo() {
2931
- const nextState = {
2932
- model: this.sessionState.model,
2933
- provider: this.sessionState.provider,
2934
- };
2935
- const previous = this.bannerSessionState;
2936
- if (previous && previous.model === nextState.model && previous.provider === nextState.provider) {
2937
- return;
2938
- }
2939
- this.refreshContextGauge();
2940
- display.updateSessionInfo(nextState.model, nextState.provider);
2941
- if (!this.isProcessing) {
2942
- this.setIdleStatus();
2943
- }
2944
- this.bannerSessionState = nextState;
2945
- }
2946
- providerLabel(id) {
2947
- return PROVIDER_LABELS[id] ?? id;
2948
- }
2949
- agentMenuLabel(name) {
2950
- if (!this.agentMenu) {
2951
- return name;
2952
- }
2953
- const entry = this.agentMenu.options.find((option) => option.name === name);
2954
- return entry?.label ?? name;
2955
- }
2956
- extractThoughtSummary(thought) {
2957
- // Extract first non-empty line
2958
- const lines = thought?.split('\n').filter(line => line.trim()) ?? [];
2959
- if (!lines.length) {
2960
- return null;
2961
- }
2962
- // Remove common thought prefixes
2963
- const cleaned = lines[0]
2964
- .trim()
2965
- .replace(/^(Thinking|Analyzing|Considering|Looking at|Let me)[:.\s]+/i, '')
2966
- .replace(/^I (should|need to|will|am)[:.\s]+/i, '')
2967
- .trim();
2968
- if (!cleaned) {
2969
- return null;
2970
- }
2971
- // Truncate to reasonable length
2972
- const maxLength = 50;
2973
- return cleaned.length > maxLength
2974
- ? cleaned.slice(0, maxLength - 3) + '...'
2975
- : cleaned;
2976
- }
2977
- splitThinkingResponse(content) {
2978
- if (!content?.includes('<thinking') && !content?.includes('<response')) {
2979
- return null;
2980
- }
2981
- const thinkingMatch = /<thinking>([\s\S]*?)<\/thinking>/i.exec(content);
2982
- const responseMatch = /<response>([\s\S]*?)<\/response>/i.exec(content);
2983
- if (!thinkingMatch && !responseMatch) {
2984
- return null;
2985
- }
2986
- const thinkingBody = thinkingMatch?.[1]?.trim() ?? null;
2987
- let responseBody = responseMatch?.[1]?.trim();
2988
- if (!responseBody) {
2989
- responseBody = content
2990
- .replace(thinkingMatch?.[0] ?? '', '')
2991
- .replace(/<\/?response>/gi, '')
2992
- .trim();
2993
- }
2994
- return {
2995
- thinking: thinkingBody && thinkingBody.length ? thinkingBody : null,
2996
- response: responseBody ?? '',
2997
- };
2998
- }
2999
- persistSessionPreference() {
3000
- saveModelPreference(this.profile, {
3001
- provider: this.sessionState.provider,
3002
- model: this.sessionState.model,
3003
- temperature: this.sessionState.temperature,
3004
- maxTokens: this.sessionState.maxTokens,
3005
- reasoningEffort: this.sessionState.reasoningEffort,
3006
- });
3007
- }
3008
- /**
3009
- * Handle the /provider command to switch AI providers.
3010
- */
3011
- async handleProviderCommand(input) {
3012
- const tokens = input.trim().split(/\s+/).slice(1);
3013
- const targetProvider = tokens[0]?.toLowerCase();
3014
- if (!targetProvider) {
3015
- this.showConfiguredProviders();
3016
- return;
3017
- }
3018
- // Find matching provider
3019
- const providerOptions = this.buildProviderOptions();
3020
- const match = providerOptions.find((opt) => opt.provider.toLowerCase() === targetProvider || opt.label.toLowerCase() === targetProvider);
3021
- if (!match) {
3022
- display.showWarning(`Unknown provider "${targetProvider}".`);
3023
- const available = providerOptions.map((opt) => opt.provider).join(', ');
3024
- display.showInfo(`Available providers: ${available}`);
3025
- return;
3026
- }
3027
- if (match.provider === this.sessionState.provider) {
3028
- display.showInfo(`Already using ${match.label}.`);
3029
- return;
3030
- }
3031
- // Get default model for the provider
3032
- const models = MODEL_PRESETS.filter((preset) => preset.provider === match.provider);
3033
- if (!models.length) {
3034
- display.showWarning(`No models available for ${match.label}.`);
3035
- return;
3036
- }
3037
- const defaultModel = models[0];
3038
- const oldProvider = this.sessionState.provider;
3039
- const oldModel = this.sessionState.model;
3040
- // Update session state
3041
- this.sessionState = {
3042
- provider: match.provider,
3043
- model: defaultModel.id,
3044
- temperature: defaultModel.temperature,
3045
- maxTokens: defaultModel.maxTokens,
3046
- reasoningEffort: defaultModel.reasoningEffort,
3047
- };
3048
- // Rebuild agent with new provider
3049
- if (this.rebuildAgent()) {
3050
- this.persistSessionPreference();
3051
- this.refreshBannerSessionInfo();
3052
- display.showInfo(`Switched from ${this.providerLabel(oldProvider)}/${oldModel} to ${match.label}/${defaultModel.id}`);
3053
- this.resetChatBoxAfterModelSwap();
3054
- }
3055
- else {
3056
- // Revert on failure
3057
- this.sessionState.provider = oldProvider;
3058
- this.sessionState.model = oldModel;
3059
- display.showError(`Failed to switch to ${match.label}. Reverted to ${this.providerLabel(oldProvider)}.`);
3060
- }
3061
- }
3062
- /**
3063
- * Discover models from provider APIs.
3064
- */
3065
- async discoverModelsCommand() {
3066
- display.showInfo('Discovering models from provider APIs...');
3067
- try {
3068
- const result = await discoverAllModels();
3069
- const lines = [
3070
- theme.bold('Model Discovery Results:'),
3071
- '',
3072
- ];
3073
- for (const providerResult of result.results) {
3074
- if (providerResult.success) {
3075
- const count = providerResult.models.length;
3076
- lines.push(` ${theme.success('✓')} ${providerResult.provider}: ${count} model${count === 1 ? '' : 's'} found`);
3077
- // Show top 3 models
3078
- const topModels = providerResult.models.slice(0, 3).map(m => m.id);
3079
- if (topModels.length > 0) {
3080
- lines.push(` ${theme.secondary(topModels.join(', '))}${providerResult.models.length > 3 ? '...' : ''}`);
3081
- }
3082
- }
3083
- else {
3084
- const errorMsg = providerResult.error || 'Unknown error';
3085
- lines.push(` ${theme.warning('⚠')} ${providerResult.provider}: ${errorMsg}`);
3086
- }
3087
- }
3088
- lines.push('');
3089
- lines.push(`Total: ${result.totalModelsDiscovered} models discovered`);
3090
- if (result.errors.length > 0) {
3091
- lines.push('');
3092
- lines.push(theme.secondary('Some providers had errors. Check API keys with /secrets.'));
3093
- }
3094
- display.showSystemMessage(lines.join('\n'));
3095
- }
3096
- catch (error) {
3097
- const message = error instanceof Error ? error.message : String(error);
3098
- display.showError(`Discovery failed: ${message}`);
3099
- }
3100
- }
3101
- /**
3102
- * Show all configured providers and their status.
3103
- */
3104
- showConfiguredProviders() {
3105
- const providerOptions = this.buildProviderOptions();
3106
- if (!providerOptions.length) {
3107
- display.showWarning('No providers are configured.');
3108
- display.showInfo('Set an API key: OPENAI_API_KEY, ANTHROPIC_API_KEY, GEMINI_API_KEY, etc.');
3109
- return;
3110
- }
3111
- const lines = [
3112
- theme.bold('Configured Providers:'),
3113
- '',
3114
- ...providerOptions.map((option) => {
3115
- const isCurrent = option.provider === this.sessionState.provider;
3116
- const marker = isCurrent ? theme.primary(' ← active') : '';
3117
- const countLabel = `${option.modelCount} model${option.modelCount === 1 ? '' : 's'}`;
3118
- return ` ${theme.success('✓')} ${option.label} (${option.provider}) — ${countLabel}${marker}`;
3119
- }),
3120
- '',
3121
- 'Switch with: /provider <name>',
3122
- 'Example: /provider xai',
3123
- ];
3124
- display.showSystemMessage(lines.join('\n'));
3125
- }
3126
- /**
3127
- * Handle the /local command for local/air-gapped LLM management.
3128
- */
3129
- async handleLocalCommand(input) {
3130
- const tokens = input.trim().split(/\s+/).slice(1);
3131
- const subcommand = (tokens[0] ?? '').toLowerCase();
3132
- switch (subcommand) {
3133
- case '':
3134
- case 'scan':
3135
- case 'status':
3136
- await this.scanLocalProviders();
3137
- break;
3138
- case 'use':
3139
- const provider = tokens[1]?.toLowerCase();
3140
- if (!provider) {
3141
- display.showWarning('Usage: /local use <provider>');
3142
- display.showInfo('Example: /local use ollama');
3143
- return;
3144
- }
3145
- await this.handleProviderCommand(`/provider ${provider}`);
3146
- break;
3147
- default:
3148
- this.showLocalHelp();
3149
- break;
3150
- }
3151
- }
3152
- /**
3153
- * Scan for running local LLM servers.
3154
- */
3155
- async scanLocalProviders() {
3156
- const localProviders = [
3157
- { id: 'ollama', label: 'Ollama', url: 'http://localhost:11434', envVar: 'OLLAMA_BASE_URL' },
3158
- { id: 'lmstudio', label: 'LM Studio', url: 'http://localhost:1234', envVar: 'LMSTUDIO_BASE_URL' },
3159
- { id: 'vllm', label: 'vLLM', url: 'http://localhost:8000', envVar: 'VLLM_BASE_URL' },
3160
- { id: 'llamacpp', label: 'llama.cpp', url: 'http://localhost:8080', envVar: 'LLAMACPP_BASE_URL' },
3161
- ];
3162
- display.showInfo('Scanning for local LLM servers...');
3163
- const results = [];
3164
- for (const provider of localProviders) {
3165
- const baseUrl = process.env[provider.envVar] || provider.url;
3166
- try {
3167
- const controller = new AbortController();
3168
- const timeout = setTimeout(() => controller.abort(), 2000);
3169
- const response = await fetch(`${baseUrl}/api/tags`, {
3170
- signal: controller.signal,
3171
- }).catch(() => fetch(`${baseUrl}/v1/models`, { signal: controller.signal }));
3172
- clearTimeout(timeout);
3173
- if (response.ok) {
3174
- const data = await response.json();
3175
- const models = data.models?.map((m) => m.name) ?? [];
3176
- results.push({ provider, running: true, models });
3177
- }
3178
- else {
3179
- results.push({ provider, running: false });
3180
- }
3181
- }
3182
- catch {
3183
- results.push({ provider, running: false });
3184
- }
3185
- }
3186
- const running = results.filter((r) => r.running);
3187
- const stopped = results.filter((r) => !r.running);
3188
- const lines = [theme.bold('Local LLM Servers:'), ''];
3189
- if (running.length) {
3190
- lines.push(theme.success('Running:'));
3191
- for (const r of running) {
3192
- const modelCount = r.models?.length ?? 0;
3193
- const modelInfo = modelCount ? ` (${modelCount} model${modelCount === 1 ? '' : 's'})` : '';
3194
- lines.push(` ${theme.success('●')} ${r.provider.label}${modelInfo}`);
3195
- if (r.models?.length) {
3196
- for (const model of r.models.slice(0, 5)) {
3197
- lines.push(` • ${model}`);
3198
- }
3199
- if (r.models.length > 5) {
3200
- lines.push(` • ... and ${r.models.length - 5} more`);
3201
- }
3202
- }
3203
- }
3204
- lines.push('');
3205
- }
3206
- if (stopped.length) {
3207
- lines.push(theme.secondary('Not detected:'));
3208
- for (const r of stopped) {
3209
- lines.push(` ${theme.ui.muted('○')} ${r.provider.label}`);
3210
- }
3211
- lines.push('');
3212
- }
3213
- if (running.length) {
3214
- lines.push(`Switch with: /local use ${running[0].provider.id}`);
3215
- }
3216
- else {
3217
- lines.push('No local servers running.');
3218
- lines.push('Install Ollama: https://ollama.ai');
3219
- }
3220
- display.showSystemMessage(lines.join('\n'));
3221
- }
3222
- /**
3223
- * Show help for /local commands.
3224
- */
3225
- showLocalHelp() {
3226
- const lines = [
3227
- theme.bold('/local Commands:'),
3228
- '',
3229
- ' /local Scan for running local LLM servers',
3230
- ' /local status Same as /local (scan for servers)',
3231
- ' /local use <name> Switch to a local provider',
3232
- '',
3233
- 'Supported Local Providers:',
3234
- ' ollama - Easy-to-use local LLM runner (recommended)',
3235
- ' lmstudio - GUI-based local model serving',
3236
- ' vllm - High-throughput production serving',
3237
- ' llamacpp - Lightweight llama.cpp server',
3238
- '',
3239
- 'Example:',
3240
- ' /local # Scan for running servers',
3241
- ' /local use ollama # Switch to Ollama',
3242
- ];
3243
- display.showSystemMessage(lines.join('\n'));
3244
- }
3245
- /**
3246
- * Set the cached provider status for unified status bar display.
3247
- * Called once at startup after checking providers.
3248
- */
3249
- setProviderStatus(providers) {
3250
- this.cachedProviderStatus = providers;
3251
- }
3252
- /**
3253
- * Show the unified status bar (Claude Code style).
3254
- * Displays provider indicators and ready hints before the prompt.
3255
- */
3256
- showUnifiedStatusBar() {
3257
- display.showUnifiedStatusBar(this.cachedProviderStatus);
3258
- }
3259
- }
3260
- function setsEqual(first, second) {
3261
- if (first.size !== second.size) {
3262
- return false;
3263
- }
3264
- for (const entry of first) {
3265
- if (!second.has(entry)) {
3266
- return false;
3267
- }
3268
- }
3269
- return true;
3270
- }
3271
- //# sourceMappingURL=interactiveShell.js.map