centaurus-cli 3.0.0 → 3.1.0

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 (552) hide show
  1. package/dist/ai/types.js +0 -1
  2. package/dist/ai/types.js.map +1 -1
  3. package/dist/cli-adapter.js +5047 -5037
  4. package/dist/cli-adapter.js.map +1 -1
  5. package/dist/commands/CommandParser.js +372 -315
  6. package/dist/commands/CommandParser.js.map +1 -1
  7. package/dist/config/build-config.js +11 -42
  8. package/dist/config/build-config.js.map +1 -1
  9. package/dist/config/defaultConfig.js +94 -82
  10. package/dist/config/defaultConfig.js.map +1 -1
  11. package/dist/config/manager.js +144 -160
  12. package/dist/config/manager.js.map +1 -1
  13. package/dist/config/mcp-config-manager.js +411 -364
  14. package/dist/config/mcp-config-manager.js.map +1 -1
  15. package/dist/config/models.js +118 -185
  16. package/dist/config/models.js.map +1 -1
  17. package/dist/config/slash-commands.js +186 -184
  18. package/dist/config/slash-commands.js.map +1 -1
  19. package/dist/config/types.js +33 -26
  20. package/dist/config/types.js.map +1 -1
  21. package/dist/context/command-detector.js +63 -67
  22. package/dist/context/command-detector.js.map +1 -1
  23. package/dist/context/context-manager.js +533 -518
  24. package/dist/context/context-manager.js.map +1 -1
  25. package/dist/context/handlers/docker-handler.js +518 -576
  26. package/dist/context/handlers/docker-handler.js.map +1 -1
  27. package/dist/context/handlers/ssh-handler.js +1050 -1109
  28. package/dist/context/handlers/ssh-handler.js.map +1 -1
  29. package/dist/context/handlers/wsl-handler.js +558 -630
  30. package/dist/context/handlers/wsl-handler.js.map +1 -1
  31. package/dist/context/index.js +42 -6
  32. package/dist/context/index.js.map +1 -1
  33. package/dist/context/subshell-handler.js +0 -4
  34. package/dist/context/subshell-handler.js.map +1 -1
  35. package/dist/context/types.js +20 -31
  36. package/dist/context/types.js.map +1 -1
  37. package/dist/hooks/useConnectivity.js +13 -10
  38. package/dist/hooks/useConnectivity.js.map +1 -1
  39. package/dist/hooks/useTerminalDimensions.js +67 -79
  40. package/dist/hooks/useTerminalDimensions.js.map +1 -1
  41. package/dist/index.js +228 -251
  42. package/dist/index.js.map +1 -1
  43. package/dist/mcp/mcp-command-handler.js +297 -260
  44. package/dist/mcp/mcp-command-handler.js.map +1 -1
  45. package/dist/mcp/mcp-server-manager.js +139 -155
  46. package/dist/mcp/mcp-server-manager.js.map +1 -1
  47. package/dist/mcp/mcp-tool-wrapper.js +74 -94
  48. package/dist/mcp/mcp-tool-wrapper.js.map +1 -1
  49. package/dist/services/ai-autocomplete-agent.js +169 -181
  50. package/dist/services/ai-autocomplete-agent.js.map +1 -1
  51. package/dist/services/ai-context-injector.js +180 -93
  52. package/dist/services/ai-context-injector.js.map +1 -1
  53. package/dist/services/ai-service-client.js +513 -456
  54. package/dist/services/ai-service-client.js.map +1 -1
  55. package/dist/services/api-client.js +443 -441
  56. package/dist/services/api-client.js.map +1 -1
  57. package/dist/services/auth-handler.js +162 -198
  58. package/dist/services/auth-handler.js.map +1 -1
  59. package/dist/services/background-task-manager.js +258 -282
  60. package/dist/services/background-task-manager.js.map +1 -1
  61. package/dist/services/checkpoint-manager.js +1513 -973
  62. package/dist/services/checkpoint-manager.js.map +1 -1
  63. package/dist/services/clipboard-service.js +151 -200
  64. package/dist/services/clipboard-service.js.map +1 -1
  65. package/dist/services/connectivity-manager.js +63 -65
  66. package/dist/services/connectivity-manager.js.map +1 -1
  67. package/dist/services/conversation-manager.js +118 -121
  68. package/dist/services/conversation-manager.js.map +1 -1
  69. package/dist/services/environment-context-injector.js +160 -187
  70. package/dist/services/environment-context-injector.js.map +1 -1
  71. package/dist/services/fast-context-agent.js +203 -243
  72. package/dist/services/fast-context-agent.js.map +1 -1
  73. package/dist/services/input-detection-agent.js +190 -202
  74. package/dist/services/input-detection-agent.js.map +1 -1
  75. package/dist/services/input-requirement-detector.js +155 -189
  76. package/dist/services/input-requirement-detector.js.map +1 -1
  77. package/dist/services/local-chat-storage.js +342 -365
  78. package/dist/services/local-chat-storage.js.map +1 -1
  79. package/dist/services/monitored-shell-manager.js +225 -233
  80. package/dist/services/monitored-shell-manager.js.map +1 -1
  81. package/dist/services/ollama-service.js +293 -310
  82. package/dist/services/ollama-service.js.map +1 -1
  83. package/dist/services/rules-storage.js +142 -0
  84. package/dist/services/rules-storage.js.map +1 -0
  85. package/dist/services/session-quota-manager.js +219 -235
  86. package/dist/services/session-quota-manager.js.map +1 -1
  87. package/dist/services/shell-input-agent.js +299 -334
  88. package/dist/services/shell-input-agent.js.map +1 -1
  89. package/dist/services/sub-agent-manager.js +459 -501
  90. package/dist/services/sub-agent-manager.js.map +1 -1
  91. package/dist/services/warpify-detector.js +133 -183
  92. package/dist/services/warpify-detector.js.map +1 -1
  93. package/dist/services/workflow-storage.js +202 -217
  94. package/dist/services/workflow-storage.js.map +1 -1
  95. package/dist/test-ssh-handler.js +148 -193
  96. package/dist/test-ssh-handler.js.map +1 -1
  97. package/dist/tools/add-mcp.js +161 -0
  98. package/dist/tools/add-mcp.js.map +1 -0
  99. package/dist/tools/background-command.js +240 -273
  100. package/dist/tools/background-command.js.map +1 -1
  101. package/dist/tools/command.js +447 -440
  102. package/dist/tools/command.js.map +1 -1
  103. package/dist/tools/create-image.js +172 -202
  104. package/dist/tools/create-image.js.map +1 -1
  105. package/dist/tools/enter-remote-session.js +169 -215
  106. package/dist/tools/enter-remote-session.js.map +1 -1
  107. package/dist/tools/fast-context.js +60 -67
  108. package/dist/tools/fast-context.js.map +1 -1
  109. package/dist/tools/file-ops.js +605 -537
  110. package/dist/tools/file-ops.js.map +1 -1
  111. package/dist/tools/find-files.js +262 -303
  112. package/dist/tools/find-files.js.map +1 -1
  113. package/dist/tools/get-diff.js +423 -400
  114. package/dist/tools/get-diff.js.map +1 -1
  115. package/dist/tools/grep-search.js +966 -948
  116. package/dist/tools/grep-search.js.map +1 -1
  117. package/dist/tools/inspect-symbol.js +308 -323
  118. package/dist/tools/inspect-symbol.js.map +1 -1
  119. package/dist/tools/plan-mode.js +459 -503
  120. package/dist/tools/plan-mode.js.map +1 -1
  121. package/dist/tools/read-binary-file.js +160 -190
  122. package/dist/tools/read-binary-file.js.map +1 -1
  123. package/dist/tools/registry.js +100 -84
  124. package/dist/tools/registry.js.map +1 -1
  125. package/dist/tools/reproduce_issue.js +170 -151
  126. package/dist/tools/reproduce_issue.js.map +1 -1
  127. package/dist/tools/sub-agent.js +223 -228
  128. package/dist/tools/sub-agent.js.map +1 -1
  129. package/dist/tools/task-complete.js +28 -27
  130. package/dist/tools/task-complete.js.map +1 -1
  131. package/dist/tools/types.js +0 -1
  132. package/dist/tools/types.js.map +1 -1
  133. package/dist/tools/validation.js +96 -118
  134. package/dist/tools/validation.js.map +1 -1
  135. package/dist/tools/web-search.js +194 -194
  136. package/dist/tools/web-search.js.map +1 -1
  137. package/dist/tools/workflow-tool.js +77 -82
  138. package/dist/tools/workflow-tool.js.map +1 -1
  139. package/dist/types/index.js +0 -1
  140. package/dist/types/index.js.map +1 -1
  141. package/dist/types/rule.js +1 -0
  142. package/dist/types/rule.js.map +1 -0
  143. package/dist/types/workflow.js +0 -7
  144. package/dist/types/workflow.js.map +1 -1
  145. package/dist/ui/components/AgentTimer.js +24 -25
  146. package/dist/ui/components/AgentTimer.js.map +1 -1
  147. package/dist/ui/components/App.js +3266 -3249
  148. package/dist/ui/components/App.js.map +1 -1
  149. package/dist/ui/components/AuthScreen.js +22 -34
  150. package/dist/ui/components/AuthScreen.js.map +1 -1
  151. package/dist/ui/components/AuthWelcomeScreen.js +30 -24
  152. package/dist/ui/components/AuthWelcomeScreen.js.map +1 -1
  153. package/dist/ui/components/Breadcrumbs.js +53 -82
  154. package/dist/ui/components/Breadcrumbs.js.map +1 -1
  155. package/dist/ui/components/CircularSelectInput.js +59 -67
  156. package/dist/ui/components/CircularSelectInput.js.map +1 -1
  157. package/dist/ui/components/ClipboardFileAutocomplete.js +78 -39
  158. package/dist/ui/components/ClipboardFileAutocomplete.js.map +1 -1
  159. package/dist/ui/components/CodeBlock.js +24 -42
  160. package/dist/ui/components/CodeBlock.js.map +1 -1
  161. package/dist/ui/components/ConfigViewer.js +18 -25
  162. package/dist/ui/components/ConfigViewer.js.map +1 -1
  163. package/dist/ui/components/ConfirmPrompt.js +49 -71
  164. package/dist/ui/components/ConfirmPrompt.js.map +1 -1
  165. package/dist/ui/components/ConnectionStatusMessage.js +32 -83
  166. package/dist/ui/components/ConnectionStatusMessage.js.map +1 -1
  167. package/dist/ui/components/ContextWindowIndicator.js +34 -49
  168. package/dist/ui/components/ContextWindowIndicator.js.map +1 -1
  169. package/dist/ui/components/DetailedPlanReviewScreen.js +104 -106
  170. package/dist/ui/components/DetailedPlanReviewScreen.js.map +1 -1
  171. package/dist/ui/components/DiffViewer.js +68 -121
  172. package/dist/ui/components/DiffViewer.js.map +1 -1
  173. package/dist/ui/components/ErrorBoundary.js +40 -48
  174. package/dist/ui/components/ErrorBoundary.js.map +1 -1
  175. package/dist/ui/components/FileCreationPreview.js +29 -60
  176. package/dist/ui/components/FileCreationPreview.js.map +1 -1
  177. package/dist/ui/components/FileOperation.js +34 -29
  178. package/dist/ui/components/FileOperation.js.map +1 -1
  179. package/dist/ui/components/FileTagAutocomplete.js +55 -25
  180. package/dist/ui/components/FileTagAutocomplete.js.map +1 -1
  181. package/dist/ui/components/FontRecommendation.js.map +1 -1
  182. package/dist/ui/components/GitDiffBreadcrumb.js +29 -0
  183. package/dist/ui/components/GitDiffBreadcrumb.js.map +1 -0
  184. package/dist/ui/components/InputBox.js +1620 -2150
  185. package/dist/ui/components/InputBox.js.map +1 -1
  186. package/dist/ui/components/InteractiveShell.js +234 -352
  187. package/dist/ui/components/InteractiveShell.js.map +1 -1
  188. package/dist/ui/components/KeyboardHelp.js +34 -35
  189. package/dist/ui/components/KeyboardHelp.js.map +1 -1
  190. package/dist/ui/components/LoadingIndicator.js +22 -25
  191. package/dist/ui/components/LoadingIndicator.js.map +1 -1
  192. package/dist/ui/components/MCPAddScreen.js +40 -51
  193. package/dist/ui/components/MCPAddScreen.js.map +1 -1
  194. package/dist/ui/components/MCPListScreen.js +40 -48
  195. package/dist/ui/components/MCPListScreen.js.map +1 -1
  196. package/dist/ui/components/MCPServerListScreen.js +49 -56
  197. package/dist/ui/components/MCPServerListScreen.js.map +1 -1
  198. package/dist/ui/components/MarkdownRenderer.js +69 -96
  199. package/dist/ui/components/MarkdownRenderer.js.map +1 -1
  200. package/dist/ui/components/MessageBox.js +66 -48
  201. package/dist/ui/components/MessageBox.js.map +1 -1
  202. package/dist/ui/components/MessageDisplay.js +150 -142
  203. package/dist/ui/components/MessageDisplay.js.map +1 -1
  204. package/dist/ui/components/MonitorModeAIPanel.js +46 -65
  205. package/dist/ui/components/MonitorModeAIPanel.js.map +1 -1
  206. package/dist/ui/components/MultiLineInput.js +243 -277
  207. package/dist/ui/components/MultiLineInput.js.map +1 -1
  208. package/dist/ui/components/PasswordPrompt.js +37 -18
  209. package/dist/ui/components/PasswordPrompt.js.map +1 -1
  210. package/dist/ui/components/PlanAcceptedMessage.js +27 -38
  211. package/dist/ui/components/PlanAcceptedMessage.js.map +1 -1
  212. package/dist/ui/components/PlanReviewScreen.js +46 -50
  213. package/dist/ui/components/PlanReviewScreen.js.map +1 -1
  214. package/dist/ui/components/RulesEditorScreen.js +81 -0
  215. package/dist/ui/components/RulesEditorScreen.js.map +1 -0
  216. package/dist/ui/components/SelectPrompt.js +19 -8
  217. package/dist/ui/components/SelectPrompt.js.map +1 -1
  218. package/dist/ui/components/ShimmerText.js +44 -0
  219. package/dist/ui/components/ShimmerText.js.map +1 -0
  220. package/dist/ui/components/SlashCommandAutocomplete.js +49 -22
  221. package/dist/ui/components/SlashCommandAutocomplete.js.map +1 -1
  222. package/dist/ui/components/StatusBar.js +56 -87
  223. package/dist/ui/components/StatusBar.js.map +1 -1
  224. package/dist/ui/components/StreamingMessageDisplay.js +116 -99
  225. package/dist/ui/components/StreamingMessageDisplay.js.map +1 -1
  226. package/dist/ui/components/TaskCompletedMessage.js +28 -23
  227. package/dist/ui/components/TaskCompletedMessage.js.map +1 -1
  228. package/dist/ui/components/TaskProgressIndicator.js +44 -70
  229. package/dist/ui/components/TaskProgressIndicator.js.map +1 -1
  230. package/dist/ui/components/ThinkingDisplay.js +44 -41
  231. package/dist/ui/components/ThinkingDisplay.js.map +1 -1
  232. package/dist/ui/components/ToolExecutionMessage.js +772 -1326
  233. package/dist/ui/components/ToolExecutionMessage.js.map +1 -1
  234. package/dist/ui/components/ToolExecutionStatus.js +53 -84
  235. package/dist/ui/components/ToolExecutionStatus.js.map +1 -1
  236. package/dist/ui/components/ToolResult.js +22 -15
  237. package/dist/ui/components/ToolResult.js.map +1 -1
  238. package/dist/ui/components/VersionUpdatePrompt.js +88 -120
  239. package/dist/ui/components/VersionUpdatePrompt.js.map +1 -1
  240. package/dist/ui/components/WelcomeBanner.js +176 -26
  241. package/dist/ui/components/WelcomeBanner.js.map +1 -1
  242. package/dist/ui/components/WorkflowCreatorScreen.js +94 -161
  243. package/dist/ui/components/WorkflowCreatorScreen.js.map +1 -1
  244. package/dist/utils/ansi-encoder.js +30 -61
  245. package/dist/utils/ansi-encoder.js.map +1 -1
  246. package/dist/utils/chat-formatter.js +327 -305
  247. package/dist/utils/chat-formatter.js.map +1 -1
  248. package/dist/utils/command-history.js +152 -174
  249. package/dist/utils/command-history.js.map +1 -1
  250. package/dist/utils/context-sanitizer.js +49 -112
  251. package/dist/utils/context-sanitizer.js.map +1 -1
  252. package/dist/utils/conversation-logger.js +292 -324
  253. package/dist/utils/conversation-logger.js.map +1 -1
  254. package/dist/utils/custom-commands-manager.js +126 -131
  255. package/dist/utils/custom-commands-manager.js.map +1 -1
  256. package/dist/utils/editor-utils.js +732 -837
  257. package/dist/utils/editor-utils.js.map +1 -1
  258. package/dist/utils/file.js +174 -213
  259. package/dist/utils/file.js.map +1 -1
  260. package/dist/utils/git-stats.js +169 -0
  261. package/dist/utils/git-stats.js.map +1 -0
  262. package/dist/utils/input-classifier.js +960 -482
  263. package/dist/utils/input-classifier.js.map +1 -1
  264. package/dist/utils/logger.js +48 -73
  265. package/dist/utils/logger.js.map +1 -1
  266. package/dist/utils/markdown-parser.js +277 -310
  267. package/dist/utils/markdown-parser.js.map +1 -1
  268. package/dist/utils/rule-reference-resolver.js +54 -0
  269. package/dist/utils/rule-reference-resolver.js.map +1 -0
  270. package/dist/utils/shell.js +144 -156
  271. package/dist/utils/shell.js.map +1 -1
  272. package/dist/utils/state.js +23 -22
  273. package/dist/utils/state.js.map +1 -1
  274. package/dist/utils/syntax-checker.js +279 -327
  275. package/dist/utils/syntax-checker.js.map +1 -1
  276. package/dist/utils/terminal-output.js +199 -302
  277. package/dist/utils/terminal-output.js.map +1 -1
  278. package/dist/utils/text-clipboard.js +47 -70
  279. package/dist/utils/text-clipboard.js.map +1 -1
  280. package/dist/utils/unicode-sanitizer.js +134 -197
  281. package/dist/utils/unicode-sanitizer.js.map +1 -1
  282. package/dist/utils/version-checker.js +46 -56
  283. package/dist/utils/version-checker.js.map +1 -1
  284. package/package.json +6 -4
  285. package/dist/ai/types.d.ts +0 -20
  286. package/dist/ai/types.d.ts.map +0 -1
  287. package/dist/cli-adapter.d.ts +0 -511
  288. package/dist/cli-adapter.d.ts.map +0 -1
  289. package/dist/commands/CommandParser.d.ts +0 -27
  290. package/dist/commands/CommandParser.d.ts.map +0 -1
  291. package/dist/config/build-config.d.ts +0 -42
  292. package/dist/config/build-config.d.ts.map +0 -1
  293. package/dist/config/defaultConfig.d.ts +0 -79
  294. package/dist/config/defaultConfig.d.ts.map +0 -1
  295. package/dist/config/manager.d.ts +0 -62
  296. package/dist/config/manager.d.ts.map +0 -1
  297. package/dist/config/mcp-config-manager.d.ts +0 -79
  298. package/dist/config/mcp-config-manager.d.ts.map +0 -1
  299. package/dist/config/models.d.ts +0 -83
  300. package/dist/config/models.d.ts.map +0 -1
  301. package/dist/config/slash-commands.d.ts +0 -23
  302. package/dist/config/slash-commands.d.ts.map +0 -1
  303. package/dist/config/types.d.ts +0 -35
  304. package/dist/config/types.d.ts.map +0 -1
  305. package/dist/context/command-detector.d.ts +0 -50
  306. package/dist/context/command-detector.d.ts.map +0 -1
  307. package/dist/context/context-manager.d.ts +0 -157
  308. package/dist/context/context-manager.d.ts.map +0 -1
  309. package/dist/context/handlers/docker-handler.d.ts +0 -130
  310. package/dist/context/handlers/docker-handler.d.ts.map +0 -1
  311. package/dist/context/handlers/ssh-handler.d.ts +0 -201
  312. package/dist/context/handlers/ssh-handler.d.ts.map +0 -1
  313. package/dist/context/handlers/wsl-handler.d.ts +0 -146
  314. package/dist/context/handlers/wsl-handler.d.ts.map +0 -1
  315. package/dist/context/index.d.ts +0 -8
  316. package/dist/context/index.d.ts.map +0 -1
  317. package/dist/context/subshell-handler.d.ts +0 -165
  318. package/dist/context/subshell-handler.d.ts.map +0 -1
  319. package/dist/context/types.d.ts +0 -70
  320. package/dist/context/types.d.ts.map +0 -1
  321. package/dist/hooks/useConnectivity.d.ts +0 -2
  322. package/dist/hooks/useConnectivity.d.ts.map +0 -1
  323. package/dist/hooks/useTerminalDimensions.d.ts +0 -41
  324. package/dist/hooks/useTerminalDimensions.d.ts.map +0 -1
  325. package/dist/index.d.ts +0 -9
  326. package/dist/index.d.ts.map +0 -1
  327. package/dist/mcp/mcp-command-handler.d.ts +0 -47
  328. package/dist/mcp/mcp-command-handler.d.ts.map +0 -1
  329. package/dist/mcp/mcp-server-manager.d.ts +0 -30
  330. package/dist/mcp/mcp-server-manager.d.ts.map +0 -1
  331. package/dist/mcp/mcp-tool-wrapper.d.ts +0 -12
  332. package/dist/mcp/mcp-tool-wrapper.d.ts.map +0 -1
  333. package/dist/services/ai-autocomplete-agent.d.ts +0 -39
  334. package/dist/services/ai-autocomplete-agent.d.ts.map +0 -1
  335. package/dist/services/ai-context-injector.d.ts +0 -41
  336. package/dist/services/ai-context-injector.d.ts.map +0 -1
  337. package/dist/services/ai-service-client.d.ts +0 -128
  338. package/dist/services/ai-service-client.d.ts.map +0 -1
  339. package/dist/services/api-client.d.ts +0 -353
  340. package/dist/services/api-client.d.ts.map +0 -1
  341. package/dist/services/auth-handler.d.ts +0 -30
  342. package/dist/services/auth-handler.d.ts.map +0 -1
  343. package/dist/services/background-task-manager.d.ts +0 -114
  344. package/dist/services/background-task-manager.d.ts.map +0 -1
  345. package/dist/services/checkpoint-manager.d.ts +0 -167
  346. package/dist/services/checkpoint-manager.d.ts.map +0 -1
  347. package/dist/services/clipboard-service.d.ts +0 -37
  348. package/dist/services/clipboard-service.d.ts.map +0 -1
  349. package/dist/services/connectivity-manager.d.ts +0 -18
  350. package/dist/services/connectivity-manager.d.ts.map +0 -1
  351. package/dist/services/conversation-manager.d.ts +0 -73
  352. package/dist/services/conversation-manager.d.ts.map +0 -1
  353. package/dist/services/environment-context-injector.d.ts +0 -69
  354. package/dist/services/environment-context-injector.d.ts.map +0 -1
  355. package/dist/services/fast-context-agent.d.ts +0 -12
  356. package/dist/services/fast-context-agent.d.ts.map +0 -1
  357. package/dist/services/input-detection-agent.d.ts +0 -40
  358. package/dist/services/input-detection-agent.d.ts.map +0 -1
  359. package/dist/services/input-requirement-detector.d.ts +0 -28
  360. package/dist/services/input-requirement-detector.d.ts.map +0 -1
  361. package/dist/services/local-chat-storage.d.ts +0 -182
  362. package/dist/services/local-chat-storage.d.ts.map +0 -1
  363. package/dist/services/monitored-shell-manager.d.ts +0 -120
  364. package/dist/services/monitored-shell-manager.d.ts.map +0 -1
  365. package/dist/services/ollama-service.d.ts +0 -197
  366. package/dist/services/ollama-service.d.ts.map +0 -1
  367. package/dist/services/session-quota-manager.d.ts +0 -101
  368. package/dist/services/session-quota-manager.d.ts.map +0 -1
  369. package/dist/services/shell-input-agent.d.ts +0 -89
  370. package/dist/services/shell-input-agent.d.ts.map +0 -1
  371. package/dist/services/sub-agent-manager.d.ts +0 -140
  372. package/dist/services/sub-agent-manager.d.ts.map +0 -1
  373. package/dist/services/warpify-detector.d.ts +0 -43
  374. package/dist/services/warpify-detector.d.ts.map +0 -1
  375. package/dist/services/workflow-storage.d.ts +0 -72
  376. package/dist/services/workflow-storage.d.ts.map +0 -1
  377. package/dist/test-ssh-handler.d.ts +0 -8
  378. package/dist/test-ssh-handler.d.ts.map +0 -1
  379. package/dist/tools/background-command.d.ts +0 -11
  380. package/dist/tools/background-command.d.ts.map +0 -1
  381. package/dist/tools/command.d.ts +0 -3
  382. package/dist/tools/command.d.ts.map +0 -1
  383. package/dist/tools/create-image.d.ts +0 -10
  384. package/dist/tools/create-image.d.ts.map +0 -1
  385. package/dist/tools/enter-remote-session.d.ts +0 -48
  386. package/dist/tools/enter-remote-session.d.ts.map +0 -1
  387. package/dist/tools/fast-context.d.ts +0 -3
  388. package/dist/tools/fast-context.d.ts.map +0 -1
  389. package/dist/tools/file-ops.d.ts +0 -7
  390. package/dist/tools/file-ops.d.ts.map +0 -1
  391. package/dist/tools/find-files.d.ts +0 -49
  392. package/dist/tools/find-files.d.ts.map +0 -1
  393. package/dist/tools/get-diff.d.ts +0 -14
  394. package/dist/tools/get-diff.d.ts.map +0 -1
  395. package/dist/tools/grep-search.d.ts +0 -155
  396. package/dist/tools/grep-search.d.ts.map +0 -1
  397. package/dist/tools/inspect-symbol.d.ts +0 -32
  398. package/dist/tools/inspect-symbol.d.ts.map +0 -1
  399. package/dist/tools/plan-mode.d.ts +0 -140
  400. package/dist/tools/plan-mode.d.ts.map +0 -1
  401. package/dist/tools/read-binary-file.d.ts +0 -10
  402. package/dist/tools/read-binary-file.d.ts.map +0 -1
  403. package/dist/tools/registry.d.ts +0 -31
  404. package/dist/tools/registry.d.ts.map +0 -1
  405. package/dist/tools/reproduce_issue.d.ts +0 -2
  406. package/dist/tools/reproduce_issue.d.ts.map +0 -1
  407. package/dist/tools/sub-agent.d.ts +0 -9
  408. package/dist/tools/sub-agent.d.ts.map +0 -1
  409. package/dist/tools/task-complete.d.ts +0 -3
  410. package/dist/tools/task-complete.d.ts.map +0 -1
  411. package/dist/tools/types.d.ts +0 -40
  412. package/dist/tools/types.d.ts.map +0 -1
  413. package/dist/tools/validation.d.ts +0 -47
  414. package/dist/tools/validation.d.ts.map +0 -1
  415. package/dist/tools/web-search.d.ts +0 -24
  416. package/dist/tools/web-search.d.ts.map +0 -1
  417. package/dist/tools/workflow-tool.d.ts +0 -11
  418. package/dist/tools/workflow-tool.d.ts.map +0 -1
  419. package/dist/types/index.d.ts +0 -123
  420. package/dist/types/index.d.ts.map +0 -1
  421. package/dist/types/workflow.d.ts +0 -110
  422. package/dist/types/workflow.d.ts.map +0 -1
  423. package/dist/ui/components/AgentTimer.d.ts +0 -7
  424. package/dist/ui/components/AgentTimer.d.ts.map +0 -1
  425. package/dist/ui/components/App.d.ts +0 -197
  426. package/dist/ui/components/App.d.ts.map +0 -1
  427. package/dist/ui/components/AuthScreen.d.ts +0 -8
  428. package/dist/ui/components/AuthScreen.d.ts.map +0 -1
  429. package/dist/ui/components/AuthWelcomeScreen.d.ts +0 -8
  430. package/dist/ui/components/AuthWelcomeScreen.d.ts.map +0 -1
  431. package/dist/ui/components/Breadcrumbs.d.ts +0 -13
  432. package/dist/ui/components/Breadcrumbs.d.ts.map +0 -1
  433. package/dist/ui/components/CircularSelectInput.d.ts +0 -24
  434. package/dist/ui/components/CircularSelectInput.d.ts.map +0 -1
  435. package/dist/ui/components/ClipboardFileAutocomplete.d.ts +0 -10
  436. package/dist/ui/components/ClipboardFileAutocomplete.d.ts.map +0 -1
  437. package/dist/ui/components/CodeBlock.d.ts +0 -9
  438. package/dist/ui/components/CodeBlock.d.ts.map +0 -1
  439. package/dist/ui/components/ConfigViewer.d.ts +0 -11
  440. package/dist/ui/components/ConfigViewer.d.ts.map +0 -1
  441. package/dist/ui/components/ConfirmPrompt.d.ts +0 -13
  442. package/dist/ui/components/ConfirmPrompt.d.ts.map +0 -1
  443. package/dist/ui/components/ConnectionStatusMessage.d.ts +0 -17
  444. package/dist/ui/components/ConnectionStatusMessage.d.ts.map +0 -1
  445. package/dist/ui/components/ContextWindowIndicator.d.ts +0 -8
  446. package/dist/ui/components/ContextWindowIndicator.d.ts.map +0 -1
  447. package/dist/ui/components/DetailedPlanReviewScreen.d.ts +0 -17
  448. package/dist/ui/components/DetailedPlanReviewScreen.d.ts.map +0 -1
  449. package/dist/ui/components/DiffViewer.d.ts +0 -9
  450. package/dist/ui/components/DiffViewer.d.ts.map +0 -1
  451. package/dist/ui/components/ErrorBoundary.d.ts +0 -17
  452. package/dist/ui/components/ErrorBoundary.d.ts.map +0 -1
  453. package/dist/ui/components/FileCreationPreview.d.ts +0 -8
  454. package/dist/ui/components/FileCreationPreview.d.ts.map +0 -1
  455. package/dist/ui/components/FileOperation.d.ts +0 -10
  456. package/dist/ui/components/FileOperation.d.ts.map +0 -1
  457. package/dist/ui/components/FileTagAutocomplete.d.ts +0 -11
  458. package/dist/ui/components/FileTagAutocomplete.d.ts.map +0 -1
  459. package/dist/ui/components/FontRecommendation.d.ts +0 -1
  460. package/dist/ui/components/FontRecommendation.d.ts.map +0 -1
  461. package/dist/ui/components/InputBox.d.ts +0 -42
  462. package/dist/ui/components/InputBox.d.ts.map +0 -1
  463. package/dist/ui/components/InteractiveShell.d.ts +0 -30
  464. package/dist/ui/components/InteractiveShell.d.ts.map +0 -1
  465. package/dist/ui/components/KeyboardHelp.d.ts +0 -7
  466. package/dist/ui/components/KeyboardHelp.d.ts.map +0 -1
  467. package/dist/ui/components/LoadingIndicator.d.ts +0 -3
  468. package/dist/ui/components/LoadingIndicator.d.ts.map +0 -1
  469. package/dist/ui/components/MCPAddScreen.d.ts +0 -13
  470. package/dist/ui/components/MCPAddScreen.d.ts.map +0 -1
  471. package/dist/ui/components/MCPListScreen.d.ts +0 -17
  472. package/dist/ui/components/MCPListScreen.d.ts.map +0 -1
  473. package/dist/ui/components/MCPServerListScreen.d.ts +0 -16
  474. package/dist/ui/components/MCPServerListScreen.d.ts.map +0 -1
  475. package/dist/ui/components/MarkdownRenderer.d.ts +0 -8
  476. package/dist/ui/components/MarkdownRenderer.d.ts.map +0 -1
  477. package/dist/ui/components/MessageBox.d.ts +0 -10
  478. package/dist/ui/components/MessageBox.d.ts.map +0 -1
  479. package/dist/ui/components/MessageDisplay.d.ts +0 -14
  480. package/dist/ui/components/MessageDisplay.d.ts.map +0 -1
  481. package/dist/ui/components/MonitorModeAIPanel.d.ts +0 -23
  482. package/dist/ui/components/MonitorModeAIPanel.d.ts.map +0 -1
  483. package/dist/ui/components/MultiLineInput.d.ts +0 -13
  484. package/dist/ui/components/MultiLineInput.d.ts.map +0 -1
  485. package/dist/ui/components/PasswordPrompt.d.ts +0 -9
  486. package/dist/ui/components/PasswordPrompt.d.ts.map +0 -1
  487. package/dist/ui/components/PlanAcceptedMessage.d.ts +0 -20
  488. package/dist/ui/components/PlanAcceptedMessage.d.ts.map +0 -1
  489. package/dist/ui/components/PlanReviewScreen.d.ts +0 -14
  490. package/dist/ui/components/PlanReviewScreen.d.ts.map +0 -1
  491. package/dist/ui/components/SelectPrompt.d.ts +0 -12
  492. package/dist/ui/components/SelectPrompt.d.ts.map +0 -1
  493. package/dist/ui/components/SlashCommandAutocomplete.d.ts +0 -13
  494. package/dist/ui/components/SlashCommandAutocomplete.d.ts.map +0 -1
  495. package/dist/ui/components/StatusBar.d.ts +0 -14
  496. package/dist/ui/components/StatusBar.d.ts.map +0 -1
  497. package/dist/ui/components/StreamingMessageDisplay.d.ts +0 -15
  498. package/dist/ui/components/StreamingMessageDisplay.d.ts.map +0 -1
  499. package/dist/ui/components/TaskCompletedMessage.d.ts +0 -14
  500. package/dist/ui/components/TaskCompletedMessage.d.ts.map +0 -1
  501. package/dist/ui/components/TaskProgressIndicator.d.ts +0 -18
  502. package/dist/ui/components/TaskProgressIndicator.d.ts.map +0 -1
  503. package/dist/ui/components/ThinkingDisplay.d.ts +0 -15
  504. package/dist/ui/components/ThinkingDisplay.d.ts.map +0 -1
  505. package/dist/ui/components/ToolExecutionMessage.d.ts +0 -8
  506. package/dist/ui/components/ToolExecutionMessage.d.ts.map +0 -1
  507. package/dist/ui/components/ToolExecutionStatus.d.ts +0 -10
  508. package/dist/ui/components/ToolExecutionStatus.d.ts.map +0 -1
  509. package/dist/ui/components/ToolResult.d.ts +0 -10
  510. package/dist/ui/components/ToolResult.d.ts.map +0 -1
  511. package/dist/ui/components/VersionUpdatePrompt.d.ts +0 -9
  512. package/dist/ui/components/VersionUpdatePrompt.d.ts.map +0 -1
  513. package/dist/ui/components/WelcomeBanner.d.ts +0 -3
  514. package/dist/ui/components/WelcomeBanner.d.ts.map +0 -1
  515. package/dist/ui/components/WorkflowCreatorScreen.d.ts +0 -25
  516. package/dist/ui/components/WorkflowCreatorScreen.d.ts.map +0 -1
  517. package/dist/utils/ansi-encoder.d.ts +0 -7
  518. package/dist/utils/ansi-encoder.d.ts.map +0 -1
  519. package/dist/utils/chat-formatter.d.ts +0 -12
  520. package/dist/utils/chat-formatter.d.ts.map +0 -1
  521. package/dist/utils/command-history.d.ts +0 -24
  522. package/dist/utils/command-history.d.ts.map +0 -1
  523. package/dist/utils/context-sanitizer.d.ts +0 -50
  524. package/dist/utils/context-sanitizer.d.ts.map +0 -1
  525. package/dist/utils/conversation-logger.d.ts +0 -142
  526. package/dist/utils/conversation-logger.d.ts.map +0 -1
  527. package/dist/utils/custom-commands-manager.d.ts +0 -59
  528. package/dist/utils/custom-commands-manager.d.ts.map +0 -1
  529. package/dist/utils/editor-utils.d.ts +0 -101
  530. package/dist/utils/editor-utils.d.ts.map +0 -1
  531. package/dist/utils/file.d.ts +0 -61
  532. package/dist/utils/file.d.ts.map +0 -1
  533. package/dist/utils/input-classifier.d.ts +0 -25
  534. package/dist/utils/input-classifier.d.ts.map +0 -1
  535. package/dist/utils/logger.d.ts +0 -17
  536. package/dist/utils/logger.d.ts.map +0 -1
  537. package/dist/utils/markdown-parser.d.ts +0 -60
  538. package/dist/utils/markdown-parser.d.ts.map +0 -1
  539. package/dist/utils/shell.d.ts +0 -47
  540. package/dist/utils/shell.d.ts.map +0 -1
  541. package/dist/utils/state.d.ts +0 -13
  542. package/dist/utils/state.d.ts.map +0 -1
  543. package/dist/utils/syntax-checker.d.ts +0 -24
  544. package/dist/utils/syntax-checker.d.ts.map +0 -1
  545. package/dist/utils/terminal-output.d.ts +0 -25
  546. package/dist/utils/terminal-output.d.ts.map +0 -1
  547. package/dist/utils/text-clipboard.d.ts +0 -12
  548. package/dist/utils/text-clipboard.d.ts.map +0 -1
  549. package/dist/utils/unicode-sanitizer.d.ts +0 -44
  550. package/dist/utils/unicode-sanitizer.d.ts.map +0 -1
  551. package/dist/utils/version-checker.d.ts +0 -14
  552. package/dist/utils/version-checker.d.ts.map +0 -1
@@ -1,392 +1,369 @@
1
- /**
2
- * Local Chat Storage Service
3
- *
4
- * Provides persistent local storage for CLI conversations.
5
- * Stores chats in ~/.centaurus/chats/ directory as JSON files.
6
- */
7
- import * as fs from 'fs';
8
- import * as path from 'path';
9
- import * as os from 'os';
10
- import { logError } from '../utils/logger.js';
11
- /**
12
- * LocalChatStorage class for managing local conversation persistence
13
- */
14
- export class LocalChatStorage {
15
- chatsDir;
16
- indexPath;
17
- chatIndex = new Map();
18
- indexLoaded = false;
19
- constructor() {
20
- const homeDir = os.homedir();
21
- this.chatsDir = path.join(homeDir, '.centaurus', 'chats');
22
- this.indexPath = path.join(this.chatsDir, 'index.json');
23
- // Ensure chats directory exists
24
- if (!fs.existsSync(this.chatsDir)) {
25
- fs.mkdirSync(this.chatsDir, { recursive: true });
26
- }
27
- // Load or build the index
28
- this.loadIndex();
29
- }
30
- /**
31
- * Load the metadata index from disk, or rebuild it from chat files if missing
32
- */
33
- loadIndex() {
34
- if (this.indexLoaded)
35
- return;
36
- try {
37
- if (fs.existsSync(this.indexPath)) {
38
- const data = fs.readFileSync(this.indexPath, 'utf-8');
39
- const indexArray = JSON.parse(data);
40
- this.chatIndex.clear();
41
- for (const meta of indexArray) {
42
- this.chatIndex.set(meta.id, meta);
43
- }
44
- this.indexLoaded = true;
45
- return;
46
- }
47
- }
48
- catch (error) {
49
- // Index file corrupted, rebuild it
50
- }
51
- // Rebuild index from chat files (one-time migration)
52
- this.rebuildIndex();
1
+ import * as fs from "fs";
2
+ import * as path from "path";
3
+ import * as os from "os";
4
+ import { logError } from "../utils/logger.js";
5
+ class LocalChatStorage {
6
+ chatsDir;
7
+ indexPath;
8
+ chatIndex = /* @__PURE__ */ new Map();
9
+ indexLoaded = false;
10
+ constructor() {
11
+ const homeDir = os.homedir();
12
+ this.chatsDir = path.join(homeDir, ".centaurus", "chats");
13
+ this.indexPath = path.join(this.chatsDir, "index.json");
14
+ if (!fs.existsSync(this.chatsDir)) {
15
+ fs.mkdirSync(this.chatsDir, { recursive: true });
53
16
  }
54
- /**
55
- * Rebuild the index by reading metadata from all chat files
56
- * This is a one-time migration that reads full files, but only happens once
57
- */
58
- rebuildIndex() {
17
+ this.loadIndex();
18
+ }
19
+ /**
20
+ * Load the metadata index from disk, or rebuild it from chat files if missing
21
+ */
22
+ loadIndex() {
23
+ if (this.indexLoaded) return;
24
+ try {
25
+ if (fs.existsSync(this.indexPath)) {
26
+ const data = fs.readFileSync(this.indexPath, "utf-8");
27
+ const indexArray = JSON.parse(data);
59
28
  this.chatIndex.clear();
60
- if (!fs.existsSync(this.chatsDir)) {
61
- this.indexLoaded = true;
62
- return;
63
- }
64
- const files = fs.readdirSync(this.chatsDir)
65
- .filter(f => f.endsWith('.json') && f !== 'index.json');
66
- for (const file of files) {
67
- try {
68
- const filePath = path.join(this.chatsDir, file);
69
- const data = fs.readFileSync(filePath, 'utf-8');
70
- const chat = JSON.parse(data);
71
- // Determine environment string from remoteContext
72
- let environment = 'local';
73
- if (chat.remoteContext) {
74
- const rc = chat.remoteContext;
75
- if (rc.type === 'ssh' && rc.metadata?.hostname) {
76
- environment = `ssh:${rc.metadata.username || 'user'}@${rc.metadata.hostname}`;
77
- }
78
- else if (rc.type === 'wsl') {
79
- environment = `wsl:${rc.metadata?.distroName || 'Ubuntu'}`;
80
- }
81
- else if (rc.type === 'docker' && rc.metadata?.containerId) {
82
- environment = `docker:${rc.metadata.containerId.substring(0, 12)}`;
83
- }
84
- else {
85
- environment = rc.type;
86
- }
87
- }
88
- // Store metadata only
89
- this.chatIndex.set(chat.id, {
90
- id: chat.id,
91
- title: chat.title,
92
- createdAt: chat.createdAt,
93
- updatedAt: chat.updatedAt,
94
- messageCount: chat.messageCount,
95
- environment,
96
- });
97
- }
98
- catch (error) {
99
- // Skip invalid files
100
- continue;
101
- }
29
+ for (const meta of indexArray) {
30
+ this.chatIndex.set(meta.id, meta);
102
31
  }
103
32
  this.indexLoaded = true;
104
- this.saveIndex();
33
+ return;
34
+ }
35
+ } catch (error) {
105
36
  }
106
- /**
107
- * Save the metadata index to disk
108
- */
109
- saveIndex() {
110
- try {
111
- const indexArray = Array.from(this.chatIndex.values());
112
- fs.writeFileSync(this.indexPath, JSON.stringify(indexArray, null, 2), 'utf-8');
113
- }
114
- catch (error) {
115
- logError('Failed to save chat index', error);
116
- }
37
+ this.rebuildIndex();
38
+ }
39
+ /**
40
+ * Rebuild the index by reading metadata from all chat files
41
+ * This is a one-time migration that reads full files, but only happens once
42
+ */
43
+ rebuildIndex() {
44
+ this.chatIndex.clear();
45
+ if (!fs.existsSync(this.chatsDir)) {
46
+ this.indexLoaded = true;
47
+ return;
117
48
  }
118
- /**
119
- * Update the index entry for a chat
120
- */
121
- updateIndexEntry(chat) {
122
- let environment = 'local';
49
+ const files = fs.readdirSync(this.chatsDir).filter((f) => f.endsWith(".json") && f !== "index.json");
50
+ for (const file of files) {
51
+ try {
52
+ const filePath = path.join(this.chatsDir, file);
53
+ const data = fs.readFileSync(filePath, "utf-8");
54
+ const chat = JSON.parse(data);
55
+ let environment = "local";
123
56
  if (chat.remoteContext) {
124
- const rc = chat.remoteContext;
125
- if (rc.type === 'ssh' && rc.metadata?.hostname) {
126
- environment = `ssh:${rc.metadata.username || 'user'}@${rc.metadata.hostname}`;
127
- }
128
- else if (rc.type === 'wsl') {
129
- environment = `wsl:${rc.metadata?.distroName || 'Ubuntu'}`;
130
- }
131
- else if (rc.type === 'docker' && rc.metadata?.containerId) {
132
- environment = `docker:${rc.metadata.containerId.substring(0, 12)}`;
133
- }
134
- else {
135
- environment = rc.type;
136
- }
57
+ const rc = chat.remoteContext;
58
+ if (rc.type === "ssh" && rc.metadata?.hostname) {
59
+ environment = `ssh:${rc.metadata.username || "user"}@${rc.metadata.hostname}`;
60
+ } else if (rc.type === "wsl") {
61
+ environment = `wsl:${rc.metadata?.distroName || "Ubuntu"}`;
62
+ } else if (rc.type === "docker" && rc.metadata?.containerId) {
63
+ environment = `docker:${rc.metadata.containerId.substring(0, 12)}`;
64
+ } else {
65
+ environment = rc.type;
66
+ }
137
67
  }
138
68
  this.chatIndex.set(chat.id, {
139
- id: chat.id,
140
- title: chat.title,
141
- createdAt: chat.createdAt,
142
- updatedAt: chat.updatedAt,
143
- messageCount: chat.messageCount,
144
- environment,
69
+ id: chat.id,
70
+ title: chat.title,
71
+ createdAt: chat.createdAt,
72
+ updatedAt: chat.updatedAt,
73
+ messageCount: chat.messageCount,
74
+ environment
145
75
  });
146
- this.saveIndex();
76
+ } catch (error) {
77
+ continue;
78
+ }
147
79
  }
148
- /**
149
- * Generate a unique chat ID based on timestamp
150
- */
151
- generateChatId() {
152
- const now = new Date();
153
- const timestamp = now.toISOString().replace(/[:.]/g, '-').slice(0, 19);
154
- const random = Math.random().toString(36).substring(2, 6);
155
- return `chat-${timestamp}-${random}`;
80
+ this.indexLoaded = true;
81
+ this.saveIndex();
82
+ }
83
+ /**
84
+ * Save the metadata index to disk
85
+ */
86
+ saveIndex() {
87
+ try {
88
+ const indexArray = Array.from(this.chatIndex.values());
89
+ fs.writeFileSync(this.indexPath, JSON.stringify(indexArray, null, 2), "utf-8");
90
+ } catch (error) {
91
+ logError("Failed to save chat index", error);
156
92
  }
157
- /**
158
- * Generate a title from the first user message
159
- */
160
- generateTitle(messages) {
161
- const firstUserMessage = messages.find(m => m.role === 'user');
162
- if (!firstUserMessage || !firstUserMessage.content) {
163
- return 'New Chat';
164
- }
165
- // Take first 60 chars, trim to last word boundary
166
- let title = firstUserMessage.content.substring(0, 60);
167
- if (firstUserMessage.content.length > 60) {
168
- const lastSpace = title.lastIndexOf(' ');
169
- if (lastSpace > 30) {
170
- title = title.substring(0, lastSpace);
171
- }
172
- title += '...';
173
- }
174
- // Clean up whitespace and newlines
175
- title = title.replace(/\s+/g, ' ').trim();
176
- return title || 'New Chat';
93
+ }
94
+ /**
95
+ * Update the index entry for a chat
96
+ */
97
+ updateIndexEntry(chat) {
98
+ let environment = "local";
99
+ if (chat.remoteContext) {
100
+ const rc = chat.remoteContext;
101
+ if (rc.type === "ssh" && rc.metadata?.hostname) {
102
+ environment = `ssh:${rc.metadata.username || "user"}@${rc.metadata.hostname}`;
103
+ } else if (rc.type === "wsl") {
104
+ environment = `wsl:${rc.metadata?.distroName || "Ubuntu"}`;
105
+ } else if (rc.type === "docker" && rc.metadata?.containerId) {
106
+ environment = `docker:${rc.metadata.containerId.substring(0, 12)}`;
107
+ } else {
108
+ environment = rc.type;
109
+ }
177
110
  }
178
- /**
179
- * Get the file path for a chat
180
- */
181
- getChatPath(chatId) {
182
- return path.join(this.chatsDir, `${chatId}.json`);
111
+ this.chatIndex.set(chat.id, {
112
+ id: chat.id,
113
+ title: chat.title,
114
+ createdAt: chat.createdAt,
115
+ updatedAt: chat.updatedAt,
116
+ messageCount: chat.messageCount,
117
+ environment
118
+ });
119
+ this.saveIndex();
120
+ }
121
+ /**
122
+ * Generate a unique chat ID based on timestamp
123
+ */
124
+ generateChatId() {
125
+ const now = /* @__PURE__ */ new Date();
126
+ const timestamp = now.toISOString().replace(/[:.]/g, "-").slice(0, 19);
127
+ const random = Math.random().toString(36).substring(2, 6);
128
+ return `chat-${timestamp}-${random}`;
129
+ }
130
+ /**
131
+ * Generate a title from the first user message
132
+ */
133
+ generateTitle(messages) {
134
+ const firstUserMessage = messages.find((m) => m.role === "user");
135
+ if (!firstUserMessage || !firstUserMessage.content) {
136
+ return "New Chat";
183
137
  }
184
- /**
185
- * Save a chat to disk
186
- * @param remoteContext - undefined = preserve existing, null = clear, StoredRemoteContext = set new value
187
- * @param remoteContextStack - Stack of nested contexts for SSH>SSH, SSH>Docker etc.
188
- */
189
- saveChat(chatId, messages, uiMessages, cwd, remoteContext, remoteContextStack) {
190
- const chatPath = this.getChatPath(chatId);
191
- const now = new Date().toISOString();
192
- let chat;
193
- if (fs.existsSync(chatPath)) {
194
- // Update existing chat
195
- const existing = this.loadChat(chatId);
196
- if (existing) {
197
- chat = {
198
- ...existing,
199
- messages,
200
- uiMessages: uiMessages || existing.uiMessages,
201
- cwd: cwd || existing.cwd, // Preserve CWD if not provided
202
- // remoteContext: null = clear it, undefined = preserve existing
203
- remoteContext: remoteContext === null ? undefined : (remoteContext !== undefined ? remoteContext : existing.remoteContext),
204
- // remoteContextStack: null = clear it, undefined = preserve existing
205
- remoteContextStack: remoteContextStack === null ? undefined : (remoteContextStack !== undefined ? remoteContextStack : existing.remoteContextStack),
206
- // Preserve backendConversationId if it exists
207
- backendConversationId: existing.backendConversationId,
208
- messageCount: messages.length,
209
- updatedAt: now,
210
- };
211
- }
212
- else {
213
- // File exists but couldn't be parsed, create new
214
- chat = {
215
- id: chatId,
216
- title: this.generateTitle(messages),
217
- createdAt: now,
218
- updatedAt: now,
219
- messageCount: messages.length,
220
- messages,
221
- uiMessages,
222
- cwd,
223
- remoteContext: remoteContext ?? undefined,
224
- remoteContextStack: remoteContextStack ?? undefined,
225
- };
226
- }
227
- }
228
- else {
229
- // Create new chat
230
- chat = {
231
- id: chatId,
232
- title: this.generateTitle(messages),
233
- createdAt: now,
234
- updatedAt: now,
235
- messageCount: messages.length,
236
- messages,
237
- uiMessages,
238
- cwd,
239
- remoteContext: remoteContext ?? undefined,
240
- remoteContextStack: remoteContextStack ?? undefined,
241
- };
242
- }
243
- fs.writeFileSync(chatPath, JSON.stringify(chat, null, 2), 'utf-8');
244
- // Update the metadata index
245
- this.updateIndexEntry(chat);
246
- return chat;
138
+ let title = firstUserMessage.content.substring(0, 60);
139
+ if (firstUserMessage.content.length > 60) {
140
+ const lastSpace = title.lastIndexOf(" ");
141
+ if (lastSpace > 30) {
142
+ title = title.substring(0, lastSpace);
143
+ }
144
+ title += "...";
247
145
  }
248
- /**
249
- * Set the backend conversation ID for a chat
250
- * This is used to associate local chats with backend file storage
251
- */
252
- setBackendConversationId(chatId, backendConversationId) {
253
- const chat = this.loadChat(chatId);
254
- if (!chat) {
255
- return false;
256
- }
257
- try {
258
- chat.backendConversationId = backendConversationId;
259
- chat.updatedAt = new Date().toISOString();
260
- const chatPath = this.getChatPath(chatId);
261
- fs.writeFileSync(chatPath, JSON.stringify(chat, null, 2), 'utf-8');
262
- return true;
263
- }
264
- catch (error) {
265
- logError(`Failed to set backend conversation ID for chat ${chatId}`, error);
266
- return false;
267
- }
146
+ title = title.replace(/\s+/g, " ").trim();
147
+ return title || "New Chat";
148
+ }
149
+ /**
150
+ * Get the file path for a chat
151
+ */
152
+ getChatPath(chatId) {
153
+ return path.join(this.chatsDir, `${chatId}.json`);
154
+ }
155
+ /**
156
+ * Save a chat to disk
157
+ * @param remoteContext - undefined = preserve existing, null = clear, StoredRemoteContext = set new value
158
+ * @param remoteContextStack - Stack of nested contexts for SSH>SSH, SSH>Docker etc.
159
+ * @param checkpointIndex - undefined = preserve existing, null = clear, array = set latest checkpoint metadata
160
+ */
161
+ saveChat(chatId, messages, uiMessages, cwd, remoteContext, remoteContextStack, checkpointIndex) {
162
+ const chatPath = this.getChatPath(chatId);
163
+ const now = (/* @__PURE__ */ new Date()).toISOString();
164
+ let chat;
165
+ if (fs.existsSync(chatPath)) {
166
+ const existing = this.loadChat(chatId);
167
+ if (existing) {
168
+ chat = {
169
+ ...existing,
170
+ messages,
171
+ uiMessages: uiMessages || existing.uiMessages,
172
+ cwd: cwd || existing.cwd,
173
+ // Preserve CWD if not provided
174
+ // remoteContext: null = clear it, undefined = preserve existing
175
+ remoteContext: remoteContext === null ? void 0 : remoteContext !== void 0 ? remoteContext : existing.remoteContext,
176
+ // remoteContextStack: null = clear it, undefined = preserve existing
177
+ remoteContextStack: remoteContextStack === null ? void 0 : remoteContextStack !== void 0 ? remoteContextStack : existing.remoteContextStack,
178
+ // checkpointIndex: null = clear it, undefined = preserve existing
179
+ checkpointIndex: checkpointIndex === null ? void 0 : checkpointIndex !== void 0 ? checkpointIndex : existing.checkpointIndex,
180
+ // Preserve backendConversationId if it exists
181
+ backendConversationId: existing.backendConversationId,
182
+ messageCount: messages.length,
183
+ updatedAt: now
184
+ };
185
+ } else {
186
+ chat = {
187
+ id: chatId,
188
+ title: this.generateTitle(messages),
189
+ createdAt: now,
190
+ updatedAt: now,
191
+ messageCount: messages.length,
192
+ messages,
193
+ uiMessages,
194
+ cwd,
195
+ remoteContext: remoteContext ?? void 0,
196
+ remoteContextStack: remoteContextStack ?? void 0,
197
+ checkpointIndex: checkpointIndex ?? void 0
198
+ };
199
+ }
200
+ } else {
201
+ chat = {
202
+ id: chatId,
203
+ title: this.generateTitle(messages),
204
+ createdAt: now,
205
+ updatedAt: now,
206
+ messageCount: messages.length,
207
+ messages,
208
+ uiMessages,
209
+ cwd,
210
+ remoteContext: remoteContext ?? void 0,
211
+ remoteContextStack: remoteContextStack ?? void 0,
212
+ checkpointIndex: checkpointIndex ?? void 0
213
+ };
268
214
  }
269
- /**
270
- * Get the backend conversation ID for a chat (if any)
271
- */
272
- getBackendConversationId(chatId) {
273
- const chat = this.loadChat(chatId);
274
- return chat?.backendConversationId;
215
+ fs.writeFileSync(chatPath, JSON.stringify(chat, null, 2), "utf-8");
216
+ this.updateIndexEntry(chat);
217
+ return chat;
218
+ }
219
+ /**
220
+ * Set the backend conversation ID for a chat
221
+ * This is used to associate local chats with backend file storage
222
+ */
223
+ setBackendConversationId(chatId, backendConversationId) {
224
+ const chat = this.loadChat(chatId);
225
+ if (!chat) {
226
+ return false;
275
227
  }
276
- /**
277
- * Load a chat by ID
278
- */
279
- loadChat(chatId) {
280
- const chatPath = this.getChatPath(chatId);
281
- if (!fs.existsSync(chatPath)) {
282
- return null;
283
- }
284
- try {
285
- const data = fs.readFileSync(chatPath, 'utf-8');
286
- return JSON.parse(data);
287
- }
288
- catch (error) {
289
- logError(`Failed to load chat ${chatId}`, error);
290
- return null;
291
- }
228
+ try {
229
+ chat.backendConversationId = backendConversationId;
230
+ chat.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
231
+ const chatPath = this.getChatPath(chatId);
232
+ fs.writeFileSync(chatPath, JSON.stringify(chat, null, 2), "utf-8");
233
+ return true;
234
+ } catch (error) {
235
+ logError(`Failed to set backend conversation ID for chat ${chatId}`, error);
236
+ return false;
292
237
  }
293
- /**
294
- * List all chats (metadata only, sorted by updatedAt descending)
295
- * Uses the in-memory index to avoid loading full chat files
296
- */
297
- listChats() {
298
- // Ensure index is loaded
299
- this.loadIndex();
300
- // Return sorted metadata from the cache
301
- const chats = Array.from(this.chatIndex.values());
302
- // Sort by updatedAt descending (most recent first)
303
- chats.sort((a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime());
304
- return chats;
238
+ }
239
+ /**
240
+ * Get the backend conversation ID for a chat (if any)
241
+ */
242
+ getBackendConversationId(chatId) {
243
+ const chat = this.loadChat(chatId);
244
+ return chat?.backendConversationId;
245
+ }
246
+ /**
247
+ * Load a chat by ID
248
+ */
249
+ loadChat(chatId) {
250
+ const chatPath = this.getChatPath(chatId);
251
+ if (!fs.existsSync(chatPath)) {
252
+ return null;
305
253
  }
306
- /**
307
- * Delete a chat by ID
308
- */
309
- deleteChat(chatId) {
310
- const chatPath = this.getChatPath(chatId);
311
- if (!fs.existsSync(chatPath)) {
312
- return false;
313
- }
314
- try {
315
- fs.unlinkSync(chatPath);
316
- // Remove from index
317
- this.chatIndex.delete(chatId);
318
- this.saveIndex();
319
- return true;
320
- }
321
- catch (error) {
322
- logError(`Failed to delete chat ${chatId}`, error);
323
- return false;
324
- }
254
+ try {
255
+ const data = fs.readFileSync(chatPath, "utf-8");
256
+ return JSON.parse(data);
257
+ } catch (error) {
258
+ logError(`Failed to load chat ${chatId}`, error);
259
+ return null;
325
260
  }
326
- /**
327
- * Import a full chat object (used for restoring from cloud sync)
328
- * Overwrites existing chat with same ID if present
329
- */
330
- importChat(chat) {
331
- if (!chat || !chat.id) {
332
- return false;
333
- }
261
+ }
262
+ /**
263
+ * List all chats (metadata only, sorted by updatedAt descending)
264
+ * Uses the in-memory index to avoid loading full chat files
265
+ */
266
+ listChats() {
267
+ this.loadIndex();
268
+ const chats = Array.from(this.chatIndex.values());
269
+ chats.sort(
270
+ (a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime()
271
+ );
272
+ return chats;
273
+ }
274
+ /**
275
+ * Delete a chat by ID
276
+ */
277
+ deleteChat(chatId) {
278
+ const chatPath = this.getChatPath(chatId);
279
+ const checkpointsPath = path.join(os.homedir(), ".centaurus", "checkpoints", chatId);
280
+ if (!fs.existsSync(chatPath)) {
281
+ if (fs.existsSync(checkpointsPath)) {
334
282
  try {
335
- const chatPath = this.getChatPath(chat.id);
336
- // Ensure the chat has required fields
337
- const now = new Date().toISOString();
338
- const importedChat = {
339
- id: chat.id,
340
- title: chat.title || 'Imported Chat',
341
- createdAt: chat.createdAt || now,
342
- updatedAt: now, // Always update the timestamp on import
343
- messageCount: chat.messages?.length || chat.messageCount || 0,
344
- messages: chat.messages || [],
345
- uiMessages: chat.uiMessages,
346
- cwd: chat.cwd,
347
- remoteContext: chat.remoteContext,
348
- backendConversationId: chat.backendConversationId,
349
- environment: chat.environment,
350
- };
351
- fs.writeFileSync(chatPath, JSON.stringify(importedChat, null, 2), 'utf-8');
352
- // Update the index
353
- this.updateIndexEntry(importedChat);
354
- return true;
355
- }
356
- catch (error) {
357
- logError(`Failed to import chat ${chat.id}`, error);
358
- return false;
283
+ fs.rmSync(checkpointsPath, { recursive: true, force: true });
284
+ } catch {
359
285
  }
286
+ }
287
+ return false;
360
288
  }
361
- /**
362
- * Rename a chat by ID
363
- */
364
- renameChat(chatId, newTitle) {
365
- const chat = this.loadChat(chatId);
366
- if (!chat) {
367
- return false;
368
- }
369
- try {
370
- chat.title = newTitle;
371
- chat.updatedAt = new Date().toISOString();
372
- const chatPath = this.getChatPath(chatId);
373
- fs.writeFileSync(chatPath, JSON.stringify(chat, null, 2), 'utf-8');
374
- // Update the index
375
- this.updateIndexEntry(chat);
376
- return true;
377
- }
378
- catch (error) {
379
- logError(`Failed to rename chat ${chatId}`, error);
380
- return false;
381
- }
289
+ try {
290
+ fs.unlinkSync(chatPath);
291
+ if (fs.existsSync(checkpointsPath)) {
292
+ fs.rmSync(checkpointsPath, { recursive: true, force: true });
293
+ }
294
+ this.chatIndex.delete(chatId);
295
+ this.saveIndex();
296
+ return true;
297
+ } catch (error) {
298
+ logError(`Failed to delete chat ${chatId}`, error);
299
+ return false;
300
+ }
301
+ }
302
+ /**
303
+ * Import a full chat object (used for restoring from cloud sync)
304
+ * Overwrites existing chat with same ID if present
305
+ */
306
+ importChat(chat) {
307
+ if (!chat || !chat.id) {
308
+ return false;
309
+ }
310
+ try {
311
+ const chatPath = this.getChatPath(chat.id);
312
+ const now = (/* @__PURE__ */ new Date()).toISOString();
313
+ const importedChat = {
314
+ id: chat.id,
315
+ title: chat.title || "Imported Chat",
316
+ createdAt: chat.createdAt || now,
317
+ updatedAt: now,
318
+ // Always update the timestamp on import
319
+ messageCount: chat.messages?.length || chat.messageCount || 0,
320
+ messages: chat.messages || [],
321
+ uiMessages: chat.uiMessages,
322
+ cwd: chat.cwd,
323
+ remoteContext: chat.remoteContext,
324
+ remoteContextStack: chat.remoteContextStack,
325
+ checkpointIndex: chat.checkpointIndex,
326
+ backendConversationId: chat.backendConversationId,
327
+ environment: chat.environment
328
+ };
329
+ fs.writeFileSync(chatPath, JSON.stringify(importedChat, null, 2), "utf-8");
330
+ this.updateIndexEntry(importedChat);
331
+ return true;
332
+ } catch (error) {
333
+ logError(`Failed to import chat ${chat.id}`, error);
334
+ return false;
335
+ }
336
+ }
337
+ /**
338
+ * Rename a chat by ID
339
+ */
340
+ renameChat(chatId, newTitle) {
341
+ const chat = this.loadChat(chatId);
342
+ if (!chat) {
343
+ return false;
382
344
  }
383
- /**
384
- * Get the chats directory path
385
- */
386
- getChatsDir() {
387
- return this.chatsDir;
345
+ try {
346
+ chat.title = newTitle;
347
+ chat.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
348
+ const chatPath = this.getChatPath(chatId);
349
+ fs.writeFileSync(chatPath, JSON.stringify(chat, null, 2), "utf-8");
350
+ this.updateIndexEntry(chat);
351
+ return true;
352
+ } catch (error) {
353
+ logError(`Failed to rename chat ${chatId}`, error);
354
+ return false;
388
355
  }
356
+ }
357
+ /**
358
+ * Get the chats directory path
359
+ */
360
+ getChatsDir() {
361
+ return this.chatsDir;
362
+ }
389
363
  }
390
- // Export singleton instance
391
- export const localChatStorage = new LocalChatStorage();
364
+ const localChatStorage = new LocalChatStorage();
365
+ export {
366
+ LocalChatStorage,
367
+ localChatStorage
368
+ };
392
369
  //# sourceMappingURL=local-chat-storage.js.map