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