dexto 1.3.0 → 1.5.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 (494) hide show
  1. package/README.md +87 -22
  2. package/dist/agents/agent-registry.json +9 -0
  3. package/dist/agents/agent-template.yml +2 -2
  4. package/dist/agents/coding-agent/coding-agent.yml +27 -16
  5. package/dist/agents/database-agent/database-agent.yml +2 -2
  6. package/dist/agents/default-agent.yml +9 -7
  7. package/dist/agents/github-agent/github-agent.yml +2 -2
  8. package/dist/agents/product-name-researcher/product-name-researcher.yml +2 -2
  9. package/dist/agents/talk2pdf-agent/talk2pdf-agent.yml +2 -2
  10. package/dist/analytics/events.d.ts +13 -6
  11. package/dist/analytics/events.d.ts.map +1 -1
  12. package/dist/analytics/index.d.ts +1 -1
  13. package/dist/analytics/index.d.ts.map +1 -1
  14. package/dist/analytics/index.js +6 -2
  15. package/dist/api/server-hono.d.ts.map +1 -1
  16. package/dist/api/server-hono.js +65 -9
  17. package/dist/cli/cli-subscriber.d.ts +4 -0
  18. package/dist/cli/cli-subscriber.d.ts.map +1 -1
  19. package/dist/cli/cli-subscriber.js +47 -3
  20. package/dist/cli/commands/create-app.d.ts +16 -14
  21. package/dist/cli/commands/create-app.d.ts.map +1 -1
  22. package/dist/cli/commands/create-app.js +626 -102
  23. package/dist/cli/commands/create-image.d.ts +7 -0
  24. package/dist/cli/commands/create-image.d.ts.map +1 -0
  25. package/dist/cli/commands/create-image.js +201 -0
  26. package/dist/cli/commands/helpers/formatters.d.ts.map +1 -1
  27. package/dist/cli/commands/helpers/formatters.js +9 -8
  28. package/dist/cli/commands/index.d.ts +2 -1
  29. package/dist/cli/commands/index.d.ts.map +1 -1
  30. package/dist/cli/commands/index.js +2 -1
  31. package/dist/cli/commands/init-app.js +7 -7
  32. package/dist/cli/commands/install.d.ts +0 -3
  33. package/dist/cli/commands/install.d.ts.map +1 -1
  34. package/dist/cli/commands/install.js +19 -70
  35. package/dist/cli/commands/interactive-commands/command-parser.d.ts +17 -14
  36. package/dist/cli/commands/interactive-commands/command-parser.d.ts.map +1 -1
  37. package/dist/cli/commands/interactive-commands/command-parser.js +7 -22
  38. package/dist/cli/commands/interactive-commands/commands.d.ts +4 -4
  39. package/dist/cli/commands/interactive-commands/commands.d.ts.map +1 -1
  40. package/dist/cli/commands/interactive-commands/commands.js +34 -42
  41. package/dist/cli/commands/interactive-commands/documentation-commands.d.ts.map +1 -1
  42. package/dist/cli/commands/interactive-commands/documentation-commands.js +4 -7
  43. package/dist/cli/commands/interactive-commands/general-commands.d.ts.map +1 -1
  44. package/dist/cli/commands/interactive-commands/general-commands.js +159 -117
  45. package/dist/cli/commands/interactive-commands/mcp/index.d.ts +9 -3
  46. package/dist/cli/commands/interactive-commands/mcp/index.d.ts.map +1 -1
  47. package/dist/cli/commands/interactive-commands/mcp/index.js +18 -3
  48. package/dist/cli/commands/interactive-commands/model/index.d.ts +8 -6
  49. package/dist/cli/commands/interactive-commands/model/index.d.ts.map +1 -1
  50. package/dist/cli/commands/interactive-commands/model/index.js +18 -6
  51. package/dist/cli/commands/interactive-commands/prompt-commands.d.ts +3 -2
  52. package/dist/cli/commands/interactive-commands/prompt-commands.d.ts.map +1 -1
  53. package/dist/cli/commands/interactive-commands/prompt-commands.js +77 -60
  54. package/dist/cli/commands/interactive-commands/session/index.d.ts +7 -12
  55. package/dist/cli/commands/interactive-commands/session/index.d.ts.map +1 -1
  56. package/dist/cli/commands/interactive-commands/session/index.js +7 -14
  57. package/dist/cli/commands/interactive-commands/session/session-commands.d.ts +10 -24
  58. package/dist/cli/commands/interactive-commands/session/session-commands.d.ts.map +1 -1
  59. package/dist/cli/commands/interactive-commands/session/session-commands.js +16 -371
  60. package/dist/cli/commands/interactive-commands/system/system-commands.d.ts +1 -0
  61. package/dist/cli/commands/interactive-commands/system/system-commands.d.ts.map +1 -1
  62. package/dist/cli/commands/interactive-commands/system/system-commands.js +106 -77
  63. package/dist/cli/commands/interactive-commands/tool-commands.d.ts +1 -1
  64. package/dist/cli/commands/interactive-commands/tool-commands.d.ts.map +1 -1
  65. package/dist/cli/commands/interactive-commands/tool-commands.js +5 -62
  66. package/dist/cli/commands/interactive-commands/utils/command-output.d.ts +13 -17
  67. package/dist/cli/commands/interactive-commands/utils/command-output.d.ts.map +1 -1
  68. package/dist/cli/commands/interactive-commands/utils/command-output.js +18 -37
  69. package/dist/cli/commands/list-agents.d.ts +2 -2
  70. package/dist/cli/commands/list-agents.d.ts.map +1 -1
  71. package/dist/cli/commands/list-agents.js +38 -34
  72. package/dist/cli/commands/session-commands.js +16 -16
  73. package/dist/cli/commands/setup.d.ts +13 -5
  74. package/dist/cli/commands/setup.d.ts.map +1 -1
  75. package/dist/cli/commands/setup.js +860 -65
  76. package/dist/cli/commands/uninstall.d.ts.map +1 -1
  77. package/dist/cli/commands/uninstall.js +4 -6
  78. package/dist/cli/commands/which.d.ts.map +1 -1
  79. package/dist/cli/commands/which.js +18 -4
  80. package/dist/cli/ink-cli/InkCLIRefactored.d.ts +9 -22
  81. package/dist/cli/ink-cli/InkCLIRefactored.d.ts.map +1 -1
  82. package/dist/cli/ink-cli/InkCLIRefactored.js +50 -133
  83. package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts +26 -3
  84. package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts.map +1 -1
  85. package/dist/cli/ink-cli/components/ApprovalPrompt.js +182 -45
  86. package/dist/cli/ink-cli/components/CustomInput.js +1 -1
  87. package/dist/cli/ink-cli/components/EditableMultiLineInput.js +4 -4
  88. package/dist/cli/ink-cli/components/ElicitationForm.d.ts +22 -0
  89. package/dist/cli/ink-cli/components/ElicitationForm.d.ts.map +1 -0
  90. package/dist/cli/ink-cli/components/ElicitationForm.js +358 -0
  91. package/dist/cli/ink-cli/components/ErrorBoundary.d.ts.map +1 -1
  92. package/dist/cli/ink-cli/components/ErrorBoundary.js +1 -1
  93. package/dist/cli/ink-cli/components/Footer.d.ts +16 -0
  94. package/dist/cli/ink-cli/components/Footer.d.ts.map +1 -0
  95. package/dist/cli/ink-cli/components/Footer.js +27 -0
  96. package/dist/cli/ink-cli/components/HistorySearchBar.d.ts +17 -0
  97. package/dist/cli/ink-cli/components/HistorySearchBar.d.ts.map +1 -0
  98. package/dist/cli/ink-cli/components/HistorySearchBar.js +8 -0
  99. package/dist/cli/ink-cli/components/MultiLineInput.d.ts.map +1 -1
  100. package/dist/cli/ink-cli/components/MultiLineInput.js +3 -3
  101. package/dist/cli/ink-cli/components/ResourceAutocomplete.d.ts +15 -2
  102. package/dist/cli/ink-cli/components/ResourceAutocomplete.d.ts.map +1 -1
  103. package/dist/cli/ink-cli/components/ResourceAutocomplete.js +126 -82
  104. package/dist/cli/ink-cli/components/SlashCommandAutocomplete.d.ts +15 -2
  105. package/dist/cli/ink-cli/components/SlashCommandAutocomplete.d.ts.map +1 -1
  106. package/dist/cli/ink-cli/components/SlashCommandAutocomplete.js +228 -122
  107. package/dist/cli/ink-cli/components/StatusBar.d.ts +15 -2
  108. package/dist/cli/ink-cli/components/StatusBar.d.ts.map +1 -1
  109. package/dist/cli/ink-cli/components/StatusBar.js +50 -10
  110. package/dist/cli/ink-cli/components/TextBufferInput.d.ts +52 -0
  111. package/dist/cli/ink-cli/components/TextBufferInput.d.ts.map +1 -0
  112. package/dist/cli/ink-cli/components/TextBufferInput.js +471 -0
  113. package/dist/cli/ink-cli/components/base/BaseAutocomplete.js +4 -4
  114. package/dist/cli/ink-cli/components/base/BaseSelector.d.ts +11 -1
  115. package/dist/cli/ink-cli/components/base/BaseSelector.d.ts.map +1 -1
  116. package/dist/cli/ink-cli/components/base/BaseSelector.js +90 -49
  117. package/dist/cli/ink-cli/components/chat/Footer.js +1 -1
  118. package/dist/cli/ink-cli/components/chat/Header.d.ts +1 -0
  119. package/dist/cli/ink-cli/components/chat/Header.d.ts.map +1 -1
  120. package/dist/cli/ink-cli/components/chat/Header.js +6 -3
  121. package/dist/cli/ink-cli/components/chat/MessageItem.d.ts +3 -0
  122. package/dist/cli/ink-cli/components/chat/MessageItem.d.ts.map +1 -1
  123. package/dist/cli/ink-cli/components/chat/MessageItem.js +95 -9
  124. package/dist/cli/ink-cli/components/chat/MessageList.js +1 -1
  125. package/dist/cli/ink-cli/components/chat/QueuedMessagesDisplay.d.ts +16 -0
  126. package/dist/cli/ink-cli/components/chat/QueuedMessagesDisplay.d.ts.map +1 -0
  127. package/dist/cli/ink-cli/components/chat/QueuedMessagesDisplay.js +27 -0
  128. package/dist/cli/ink-cli/components/chat/ToolIcon.d.ts +5 -3
  129. package/dist/cli/ink-cli/components/chat/ToolIcon.d.ts.map +1 -1
  130. package/dist/cli/ink-cli/components/chat/ToolIcon.js +21 -7
  131. package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.d.ts +10 -0
  132. package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.d.ts.map +1 -0
  133. package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.js +6 -0
  134. package/dist/cli/ink-cli/components/chat/styled-boxes/HelpBox.d.ts +10 -0
  135. package/dist/cli/ink-cli/components/chat/styled-boxes/HelpBox.d.ts.map +1 -0
  136. package/dist/cli/ink-cli/components/chat/styled-boxes/HelpBox.js +15 -0
  137. package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.d.ts +10 -0
  138. package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.d.ts.map +1 -0
  139. package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.js +9 -0
  140. package/dist/cli/ink-cli/components/chat/styled-boxes/SessionHistoryBox.d.ts +10 -0
  141. package/dist/cli/ink-cli/components/chat/styled-boxes/SessionHistoryBox.d.ts.map +1 -0
  142. package/dist/cli/ink-cli/components/chat/styled-boxes/SessionHistoryBox.js +37 -0
  143. package/dist/cli/ink-cli/components/chat/styled-boxes/SessionListBox.d.ts +10 -0
  144. package/dist/cli/ink-cli/components/chat/styled-boxes/SessionListBox.d.ts.map +1 -0
  145. package/dist/cli/ink-cli/components/chat/styled-boxes/SessionListBox.js +9 -0
  146. package/dist/cli/ink-cli/components/chat/styled-boxes/ShortcutsBox.d.ts +10 -0
  147. package/dist/cli/ink-cli/components/chat/styled-boxes/ShortcutsBox.d.ts.map +1 -0
  148. package/dist/cli/ink-cli/components/chat/styled-boxes/ShortcutsBox.js +6 -0
  149. package/dist/cli/ink-cli/components/chat/styled-boxes/StatsBox.d.ts +10 -0
  150. package/dist/cli/ink-cli/components/chat/styled-boxes/StatsBox.d.ts.map +1 -0
  151. package/dist/cli/ink-cli/components/chat/styled-boxes/StatsBox.js +29 -0
  152. package/dist/cli/ink-cli/components/chat/styled-boxes/StyledBox.d.ts +45 -0
  153. package/dist/cli/ink-cli/components/chat/styled-boxes/StyledBox.d.ts.map +1 -0
  154. package/dist/cli/ink-cli/components/chat/styled-boxes/StyledBox.js +38 -0
  155. package/dist/cli/ink-cli/components/chat/styled-boxes/SyspromptBox.d.ts +10 -0
  156. package/dist/cli/ink-cli/components/chat/styled-boxes/SyspromptBox.d.ts.map +1 -0
  157. package/dist/cli/ink-cli/components/chat/styled-boxes/SyspromptBox.js +6 -0
  158. package/dist/cli/ink-cli/components/chat/styled-boxes/index.d.ts +13 -0
  159. package/dist/cli/ink-cli/components/chat/styled-boxes/index.d.ts.map +1 -0
  160. package/dist/cli/ink-cli/components/chat/styled-boxes/index.js +12 -0
  161. package/dist/cli/ink-cli/components/input/InputArea.d.ts +36 -8
  162. package/dist/cli/ink-cli/components/input/InputArea.d.ts.map +1 -1
  163. package/dist/cli/ink-cli/components/input/InputArea.js +3 -3
  164. package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.d.ts +25 -0
  165. package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.d.ts.map +1 -0
  166. package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.js +166 -0
  167. package/dist/cli/ink-cli/components/modes/StaticCLI.d.ts +27 -0
  168. package/dist/cli/ink-cli/components/modes/StaticCLI.d.ts.map +1 -0
  169. package/dist/cli/ink-cli/components/modes/StaticCLI.js +95 -0
  170. package/dist/cli/ink-cli/components/modes/index.d.ts +10 -0
  171. package/dist/cli/ink-cli/components/modes/index.d.ts.map +1 -0
  172. package/dist/cli/ink-cli/components/modes/index.js +9 -0
  173. package/dist/cli/ink-cli/components/overlays/ApiKeyInput.d.ts +26 -0
  174. package/dist/cli/ink-cli/components/overlays/ApiKeyInput.d.ts.map +1 -0
  175. package/dist/cli/ink-cli/components/overlays/ApiKeyInput.js +92 -0
  176. package/dist/cli/ink-cli/components/overlays/CustomModelWizard.d.ts +29 -0
  177. package/dist/cli/ink-cli/components/overlays/CustomModelWizard.d.ts.map +1 -0
  178. package/dist/cli/ink-cli/components/overlays/CustomModelWizard.js +286 -0
  179. package/dist/cli/ink-cli/components/overlays/LogLevelSelector.d.ts +22 -0
  180. package/dist/cli/ink-cli/components/overlays/LogLevelSelector.d.ts.map +1 -0
  181. package/dist/cli/ink-cli/components/overlays/LogLevelSelector.js +59 -0
  182. package/dist/cli/ink-cli/components/overlays/McpAddChoice.d.ts +22 -0
  183. package/dist/cli/ink-cli/components/overlays/McpAddChoice.d.ts.map +1 -0
  184. package/dist/cli/ink-cli/components/overlays/McpAddChoice.js +59 -0
  185. package/dist/cli/ink-cli/components/overlays/McpAddSelector.d.ts +26 -0
  186. package/dist/cli/ink-cli/components/overlays/McpAddSelector.d.ts.map +1 -0
  187. package/dist/cli/ink-cli/components/overlays/McpAddSelector.js +73 -0
  188. package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.d.ts +21 -0
  189. package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.d.ts.map +1 -0
  190. package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.js +51 -0
  191. package/dist/cli/ink-cli/components/overlays/McpCustomWizard.d.ts +29 -0
  192. package/dist/cli/ink-cli/components/overlays/McpCustomWizard.d.ts.map +1 -0
  193. package/dist/cli/ink-cli/components/overlays/McpCustomWizard.js +215 -0
  194. package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.d.ts +22 -0
  195. package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.d.ts.map +1 -0
  196. package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.js +74 -0
  197. package/dist/cli/ink-cli/components/overlays/McpSelector.d.ts +21 -0
  198. package/dist/cli/ink-cli/components/overlays/McpSelector.d.ts.map +1 -0
  199. package/dist/cli/ink-cli/components/overlays/McpSelector.js +52 -0
  200. package/dist/cli/ink-cli/components/overlays/McpServerActions.d.ts +28 -0
  201. package/dist/cli/ink-cli/components/overlays/McpServerActions.d.ts.map +1 -0
  202. package/dist/cli/ink-cli/components/overlays/McpServerActions.js +84 -0
  203. package/dist/cli/ink-cli/components/overlays/McpServerList.d.ts +29 -0
  204. package/dist/cli/ink-cli/components/overlays/McpServerList.d.ts.map +1 -0
  205. package/dist/cli/ink-cli/components/overlays/McpServerList.js +109 -0
  206. package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts +15 -8
  207. package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts.map +1 -1
  208. package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.js +400 -23
  209. package/dist/cli/ink-cli/components/overlays/PromptAddChoice.d.ts +22 -0
  210. package/dist/cli/ink-cli/components/overlays/PromptAddChoice.d.ts.map +1 -0
  211. package/dist/cli/ink-cli/components/overlays/PromptAddChoice.js +52 -0
  212. package/dist/cli/ink-cli/components/overlays/PromptAddWizard.d.ts +29 -0
  213. package/dist/cli/ink-cli/components/overlays/PromptAddWizard.d.ts.map +1 -0
  214. package/dist/cli/ink-cli/components/overlays/PromptAddWizard.js +166 -0
  215. package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.d.ts +27 -0
  216. package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.d.ts.map +1 -0
  217. package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.js +119 -0
  218. package/dist/cli/ink-cli/components/overlays/PromptList.d.ts +33 -0
  219. package/dist/cli/ink-cli/components/overlays/PromptList.d.ts.map +1 -0
  220. package/dist/cli/ink-cli/components/overlays/PromptList.js +144 -0
  221. package/dist/cli/ink-cli/components/overlays/SearchOverlay.d.ts +23 -0
  222. package/dist/cli/ink-cli/components/overlays/SearchOverlay.d.ts.map +1 -0
  223. package/dist/cli/ink-cli/components/overlays/SearchOverlay.js +189 -0
  224. package/dist/cli/ink-cli/components/overlays/SessionSelectorRefactored.d.ts +7 -2
  225. package/dist/cli/ink-cli/components/overlays/SessionSelectorRefactored.d.ts.map +1 -1
  226. package/dist/cli/ink-cli/components/overlays/SessionSelectorRefactored.js +19 -5
  227. package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.d.ts +21 -0
  228. package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.d.ts.map +1 -0
  229. package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.js +42 -0
  230. package/dist/cli/ink-cli/components/overlays/StreamSelector.d.ts +20 -0
  231. package/dist/cli/ink-cli/components/overlays/StreamSelector.d.ts.map +1 -0
  232. package/dist/cli/ink-cli/components/overlays/StreamSelector.js +58 -0
  233. package/dist/cli/ink-cli/components/overlays/ToolBrowser.d.ts +25 -0
  234. package/dist/cli/ink-cli/components/overlays/ToolBrowser.d.ts.map +1 -0
  235. package/dist/cli/ink-cli/components/overlays/ToolBrowser.js +400 -0
  236. package/dist/cli/ink-cli/components/overlays/custom-model-wizard/LocalModelWizard.d.ts +25 -0
  237. package/dist/cli/ink-cli/components/overlays/custom-model-wizard/LocalModelWizard.d.ts.map +1 -0
  238. package/dist/cli/ink-cli/components/overlays/custom-model-wizard/LocalModelWizard.js +609 -0
  239. package/dist/cli/ink-cli/components/overlays/custom-model-wizard/index.d.ts +15 -0
  240. package/dist/cli/ink-cli/components/overlays/custom-model-wizard/index.d.ts.map +1 -0
  241. package/dist/cli/ink-cli/components/overlays/custom-model-wizard/index.js +14 -0
  242. package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.d.ts +33 -0
  243. package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.d.ts.map +1 -0
  244. package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.js +419 -0
  245. package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ApiKeyStep.d.ts +25 -0
  246. package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ApiKeyStep.d.ts.map +1 -0
  247. package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ApiKeyStep.js +29 -0
  248. package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ProviderSelector.d.ts +17 -0
  249. package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ProviderSelector.d.ts.map +1 -0
  250. package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ProviderSelector.js +11 -0
  251. package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/SetupInfoBanner.d.ts +20 -0
  252. package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/SetupInfoBanner.d.ts.map +1 -0
  253. package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/SetupInfoBanner.js +10 -0
  254. package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/WizardStepInput.d.ts +30 -0
  255. package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/WizardStepInput.d.ts.map +1 -0
  256. package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/WizardStepInput.js +13 -0
  257. package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/index.d.ts +8 -0
  258. package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/index.d.ts.map +1 -0
  259. package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/index.js +7 -0
  260. package/dist/cli/ink-cli/components/overlays/custom-model-wizard/types.d.ts +79 -0
  261. package/dist/cli/ink-cli/components/overlays/custom-model-wizard/types.d.ts.map +1 -0
  262. package/dist/cli/ink-cli/components/overlays/custom-model-wizard/types.js +38 -0
  263. package/dist/cli/ink-cli/components/renderers/DiffRenderer.d.ts +21 -0
  264. package/dist/cli/ink-cli/components/renderers/DiffRenderer.d.ts.map +1 -0
  265. package/dist/cli/ink-cli/components/renderers/DiffRenderer.js +65 -0
  266. package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.d.ts +28 -0
  267. package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.d.ts.map +1 -0
  268. package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.js +66 -0
  269. package/dist/cli/ink-cli/components/renderers/FileRenderer.d.ts +19 -0
  270. package/dist/cli/ink-cli/components/renderers/FileRenderer.d.ts.map +1 -0
  271. package/dist/cli/ink-cli/components/renderers/FileRenderer.js +26 -0
  272. package/dist/cli/ink-cli/components/renderers/GenericRenderer.d.ts +21 -0
  273. package/dist/cli/ink-cli/components/renderers/GenericRenderer.d.ts.map +1 -0
  274. package/dist/cli/ink-cli/components/renderers/GenericRenderer.js +26 -0
  275. package/dist/cli/ink-cli/components/renderers/SearchRenderer.d.ts +20 -0
  276. package/dist/cli/ink-cli/components/renderers/SearchRenderer.d.ts.map +1 -0
  277. package/dist/cli/ink-cli/components/renderers/SearchRenderer.js +12 -0
  278. package/dist/cli/ink-cli/components/renderers/ShellRenderer.d.ts +21 -0
  279. package/dist/cli/ink-cli/components/renderers/ShellRenderer.d.ts.map +1 -0
  280. package/dist/cli/ink-cli/components/renderers/ShellRenderer.js +25 -0
  281. package/dist/cli/ink-cli/components/renderers/diff-shared.d.ts +61 -0
  282. package/dist/cli/ink-cli/components/renderers/diff-shared.d.ts.map +1 -0
  283. package/dist/cli/ink-cli/components/renderers/diff-shared.js +158 -0
  284. package/dist/cli/ink-cli/components/renderers/index.d.ts +28 -0
  285. package/dist/cli/ink-cli/components/renderers/index.d.ts.map +1 -0
  286. package/dist/cli/ink-cli/components/renderers/index.js +36 -0
  287. package/dist/cli/ink-cli/components/shared/MarkdownText.d.ts +38 -0
  288. package/dist/cli/ink-cli/components/shared/MarkdownText.d.ts.map +1 -0
  289. package/dist/cli/ink-cli/components/shared/MarkdownText.js +362 -0
  290. package/dist/cli/ink-cli/components/shared/VirtualizedList.d.ts +44 -0
  291. package/dist/cli/ink-cli/components/shared/VirtualizedList.d.ts.map +1 -0
  292. package/dist/cli/ink-cli/components/shared/VirtualizedList.js +300 -0
  293. package/dist/cli/ink-cli/components/shared/text-buffer.d.ts +185 -0
  294. package/dist/cli/ink-cli/components/shared/text-buffer.d.ts.map +1 -0
  295. package/dist/cli/ink-cli/components/shared/text-buffer.js +1338 -0
  296. package/dist/cli/ink-cli/constants/processingPhrases.d.ts +10 -0
  297. package/dist/cli/ink-cli/constants/processingPhrases.d.ts.map +1 -0
  298. package/dist/cli/ink-cli/constants/processingPhrases.js +64 -0
  299. package/dist/cli/ink-cli/constants/tips.d.ts +15 -0
  300. package/dist/cli/ink-cli/constants/tips.d.ts.map +1 -0
  301. package/dist/cli/ink-cli/constants/tips.js +53 -0
  302. package/dist/cli/ink-cli/containers/InputContainer.d.ts +42 -8
  303. package/dist/cli/ink-cli/containers/InputContainer.d.ts.map +1 -1
  304. package/dist/cli/ink-cli/containers/InputContainer.js +513 -85
  305. package/dist/cli/ink-cli/containers/OverlayContainer.d.ts +23 -5
  306. package/dist/cli/ink-cli/containers/OverlayContainer.d.ts.map +1 -1
  307. package/dist/cli/ink-cli/containers/OverlayContainer.js +1214 -132
  308. package/dist/cli/ink-cli/containers/index.d.ts +1 -1
  309. package/dist/cli/ink-cli/containers/index.d.ts.map +1 -1
  310. package/dist/cli/ink-cli/contexts/KeypressContext.d.ts +36 -0
  311. package/dist/cli/ink-cli/contexts/KeypressContext.d.ts.map +1 -0
  312. package/dist/cli/ink-cli/contexts/KeypressContext.js +461 -0
  313. package/dist/cli/ink-cli/contexts/MouseContext.d.ts +27 -0
  314. package/dist/cli/ink-cli/contexts/MouseContext.d.ts.map +1 -0
  315. package/dist/cli/ink-cli/contexts/MouseContext.js +102 -0
  316. package/dist/cli/ink-cli/contexts/ScrollProvider.d.ts +33 -0
  317. package/dist/cli/ink-cli/contexts/ScrollProvider.d.ts.map +1 -0
  318. package/dist/cli/ink-cli/contexts/ScrollProvider.js +170 -0
  319. package/dist/cli/ink-cli/contexts/index.d.ts +7 -0
  320. package/dist/cli/ink-cli/contexts/index.d.ts.map +1 -0
  321. package/dist/cli/ink-cli/contexts/index.js +6 -0
  322. package/dist/cli/ink-cli/hooks/index.d.ts +5 -0
  323. package/dist/cli/ink-cli/hooks/index.d.ts.map +1 -1
  324. package/dist/cli/ink-cli/hooks/index.js +6 -1
  325. package/dist/cli/ink-cli/hooks/useAgentEvents.d.ts +26 -9
  326. package/dist/cli/ink-cli/hooks/useAgentEvents.d.ts.map +1 -1
  327. package/dist/cli/ink-cli/hooks/useAgentEvents.js +90 -198
  328. package/dist/cli/ink-cli/hooks/useBatchedScroll.d.ts +14 -0
  329. package/dist/cli/ink-cli/hooks/useBatchedScroll.d.ts.map +1 -0
  330. package/dist/cli/ink-cli/hooks/useBatchedScroll.js +25 -0
  331. package/dist/cli/ink-cli/hooks/useCLIState.d.ts +50 -0
  332. package/dist/cli/ink-cli/hooks/useCLIState.d.ts.map +1 -0
  333. package/dist/cli/ink-cli/hooks/useCLIState.js +190 -0
  334. package/dist/cli/ink-cli/hooks/useElapsedTime.d.ts +24 -0
  335. package/dist/cli/ink-cli/hooks/useElapsedTime.d.ts.map +1 -0
  336. package/dist/cli/ink-cli/hooks/useElapsedTime.js +69 -0
  337. package/dist/cli/ink-cli/hooks/useHistorySearch.d.ts +61 -0
  338. package/dist/cli/ink-cli/hooks/useHistorySearch.d.ts.map +1 -0
  339. package/dist/cli/ink-cli/hooks/useHistorySearch.js +210 -0
  340. package/dist/cli/ink-cli/hooks/useInputOrchestrator.d.ts +136 -0
  341. package/dist/cli/ink-cli/hooks/useInputOrchestrator.d.ts.map +1 -0
  342. package/dist/cli/ink-cli/hooks/useInputOrchestrator.js +663 -0
  343. package/dist/cli/ink-cli/hooks/useKeyboardShortcuts.d.ts.map +1 -1
  344. package/dist/cli/ink-cli/hooks/useKeyboardShortcuts.js +7 -26
  345. package/dist/cli/ink-cli/hooks/useKeypress.d.ts +18 -0
  346. package/dist/cli/ink-cli/hooks/useKeypress.d.ts.map +1 -0
  347. package/dist/cli/ink-cli/hooks/useKeypress.js +26 -0
  348. package/dist/cli/ink-cli/hooks/usePhraseCycler.d.ts +30 -0
  349. package/dist/cli/ink-cli/hooks/usePhraseCycler.d.ts.map +1 -0
  350. package/dist/cli/ink-cli/hooks/usePhraseCycler.js +68 -0
  351. package/dist/cli/ink-cli/hooks/useStreaming.d.ts +19 -0
  352. package/dist/cli/ink-cli/hooks/useStreaming.d.ts.map +1 -0
  353. package/dist/cli/ink-cli/hooks/useStreaming.js +26 -0
  354. package/dist/cli/ink-cli/hooks/useTerminalSize.d.ts +14 -0
  355. package/dist/cli/ink-cli/hooks/useTerminalSize.d.ts.map +1 -0
  356. package/dist/cli/ink-cli/hooks/useTerminalSize.js +31 -0
  357. package/dist/cli/ink-cli/hooks/useTokenCounter.d.ts +42 -0
  358. package/dist/cli/ink-cli/hooks/useTokenCounter.d.ts.map +1 -0
  359. package/dist/cli/ink-cli/hooks/useTokenCounter.js +96 -0
  360. package/dist/cli/ink-cli/services/CommandService.d.ts +32 -1
  361. package/dist/cli/ink-cli/services/CommandService.d.ts.map +1 -1
  362. package/dist/cli/ink-cli/services/CommandService.js +36 -5
  363. package/dist/cli/ink-cli/services/InputService.d.ts +1 -5
  364. package/dist/cli/ink-cli/services/InputService.d.ts.map +1 -1
  365. package/dist/cli/ink-cli/services/InputService.js +1 -8
  366. package/dist/cli/ink-cli/services/index.d.ts +2 -1
  367. package/dist/cli/ink-cli/services/index.d.ts.map +1 -1
  368. package/dist/cli/ink-cli/services/index.js +2 -1
  369. package/dist/cli/ink-cli/services/processStream.d.ts +69 -0
  370. package/dist/cli/ink-cli/services/processStream.d.ts.map +1 -0
  371. package/dist/cli/ink-cli/services/processStream.js +742 -0
  372. package/dist/cli/ink-cli/state/actions.d.ts +30 -60
  373. package/dist/cli/ink-cli/state/actions.d.ts.map +1 -1
  374. package/dist/cli/ink-cli/state/actions.js +3 -0
  375. package/dist/cli/ink-cli/state/index.d.ts +5 -3
  376. package/dist/cli/ink-cli/state/index.d.ts.map +1 -1
  377. package/dist/cli/ink-cli/state/index.js +4 -3
  378. package/dist/cli/ink-cli/state/initialState.d.ts +4 -3
  379. package/dist/cli/ink-cli/state/initialState.d.ts.map +1 -1
  380. package/dist/cli/ink-cli/state/initialState.js +20 -4
  381. package/dist/cli/ink-cli/state/reducer.d.ts +3 -0
  382. package/dist/cli/ink-cli/state/reducer.d.ts.map +1 -1
  383. package/dist/cli/ink-cli/state/reducer.js +62 -168
  384. package/dist/cli/ink-cli/state/streaming-state.d.ts +27 -0
  385. package/dist/cli/ink-cli/state/streaming-state.d.ts.map +1 -0
  386. package/dist/cli/ink-cli/state/streaming-state.js +39 -0
  387. package/dist/cli/ink-cli/state/types.d.ts +223 -6
  388. package/dist/cli/ink-cli/state/types.d.ts.map +1 -1
  389. package/dist/cli/ink-cli/utils/bracketedPaste.d.ts +22 -0
  390. package/dist/cli/ink-cli/utils/bracketedPaste.d.ts.map +1 -0
  391. package/dist/cli/ink-cli/utils/bracketedPaste.js +27 -0
  392. package/dist/cli/ink-cli/utils/clipboardUtils.d.ts +49 -0
  393. package/dist/cli/ink-cli/utils/clipboardUtils.d.ts.map +1 -0
  394. package/dist/cli/ink-cli/utils/clipboardUtils.js +356 -0
  395. package/dist/cli/ink-cli/utils/commandOverlays.d.ts +33 -0
  396. package/dist/cli/ink-cli/utils/commandOverlays.d.ts.map +1 -0
  397. package/dist/cli/ink-cli/utils/commandOverlays.js +78 -0
  398. package/dist/cli/ink-cli/utils/debugLog.d.ts +38 -0
  399. package/dist/cli/ink-cli/utils/debugLog.d.ts.map +1 -0
  400. package/dist/cli/ink-cli/utils/debugLog.js +66 -0
  401. package/dist/cli/ink-cli/utils/index.d.ts +2 -1
  402. package/dist/cli/ink-cli/utils/index.d.ts.map +1 -1
  403. package/dist/cli/ink-cli/utils/index.js +3 -1
  404. package/dist/cli/ink-cli/utils/input.d.ts +25 -0
  405. package/dist/cli/ink-cli/utils/input.d.ts.map +1 -0
  406. package/dist/cli/ink-cli/utils/input.js +56 -0
  407. package/dist/cli/ink-cli/utils/inputParsing.d.ts +0 -9
  408. package/dist/cli/ink-cli/utils/inputParsing.d.ts.map +1 -1
  409. package/dist/cli/ink-cli/utils/inputParsing.js +0 -27
  410. package/dist/cli/ink-cli/utils/messageFormatting.d.ts +59 -3
  411. package/dist/cli/ink-cli/utils/messageFormatting.d.ts.map +1 -1
  412. package/dist/cli/ink-cli/utils/messageFormatting.js +348 -20
  413. package/dist/cli/ink-cli/utils/mouse.d.ts +61 -0
  414. package/dist/cli/ink-cli/utils/mouse.d.ts.map +1 -0
  415. package/dist/cli/ink-cli/utils/mouse.js +209 -0
  416. package/dist/cli/ink-cli/utils/streamSplitter.d.ts +44 -0
  417. package/dist/cli/ink-cli/utils/streamSplitter.d.ts.map +1 -0
  418. package/dist/cli/ink-cli/utils/streamSplitter.js +154 -0
  419. package/dist/cli/ink-cli/utils/textUtils.d.ts +63 -0
  420. package/dist/cli/ink-cli/utils/textUtils.d.ts.map +1 -0
  421. package/dist/cli/ink-cli/utils/textUtils.js +248 -0
  422. package/dist/cli/ink-cli/utils/toolUtils.d.ts +9 -0
  423. package/dist/cli/ink-cli/utils/toolUtils.d.ts.map +1 -0
  424. package/dist/cli/ink-cli/utils/toolUtils.js +15 -0
  425. package/dist/cli/utils/api-key-setup.d.ts +54 -4
  426. package/dist/cli/utils/api-key-setup.d.ts.map +1 -1
  427. package/dist/cli/utils/api-key-setup.js +433 -107
  428. package/dist/cli/utils/api-key-verification.d.ts +17 -0
  429. package/dist/cli/utils/api-key-verification.d.ts.map +1 -0
  430. package/dist/cli/utils/api-key-verification.js +211 -0
  431. package/dist/cli/utils/config-validation.d.ts +22 -2
  432. package/dist/cli/utils/config-validation.d.ts.map +1 -1
  433. package/dist/cli/utils/config-validation.js +354 -25
  434. package/dist/cli/utils/local-model-setup.d.ts +46 -0
  435. package/dist/cli/utils/local-model-setup.d.ts.map +1 -0
  436. package/dist/cli/utils/local-model-setup.js +662 -0
  437. package/dist/cli/utils/options.d.ts.map +1 -1
  438. package/dist/cli/utils/options.js +1 -3
  439. package/dist/cli/utils/prompt-helpers.d.ts +47 -0
  440. package/dist/cli/utils/prompt-helpers.d.ts.map +1 -0
  441. package/dist/cli/utils/prompt-helpers.js +66 -0
  442. package/dist/cli/utils/provider-setup.d.ts +66 -8
  443. package/dist/cli/utils/provider-setup.d.ts.map +1 -1
  444. package/dist/cli/utils/provider-setup.js +324 -84
  445. package/dist/cli/utils/scaffolding-utils.d.ts +76 -0
  446. package/dist/cli/utils/scaffolding-utils.d.ts.map +1 -0
  447. package/dist/cli/utils/scaffolding-utils.js +246 -0
  448. package/dist/cli/utils/setup-utils.d.ts +16 -0
  449. package/dist/cli/utils/setup-utils.d.ts.map +1 -1
  450. package/dist/cli/utils/setup-utils.js +72 -21
  451. package/dist/cli/utils/template-engine.d.ts +65 -0
  452. package/dist/cli/utils/template-engine.d.ts.map +1 -0
  453. package/dist/cli/utils/template-engine.js +1089 -0
  454. package/dist/config/cli-overrides.d.ts +45 -2
  455. package/dist/config/cli-overrides.d.ts.map +1 -1
  456. package/dist/config/cli-overrides.js +107 -10
  457. package/dist/index.js +379 -99
  458. package/dist/utils/agent-helpers.d.ts +95 -0
  459. package/dist/utils/agent-helpers.d.ts.map +1 -0
  460. package/dist/utils/agent-helpers.js +117 -0
  461. package/dist/webui/assets/index-8j-KMkX1.js +2054 -0
  462. package/dist/webui/assets/index-c_AX24V4.css +1 -0
  463. package/dist/webui/assets/{tanstack-DgxBONJY.js → tanstack-Br79RQ-n.js} +1 -1
  464. package/dist/webui/index.html +4 -10
  465. package/dist/webui/logos/aws-color.svg +1 -0
  466. package/dist/webui/logos/dexto/dexto_logo.svg +1 -1
  467. package/dist/webui/logos/dexto/dexto_logo_light.svg +6 -6
  468. package/dist/webui/logos/glama.svg +7 -0
  469. package/dist/webui/logos/litellm.svg +7 -0
  470. package/dist/webui/logos/openrouter.svg +1 -0
  471. package/package.json +18 -15
  472. package/dist/cli/commands/interactive-commands/index.d.ts +0 -63
  473. package/dist/cli/commands/interactive-commands/index.d.ts.map +0 -1
  474. package/dist/cli/commands/interactive-commands/index.js +0 -73
  475. package/dist/cli/commands/interactive-commands/mcp/mcp-add-utils.d.ts +0 -34
  476. package/dist/cli/commands/interactive-commands/mcp/mcp-add-utils.d.ts.map +0 -1
  477. package/dist/cli/commands/interactive-commands/mcp/mcp-add-utils.js +0 -178
  478. package/dist/cli/commands/interactive-commands/mcp/mcp-commands.d.ts +0 -9
  479. package/dist/cli/commands/interactive-commands/mcp/mcp-commands.d.ts.map +0 -1
  480. package/dist/cli/commands/interactive-commands/mcp/mcp-commands.js +0 -325
  481. package/dist/cli/commands/interactive-commands/model/model-commands.d.ts +0 -21
  482. package/dist/cli/commands/interactive-commands/model/model-commands.d.ts.map +0 -1
  483. package/dist/cli/commands/interactive-commands/model/model-commands.js +0 -190
  484. package/dist/cli/ink-cli/components/MultiLineTextInput.d.ts +0 -26
  485. package/dist/cli/ink-cli/components/MultiLineTextInput.d.ts.map +0 -1
  486. package/dist/cli/ink-cli/components/MultiLineTextInput.js +0 -220
  487. package/dist/discord/bot.d.ts +0 -4
  488. package/dist/discord/bot.d.ts.map +0 -1
  489. package/dist/discord/bot.js +0 -193
  490. package/dist/telegram/bot.d.ts +0 -5
  491. package/dist/telegram/bot.d.ts.map +0 -1
  492. package/dist/telegram/bot.js +0 -251
  493. package/dist/webui/assets/index-DKq5Xng1.js +0 -687
  494. package/dist/webui/assets/index-D_0_GBu5.css +0 -1
@@ -0,0 +1,211 @@
1
+ // packages/cli/src/cli/utils/api-key-verification.ts
2
+ import { logger } from '@dexto/core';
3
+ /**
4
+ * Verify an API key by making a minimal test request to the provider.
5
+ * Uses provider-specific endpoints for efficient validation.
6
+ *
7
+ * @param provider - The LLM provider
8
+ * @param apiKey - The API key to verify
9
+ * @param model - Optional specific model to test with
10
+ * @returns Verification result
11
+ */
12
+ export async function verifyApiKey(provider, apiKey, _model) {
13
+ try {
14
+ switch (provider) {
15
+ case 'openai':
16
+ return await verifyOpenAI(apiKey);
17
+ case 'anthropic':
18
+ return await verifyAnthropic(apiKey);
19
+ case 'google':
20
+ return await verifyGoogle(apiKey);
21
+ case 'groq':
22
+ return await verifyGroq(apiKey);
23
+ case 'xai':
24
+ return await verifyXAI(apiKey);
25
+ case 'cohere':
26
+ return await verifyCohere(apiKey);
27
+ case 'openrouter':
28
+ return await verifyOpenRouter(apiKey);
29
+ case 'glama':
30
+ return await verifyGlama(apiKey);
31
+ case 'openai-compatible':
32
+ case 'litellm':
33
+ // For custom endpoints, we can't verify without a baseURL
34
+ // Just do basic format check
35
+ return { success: true, modelUsed: 'custom' };
36
+ case 'vertex':
37
+ case 'bedrock':
38
+ // These use cloud credentials, not API keys
39
+ // Skip verification
40
+ return { success: true, modelUsed: 'cloud-auth' };
41
+ default:
42
+ // Unknown provider - skip verification
43
+ return { success: true, modelUsed: 'unknown' };
44
+ }
45
+ }
46
+ catch (error) {
47
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
48
+ logger.debug(`API key verification failed for ${provider}: ${errorMessage}`);
49
+ return { success: false, error: errorMessage };
50
+ }
51
+ }
52
+ /**
53
+ * Verify OpenAI API key using the models endpoint
54
+ */
55
+ async function verifyOpenAI(apiKey) {
56
+ const response = await fetch('https://api.openai.com/v1/models', {
57
+ method: 'GET',
58
+ headers: {
59
+ Authorization: `Bearer ${apiKey}`,
60
+ },
61
+ });
62
+ if (response.ok) {
63
+ return { success: true, modelUsed: 'models-list' };
64
+ }
65
+ const error = await parseErrorResponse(response);
66
+ return { success: false, error };
67
+ }
68
+ /**
69
+ * Verify Anthropic API key using a minimal messages request
70
+ */
71
+ async function verifyAnthropic(apiKey) {
72
+ // Anthropic doesn't have a models endpoint, so we make a minimal request
73
+ // that will fail fast if the key is invalid
74
+ const response = await fetch('https://api.anthropic.com/v1/messages', {
75
+ method: 'POST',
76
+ headers: {
77
+ 'Content-Type': 'application/json',
78
+ 'x-api-key': apiKey,
79
+ 'anthropic-version': '2023-06-01',
80
+ },
81
+ body: JSON.stringify({
82
+ model: 'claude-3-5-haiku-20241022',
83
+ max_tokens: 1,
84
+ messages: [{ role: 'user', content: 'hi' }],
85
+ }),
86
+ });
87
+ // 200 = success, 400 = bad request (but key is valid), 401/403 = invalid key
88
+ if (response.ok || response.status === 400) {
89
+ return { success: true, modelUsed: 'claude-3-5-haiku-20241022' };
90
+ }
91
+ const error = await parseErrorResponse(response);
92
+ return { success: false, error };
93
+ }
94
+ /**
95
+ * Verify Google AI API key using the models endpoint
96
+ */
97
+ async function verifyGoogle(apiKey) {
98
+ const response = await fetch(`https://generativelanguage.googleapis.com/v1/models?key=${apiKey}`, {
99
+ method: 'GET',
100
+ });
101
+ if (response.ok) {
102
+ return { success: true, modelUsed: 'models-list' };
103
+ }
104
+ const error = await parseErrorResponse(response);
105
+ return { success: false, error };
106
+ }
107
+ /**
108
+ * Verify Groq API key using the models endpoint
109
+ */
110
+ async function verifyGroq(apiKey) {
111
+ const response = await fetch('https://api.groq.com/openai/v1/models', {
112
+ method: 'GET',
113
+ headers: {
114
+ Authorization: `Bearer ${apiKey}`,
115
+ },
116
+ });
117
+ if (response.ok) {
118
+ return { success: true, modelUsed: 'models-list' };
119
+ }
120
+ const error = await parseErrorResponse(response);
121
+ return { success: false, error };
122
+ }
123
+ /**
124
+ * Verify xAI API key using the models endpoint
125
+ */
126
+ async function verifyXAI(apiKey) {
127
+ const response = await fetch('https://api.x.ai/v1/models', {
128
+ method: 'GET',
129
+ headers: {
130
+ Authorization: `Bearer ${apiKey}`,
131
+ },
132
+ });
133
+ if (response.ok) {
134
+ return { success: true, modelUsed: 'models-list' };
135
+ }
136
+ const error = await parseErrorResponse(response);
137
+ return { success: false, error };
138
+ }
139
+ /**
140
+ * Verify Cohere API key using a check-api-key endpoint or models list
141
+ */
142
+ async function verifyCohere(apiKey) {
143
+ const response = await fetch('https://api.cohere.com/v2/models', {
144
+ method: 'GET',
145
+ headers: {
146
+ Authorization: `Bearer ${apiKey}`,
147
+ },
148
+ });
149
+ if (response.ok) {
150
+ return { success: true, modelUsed: 'models-list' };
151
+ }
152
+ const error = await parseErrorResponse(response);
153
+ return { success: false, error };
154
+ }
155
+ /**
156
+ * Verify OpenRouter API key using the auth endpoint
157
+ */
158
+ async function verifyOpenRouter(apiKey) {
159
+ const response = await fetch('https://openrouter.ai/api/v1/auth/key', {
160
+ method: 'GET',
161
+ headers: {
162
+ Authorization: `Bearer ${apiKey}`,
163
+ },
164
+ });
165
+ if (response.ok) {
166
+ return { success: true, modelUsed: 'auth-check' };
167
+ }
168
+ const error = await parseErrorResponse(response);
169
+ return { success: false, error };
170
+ }
171
+ /**
172
+ * Verify Glama API key using the models endpoint
173
+ */
174
+ async function verifyGlama(apiKey) {
175
+ const response = await fetch('https://glama.ai/api/gateway/openai/v1/models', {
176
+ method: 'GET',
177
+ headers: {
178
+ Authorization: `Bearer ${apiKey}`,
179
+ },
180
+ });
181
+ if (response.ok) {
182
+ return { success: true, modelUsed: 'models-list' };
183
+ }
184
+ const error = await parseErrorResponse(response);
185
+ return { success: false, error };
186
+ }
187
+ /**
188
+ * Parse error response from provider API
189
+ */
190
+ async function parseErrorResponse(response) {
191
+ const status = response.status;
192
+ // Common status codes
193
+ if (status === 401) {
194
+ return 'Invalid API key - authentication failed';
195
+ }
196
+ if (status === 403) {
197
+ return 'API key does not have permission to access this resource';
198
+ }
199
+ if (status === 429) {
200
+ return 'Rate limit exceeded - but API key appears valid';
201
+ }
202
+ // Try to parse JSON error
203
+ try {
204
+ const json = await response.json();
205
+ const message = json.error?.message || json.message || json.detail || JSON.stringify(json);
206
+ return `API error (${status}): ${message}`;
207
+ }
208
+ catch {
209
+ return `API error (${status}): ${response.statusText}`;
210
+ }
211
+ }
@@ -1,8 +1,28 @@
1
- import { type AgentConfig, type ValidatedAgentConfig } from '@dexto/core';
1
+ import { type AgentConfig, type ValidatedAgentConfig, type LLMValidationOptions } from '@dexto/core';
2
+ export interface ValidationResult {
3
+ success: boolean;
4
+ config?: ValidatedAgentConfig;
5
+ errors?: string[];
6
+ skipped?: boolean;
7
+ }
2
8
  /**
3
9
  * Validates agent config with optional interactive fixes for user experience.
4
10
  * Uses schema parsing to detect API key issues and provides targeted setup.
5
11
  * Returns validated config with all defaults applied.
12
+ *
13
+ * IMPORTANT: This function NEVER exits the process. It always returns a result
14
+ * that allows the caller to decide what to do next.
15
+ *
16
+ * @param config - The agent configuration to validate
17
+ * @param interactive - Whether to allow interactive prompts to fix issues
18
+ * @param validationOptions - Validation strictness options
19
+ * @param validationOptions.strict - When true (default), enforces API key requirements.
20
+ * When false, allows missing credentials for interactive config.
6
21
  */
7
- export declare function validateAgentConfig(config: AgentConfig, interactive?: boolean): Promise<ValidatedAgentConfig>;
22
+ export declare function validateAgentConfig(config: AgentConfig, interactive?: boolean, validationOptions?: LLMValidationOptions): Promise<ValidationResult>;
23
+ /**
24
+ * Legacy function for backwards compatibility
25
+ * @deprecated Use validateAgentConfig with result handling instead
26
+ */
27
+ export declare function validateAgentConfigOrExit(config: AgentConfig, interactive?: boolean): Promise<ValidatedAgentConfig>;
8
28
  //# sourceMappingURL=config-validation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config-validation.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/config-validation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAqB,KAAK,WAAW,EAAE,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAM7F;;;;GAIG;AACH,wBAAsB,mBAAmB,CACrC,MAAM,EAAE,WAAW,EACnB,WAAW,GAAE,OAAe,GAC7B,OAAO,CAAC,oBAAoB,CAAC,CAiC/B"}
1
+ {"version":3,"file":"config-validation.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/config-validation.ts"],"names":[],"mappings":"AAGA,OAAO,EAGH,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAC5B,MAAM,aAAa,CAAC;AAWrB,MAAM,WAAW,gBAAgB;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,mBAAmB,CACrC,MAAM,EAAE,WAAW,EACnB,WAAW,GAAE,OAAe,EAC5B,iBAAiB,CAAC,EAAE,oBAAoB,GACzC,OAAO,CAAC,gBAAgB,CAAC,CAyC3B;AAwZD;;;GAGG;AACH,wBAAsB,yBAAyB,CAC3C,MAAM,EAAE,WAAW,EACnB,WAAW,GAAE,OAAe,GAC7B,OAAO,CAAC,oBAAoB,CAAC,CAgC/B"}
@@ -1,37 +1,312 @@
1
1
  import chalk from 'chalk';
2
- import { AgentConfigSchema } from '@dexto/core';
2
+ import * as p from '@clack/prompts';
3
+ import { AgentConfigSchema, createAgentConfigSchema, } from '@dexto/core';
3
4
  import { interactiveApiKeySetup } from './api-key-setup.js';
4
5
  import { LLMErrorCode } from '@dexto/core';
5
6
  import { logger } from '@dexto/core';
7
+ import { getGlobalPreferencesPath, loadGlobalPreferences, saveGlobalPreferences, } from '@dexto/agent-management';
6
8
  /**
7
9
  * Validates agent config with optional interactive fixes for user experience.
8
10
  * Uses schema parsing to detect API key issues and provides targeted setup.
9
11
  * Returns validated config with all defaults applied.
12
+ *
13
+ * IMPORTANT: This function NEVER exits the process. It always returns a result
14
+ * that allows the caller to decide what to do next.
15
+ *
16
+ * @param config - The agent configuration to validate
17
+ * @param interactive - Whether to allow interactive prompts to fix issues
18
+ * @param validationOptions - Validation strictness options
19
+ * @param validationOptions.strict - When true (default), enforces API key requirements.
20
+ * When false, allows missing credentials for interactive config.
10
21
  */
11
- export async function validateAgentConfig(config, interactive = false) {
22
+ export async function validateAgentConfig(config, interactive = false, validationOptions) {
23
+ // Use appropriate schema based on validation options
24
+ // Default to strict validation unless explicitly relaxed
25
+ const schema = validationOptions?.strict === false
26
+ ? createAgentConfigSchema({ strict: false })
27
+ : AgentConfigSchema;
12
28
  // Parse with schema to detect issues
13
- const parseResult = AgentConfigSchema.safeParse(config);
14
- if (!parseResult.success) {
15
- // Check for API key validation errors using raw Zod error (preserves params)
16
- logger.error(`Agent config validation error: ${JSON.stringify(parseResult.error)}`);
17
- const apiKeyError = findApiKeyError(parseResult.error, config);
18
- if (apiKeyError && interactive) {
19
- logger.debug(`API key error found for ${apiKeyError.provider} provider, retriggering interactive setup`);
20
- console.log(chalk.yellow(`\n🔑 API key required for ${apiKeyError.provider} provider\n`));
21
- // Run interactive setup for the specific provider that failed
22
- // Function will exit process if user cancels, otherwise continues
23
- // Environment variables are automatically reloaded after API key setup
24
- await interactiveApiKeySetup(apiKeyError.provider);
25
- // Same config, but EnvExpandedString will now find the API key
26
- return validateAgentConfig(config, interactive);
29
+ const parseResult = schema.safeParse(config);
30
+ if (parseResult.success) {
31
+ return { success: true, config: parseResult.data };
32
+ }
33
+ // Validation failed - handle based on mode
34
+ logger.debug(`Agent config validation error: ${JSON.stringify(parseResult.error)}`);
35
+ const errors = formatZodErrors(parseResult.error);
36
+ if (!interactive) {
37
+ // Non-interactive mode: show errors and next steps, but don't exit
38
+ showValidationErrors(errors);
39
+ showNextSteps();
40
+ return { success: false, errors };
41
+ }
42
+ // Interactive mode: try to help the user fix the issue
43
+ // Check for API key errors first
44
+ const apiKeyError = findApiKeyError(parseResult.error, config);
45
+ if (apiKeyError) {
46
+ return await handleApiKeyError(apiKeyError.provider, config, errors, validationOptions);
47
+ }
48
+ // Check for baseURL errors next
49
+ const baseURLError = findBaseURLError(parseResult.error, config);
50
+ if (baseURLError) {
51
+ return await handleBaseURLError(baseURLError.provider, config, errors, validationOptions);
52
+ }
53
+ // Other validation errors - show options
54
+ return await handleOtherErrors(errors);
55
+ }
56
+ /**
57
+ * Handle API key validation errors interactively
58
+ */
59
+ async function handleApiKeyError(provider, config, errors, validationOptions) {
60
+ console.log(chalk.rgb(255, 165, 0)(`\n🔑 API key issue detected for ${provider} provider\n`));
61
+ const action = await p.select({
62
+ message: 'How would you like to proceed?',
63
+ options: [
64
+ {
65
+ value: 'setup',
66
+ label: 'Set up API key now',
67
+ hint: 'Configure the API key interactively',
68
+ },
69
+ {
70
+ value: 'skip',
71
+ label: 'Continue anyway',
72
+ hint: 'Try to start without fixing (may fail)',
73
+ },
74
+ {
75
+ value: 'edit',
76
+ label: 'Edit configuration manually',
77
+ hint: 'Show file path and instructions',
78
+ },
79
+ ],
80
+ });
81
+ if (p.isCancel(action)) {
82
+ showNextSteps();
83
+ return { success: false, errors, skipped: true };
84
+ }
85
+ if (action === 'setup') {
86
+ const result = await interactiveApiKeySetup(provider, { exitOnCancel: false });
87
+ if (result.success && !result.skipped) {
88
+ // Retry validation after API key setup
89
+ return validateAgentConfig(config, true, validationOptions);
27
90
  }
28
- // API key error in non-interactive mode or other validation errors
29
- console.error(chalk.red('❌ Configuration Error:'));
30
- formatZodError(parseResult.error);
31
- process.exit(1);
91
+ // Setup was skipped or cancelled - let them continue anyway
92
+ return { success: false, errors, skipped: true };
93
+ }
94
+ if (action === 'edit') {
95
+ showManualEditInstructions();
96
+ return { success: false, errors, skipped: true };
97
+ }
98
+ // 'skip' - continue anyway
99
+ p.log.warn('Continuing with validation errors - some features may not work correctly');
100
+ return { success: false, errors, skipped: true };
101
+ }
102
+ /**
103
+ * Handle baseURL validation errors interactively
104
+ */
105
+ async function handleBaseURLError(provider, config, errors, validationOptions) {
106
+ console.log(chalk.rgb(255, 165, 0)(`\n🌐 Base URL required for ${provider} provider\n`));
107
+ const providerExamples = {
108
+ 'openai-compatible': 'http://localhost:11434/v1 (Ollama)',
109
+ litellm: 'http://localhost:4000 (LiteLLM proxy)',
110
+ };
111
+ const example = providerExamples[provider] || 'http://localhost:8080/v1';
112
+ p.note([
113
+ `The ${provider} provider requires a base URL to connect to your`,
114
+ `local or custom LLM endpoint.`,
115
+ ``,
116
+ `${chalk.gray('Example:')} ${example}`,
117
+ ].join('\n'), 'Base URL Required');
118
+ const action = await p.select({
119
+ message: 'How would you like to proceed?',
120
+ options: [
121
+ {
122
+ value: 'setup',
123
+ label: 'Enter base URL now',
124
+ hint: 'Configure the base URL interactively',
125
+ },
126
+ {
127
+ value: 'skip',
128
+ label: 'Continue anyway',
129
+ hint: 'Try to start without fixing (may fail)',
130
+ },
131
+ {
132
+ value: 'edit',
133
+ label: 'Edit configuration manually',
134
+ hint: 'Show file path and instructions',
135
+ },
136
+ ],
137
+ });
138
+ if (p.isCancel(action)) {
139
+ showNextSteps();
140
+ return { success: false, errors, skipped: true };
141
+ }
142
+ if (action === 'setup') {
143
+ const result = await interactiveBaseURLSetup(provider, config.llm?.baseURL);
144
+ if (result.success && !result.skipped && result.baseURL && config.llm) {
145
+ // Update config with the new baseURL for retry validation
146
+ const updatedConfig = {
147
+ ...config,
148
+ llm: { ...config.llm, baseURL: result.baseURL },
149
+ };
150
+ // Retry validation after baseURL setup
151
+ return validateAgentConfig(updatedConfig, true, validationOptions);
152
+ }
153
+ // Setup was skipped or cancelled
154
+ return { success: false, errors, skipped: true };
155
+ }
156
+ if (action === 'edit') {
157
+ showManualEditInstructions();
158
+ return { success: false, errors, skipped: true };
159
+ }
160
+ // 'skip' - continue anyway
161
+ p.log.warn('Continuing with validation errors - some features may not work correctly');
162
+ return { success: false, errors, skipped: true };
163
+ }
164
+ /**
165
+ * Interactive baseURL setup
166
+ */
167
+ async function interactiveBaseURLSetup(provider, existingBaseURL) {
168
+ const providerDefaults = {
169
+ 'openai-compatible': 'http://localhost:11434/v1',
170
+ litellm: 'http://localhost:4000',
171
+ };
172
+ // Use existing baseURL if available, otherwise fall back to provider defaults
173
+ const defaultURL = existingBaseURL || providerDefaults[provider] || '';
174
+ const baseURL = await p.text({
175
+ message: `Enter base URL for ${provider}`,
176
+ placeholder: defaultURL,
177
+ initialValue: defaultURL,
178
+ validate: (value) => {
179
+ if (!value.trim()) {
180
+ return 'Base URL is required';
181
+ }
182
+ try {
183
+ new URL(value.trim());
184
+ return undefined;
185
+ }
186
+ catch {
187
+ return 'Please enter a valid URL (e.g., http://localhost:11434/v1)';
188
+ }
189
+ },
190
+ });
191
+ if (p.isCancel(baseURL)) {
192
+ p.log.warn('Skipping base URL setup. You can configure it later with: dexto setup');
193
+ return { success: false, skipped: true };
194
+ }
195
+ const trimmedURL = baseURL.trim();
196
+ // Save to preferences
197
+ const spinner = p.spinner();
198
+ spinner.start('Saving base URL to preferences...');
199
+ try {
200
+ const preferences = await loadGlobalPreferences();
201
+ // Update the LLM section with baseURL (complete replacement as per schema design)
202
+ const updatedPreferences = {
203
+ ...preferences,
204
+ llm: {
205
+ ...preferences.llm,
206
+ baseURL: trimmedURL,
207
+ },
208
+ };
209
+ await saveGlobalPreferences(updatedPreferences);
210
+ spinner.stop(chalk.green('✓ Base URL saved to preferences'));
211
+ return { success: true, baseURL: trimmedURL };
212
+ }
213
+ catch (error) {
214
+ spinner.stop(chalk.red('✗ Failed to save base URL'));
215
+ logger.error(`Failed to save baseURL: ${error instanceof Error ? error.message : String(error)}`);
216
+ // Show manual instructions
217
+ p.note([
218
+ `Add this to your preferences file:`,
219
+ ``,
220
+ ` ${chalk.cyan('baseURL:')} ${trimmedURL}`,
221
+ ``,
222
+ `File: ${getGlobalPreferencesPath()}`,
223
+ ].join('\n'), chalk.rgb(255, 165, 0)('Manual Setup Required'));
224
+ // Still return success with the URL for in-memory use
225
+ return { success: true, baseURL: trimmedURL, skipped: true };
226
+ }
227
+ }
228
+ /**
229
+ * Handle non-API-key validation errors interactively
230
+ */
231
+ async function handleOtherErrors(errors) {
232
+ console.log(chalk.rgb(255, 165, 0)('\n⚠️ Configuration issues detected:\n'));
233
+ for (const error of errors) {
234
+ console.log(chalk.red(` • ${error}`));
235
+ }
236
+ console.log('');
237
+ const action = await p.select({
238
+ message: 'How would you like to proceed?',
239
+ options: [
240
+ {
241
+ value: 'skip',
242
+ label: 'Continue anyway',
243
+ hint: 'Try to start despite errors (may fail)',
244
+ },
245
+ {
246
+ value: 'edit',
247
+ label: 'Edit configuration manually',
248
+ hint: 'Show file path and instructions',
249
+ },
250
+ {
251
+ value: 'setup',
252
+ label: 'Run setup again',
253
+ hint: 'Reconfigure from scratch',
254
+ },
255
+ ],
256
+ });
257
+ if (p.isCancel(action)) {
258
+ showNextSteps();
259
+ return { success: false, errors, skipped: true };
260
+ }
261
+ if (action === 'edit') {
262
+ showManualEditInstructions();
263
+ return { success: false, errors, skipped: true };
32
264
  }
33
- // Return the validated config
34
- return parseResult.data;
265
+ if (action === 'setup') {
266
+ p.log.info('Run: dexto setup --force');
267
+ return { success: false, errors, skipped: true };
268
+ }
269
+ // 'skip' - continue anyway
270
+ p.log.warn('Continuing with validation errors - some features may not work correctly');
271
+ return { success: false, errors, skipped: true };
272
+ }
273
+ /**
274
+ * Show validation errors in a user-friendly way
275
+ */
276
+ function showValidationErrors(errors) {
277
+ console.log(chalk.rgb(255, 165, 0)('\n⚠️ Configuration issues detected:\n'));
278
+ for (const error of errors) {
279
+ console.log(chalk.red(` • ${error}`));
280
+ }
281
+ console.log('');
282
+ }
283
+ /**
284
+ * Show next steps after validation failure
285
+ */
286
+ function showNextSteps() {
287
+ const prefsPath = getGlobalPreferencesPath();
288
+ console.log(chalk.bold('\nNext steps:'));
289
+ console.log(` • Run ${chalk.cyan('dexto setup')} to reconfigure interactively`);
290
+ console.log(` • Edit ${chalk.cyan(prefsPath)} directly`);
291
+ console.log(` • Check your environment variables\n`);
292
+ }
293
+ /**
294
+ * Show manual edit instructions
295
+ */
296
+ function showManualEditInstructions() {
297
+ const prefsPath = getGlobalPreferencesPath();
298
+ p.note([
299
+ `Your configuration files:`,
300
+ ``,
301
+ ` ${chalk.cyan('Global preferences:')} ${prefsPath}`,
302
+ ` ${chalk.cyan('Agent configs:')} ~/.dexto/agents/*/`,
303
+ ``,
304
+ `Edit the appropriate file and run dexto again.`,
305
+ ``,
306
+ chalk.gray('Example commands:'),
307
+ chalk.gray(` code ${prefsPath} # Open in VS Code`),
308
+ chalk.gray(` nano ${prefsPath} # Edit in terminal`),
309
+ ].join('\n'), 'Manual Configuration');
35
310
  }
36
311
  /**
37
312
  * Extract API key error details from Zod validation error
@@ -56,6 +331,28 @@ function findApiKeyError(error, configData) {
56
331
  }
57
332
  return null;
58
333
  }
334
+ /**
335
+ * Extract baseURL error details from Zod validation error
336
+ */
337
+ function findBaseURLError(error, configData) {
338
+ for (const issue of error.issues) {
339
+ // Check for our custom BASE_URL_MISSING error code in params
340
+ if (issue.code === 'custom' && hasErrorCode(issue.params, LLMErrorCode.BASE_URL_MISSING)) {
341
+ const provider = getProviderFromParams(issue.params) || configData.llm?.provider;
342
+ if (provider) {
343
+ return { provider };
344
+ }
345
+ }
346
+ // Fallback: check for baseURL path errors
347
+ if (issue.path.includes('baseURL') && issue.message.includes('requires')) {
348
+ const provider = configData.llm?.provider;
349
+ if (provider) {
350
+ return { provider };
351
+ }
352
+ }
353
+ }
354
+ return null;
355
+ }
59
356
  /**
60
357
  * Type guard to check if params contains the expected error code
61
358
  */
@@ -80,9 +377,41 @@ function getProviderFromParams(params) {
80
377
  /**
81
378
  * Format Zod validation errors in a user-friendly way
82
379
  */
83
- function formatZodError(error) {
84
- for (const issue of error.issues) {
380
+ function formatZodErrors(error) {
381
+ return error.issues.map((issue) => {
85
382
  const path = issue.path.length > 0 ? issue.path.join('.') : 'config';
86
- console.error(chalk.red(` • ${path}: ${issue.message}`));
383
+ return `${path}: ${issue.message}`;
384
+ });
385
+ }
386
+ /**
387
+ * Legacy function for backwards compatibility
388
+ * @deprecated Use validateAgentConfig with result handling instead
389
+ */
390
+ export async function validateAgentConfigOrExit(config, interactive = false) {
391
+ const result = await validateAgentConfig(config, interactive);
392
+ if (result.success && result.config) {
393
+ return result.config;
394
+ }
395
+ // If validation failed but was skipped, return config as-is with defaults applied
396
+ // This allows the app to launch in a limited capacity (e.g., web UI for configuration)
397
+ // Runtime errors will occur when actually trying to use the LLM
398
+ if (result.skipped) {
399
+ logger.warn('Starting with validation warnings - some features may not work');
400
+ // Apply defaults manually without strict validation
401
+ // This allows launching web UI for interactive configuration
402
+ // Use unknown cast to bypass branded type checking since we're intentionally
403
+ // returning a partially valid config that the user acknowledged
404
+ const configWithDefaults = {
405
+ ...config,
406
+ llm: {
407
+ ...config.llm,
408
+ maxIterations: config.llm?.maxIterations ?? 50,
409
+ },
410
+ };
411
+ return configWithDefaults;
87
412
  }
413
+ // Last resort: exit with helpful message
414
+ console.log(chalk.rgb(255, 165, 0)('\nUnable to start with current configuration.'));
415
+ showNextSteps();
416
+ process.exit(1);
88
417
  }