dexto 1.3.0 → 1.4.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 (400) hide show
  1. package/README.md +25 -15
  2. package/dist/agents/agent-registry.json +9 -0
  3. package/dist/agents/coding-agent/coding-agent.yml +5 -0
  4. package/dist/agents/default-agent.yml +2 -2
  5. package/dist/api/server-hono.d.ts.map +1 -1
  6. package/dist/api/server-hono.js +39 -5
  7. package/dist/cli/cli-subscriber.d.ts.map +1 -1
  8. package/dist/cli/cli-subscriber.js +7 -1
  9. package/dist/cli/commands/helpers/formatters.d.ts.map +1 -1
  10. package/dist/cli/commands/helpers/formatters.js +2 -1
  11. package/dist/cli/commands/install.d.ts.map +1 -1
  12. package/dist/cli/commands/install.js +14 -40
  13. package/dist/cli/commands/interactive-commands/command-parser.d.ts +17 -14
  14. package/dist/cli/commands/interactive-commands/command-parser.d.ts.map +1 -1
  15. package/dist/cli/commands/interactive-commands/command-parser.js +0 -15
  16. package/dist/cli/commands/interactive-commands/commands.d.ts +4 -4
  17. package/dist/cli/commands/interactive-commands/commands.d.ts.map +1 -1
  18. package/dist/cli/commands/interactive-commands/commands.js +34 -42
  19. package/dist/cli/commands/interactive-commands/documentation-commands.d.ts.map +1 -1
  20. package/dist/cli/commands/interactive-commands/documentation-commands.js +4 -7
  21. package/dist/cli/commands/interactive-commands/general-commands.d.ts.map +1 -1
  22. package/dist/cli/commands/interactive-commands/general-commands.js +159 -117
  23. package/dist/cli/commands/interactive-commands/mcp/index.d.ts +9 -3
  24. package/dist/cli/commands/interactive-commands/mcp/index.d.ts.map +1 -1
  25. package/dist/cli/commands/interactive-commands/mcp/index.js +18 -3
  26. package/dist/cli/commands/interactive-commands/model/index.d.ts +8 -6
  27. package/dist/cli/commands/interactive-commands/model/index.d.ts.map +1 -1
  28. package/dist/cli/commands/interactive-commands/model/index.js +18 -6
  29. package/dist/cli/commands/interactive-commands/prompt-commands.d.ts +3 -2
  30. package/dist/cli/commands/interactive-commands/prompt-commands.d.ts.map +1 -1
  31. package/dist/cli/commands/interactive-commands/prompt-commands.js +69 -52
  32. package/dist/cli/commands/interactive-commands/session/index.d.ts +7 -12
  33. package/dist/cli/commands/interactive-commands/session/index.d.ts.map +1 -1
  34. package/dist/cli/commands/interactive-commands/session/index.js +7 -14
  35. package/dist/cli/commands/interactive-commands/session/session-commands.d.ts +10 -24
  36. package/dist/cli/commands/interactive-commands/session/session-commands.d.ts.map +1 -1
  37. package/dist/cli/commands/interactive-commands/session/session-commands.js +16 -371
  38. package/dist/cli/commands/interactive-commands/system/system-commands.d.ts +1 -0
  39. package/dist/cli/commands/interactive-commands/system/system-commands.d.ts.map +1 -1
  40. package/dist/cli/commands/interactive-commands/system/system-commands.js +103 -74
  41. package/dist/cli/commands/interactive-commands/tool-commands.d.ts +1 -1
  42. package/dist/cli/commands/interactive-commands/tool-commands.d.ts.map +1 -1
  43. package/dist/cli/commands/interactive-commands/tool-commands.js +5 -62
  44. package/dist/cli/commands/interactive-commands/utils/command-output.d.ts +13 -17
  45. package/dist/cli/commands/interactive-commands/utils/command-output.d.ts.map +1 -1
  46. package/dist/cli/commands/interactive-commands/utils/command-output.js +18 -37
  47. package/dist/cli/commands/list-agents.d.ts +2 -2
  48. package/dist/cli/commands/list-agents.d.ts.map +1 -1
  49. package/dist/cli/commands/list-agents.js +36 -32
  50. package/dist/cli/commands/uninstall.d.ts.map +1 -1
  51. package/dist/cli/commands/uninstall.js +4 -6
  52. package/dist/cli/commands/which.d.ts.map +1 -1
  53. package/dist/cli/commands/which.js +17 -3
  54. package/dist/cli/ink-cli/InkCLIRefactored.d.ts +9 -22
  55. package/dist/cli/ink-cli/InkCLIRefactored.d.ts.map +1 -1
  56. package/dist/cli/ink-cli/InkCLIRefactored.js +50 -133
  57. package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts +24 -3
  58. package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts.map +1 -1
  59. package/dist/cli/ink-cli/components/ApprovalPrompt.js +160 -45
  60. package/dist/cli/ink-cli/components/ElicitationForm.d.ts +22 -0
  61. package/dist/cli/ink-cli/components/ElicitationForm.d.ts.map +1 -0
  62. package/dist/cli/ink-cli/components/ElicitationForm.js +358 -0
  63. package/dist/cli/ink-cli/components/Footer.d.ts +16 -0
  64. package/dist/cli/ink-cli/components/Footer.d.ts.map +1 -0
  65. package/dist/cli/ink-cli/components/Footer.js +27 -0
  66. package/dist/cli/ink-cli/components/HistorySearchBar.d.ts +17 -0
  67. package/dist/cli/ink-cli/components/HistorySearchBar.d.ts.map +1 -0
  68. package/dist/cli/ink-cli/components/HistorySearchBar.js +8 -0
  69. package/dist/cli/ink-cli/components/ResourceAutocomplete.d.ts +15 -2
  70. package/dist/cli/ink-cli/components/ResourceAutocomplete.d.ts.map +1 -1
  71. package/dist/cli/ink-cli/components/ResourceAutocomplete.js +126 -82
  72. package/dist/cli/ink-cli/components/SlashCommandAutocomplete.d.ts +15 -2
  73. package/dist/cli/ink-cli/components/SlashCommandAutocomplete.d.ts.map +1 -1
  74. package/dist/cli/ink-cli/components/SlashCommandAutocomplete.js +228 -122
  75. package/dist/cli/ink-cli/components/StatusBar.d.ts +15 -2
  76. package/dist/cli/ink-cli/components/StatusBar.d.ts.map +1 -1
  77. package/dist/cli/ink-cli/components/StatusBar.js +46 -8
  78. package/dist/cli/ink-cli/components/TextBufferInput.d.ts +52 -0
  79. package/dist/cli/ink-cli/components/TextBufferInput.d.ts.map +1 -0
  80. package/dist/cli/ink-cli/components/TextBufferInput.js +471 -0
  81. package/dist/cli/ink-cli/components/base/BaseSelector.d.ts +11 -1
  82. package/dist/cli/ink-cli/components/base/BaseSelector.d.ts.map +1 -1
  83. package/dist/cli/ink-cli/components/base/BaseSelector.js +90 -49
  84. package/dist/cli/ink-cli/components/chat/Header.d.ts +1 -0
  85. package/dist/cli/ink-cli/components/chat/Header.d.ts.map +1 -1
  86. package/dist/cli/ink-cli/components/chat/Header.js +7 -2
  87. package/dist/cli/ink-cli/components/chat/MessageItem.d.ts +3 -0
  88. package/dist/cli/ink-cli/components/chat/MessageItem.d.ts.map +1 -1
  89. package/dist/cli/ink-cli/components/chat/MessageItem.js +95 -9
  90. package/dist/cli/ink-cli/components/chat/MessageList.js +1 -1
  91. package/dist/cli/ink-cli/components/chat/QueuedMessagesDisplay.d.ts +16 -0
  92. package/dist/cli/ink-cli/components/chat/QueuedMessagesDisplay.d.ts.map +1 -0
  93. package/dist/cli/ink-cli/components/chat/QueuedMessagesDisplay.js +27 -0
  94. package/dist/cli/ink-cli/components/chat/ToolIcon.d.ts +4 -2
  95. package/dist/cli/ink-cli/components/chat/ToolIcon.d.ts.map +1 -1
  96. package/dist/cli/ink-cli/components/chat/ToolIcon.js +19 -5
  97. package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.d.ts +10 -0
  98. package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.d.ts.map +1 -0
  99. package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.js +6 -0
  100. package/dist/cli/ink-cli/components/chat/styled-boxes/HelpBox.d.ts +10 -0
  101. package/dist/cli/ink-cli/components/chat/styled-boxes/HelpBox.d.ts.map +1 -0
  102. package/dist/cli/ink-cli/components/chat/styled-boxes/HelpBox.js +15 -0
  103. package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.d.ts +10 -0
  104. package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.d.ts.map +1 -0
  105. package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.js +9 -0
  106. package/dist/cli/ink-cli/components/chat/styled-boxes/SessionHistoryBox.d.ts +10 -0
  107. package/dist/cli/ink-cli/components/chat/styled-boxes/SessionHistoryBox.d.ts.map +1 -0
  108. package/dist/cli/ink-cli/components/chat/styled-boxes/SessionHistoryBox.js +37 -0
  109. package/dist/cli/ink-cli/components/chat/styled-boxes/SessionListBox.d.ts +10 -0
  110. package/dist/cli/ink-cli/components/chat/styled-boxes/SessionListBox.d.ts.map +1 -0
  111. package/dist/cli/ink-cli/components/chat/styled-boxes/SessionListBox.js +9 -0
  112. package/dist/cli/ink-cli/components/chat/styled-boxes/ShortcutsBox.d.ts +10 -0
  113. package/dist/cli/ink-cli/components/chat/styled-boxes/ShortcutsBox.d.ts.map +1 -0
  114. package/dist/cli/ink-cli/components/chat/styled-boxes/ShortcutsBox.js +6 -0
  115. package/dist/cli/ink-cli/components/chat/styled-boxes/StatsBox.d.ts +10 -0
  116. package/dist/cli/ink-cli/components/chat/styled-boxes/StatsBox.d.ts.map +1 -0
  117. package/dist/cli/ink-cli/components/chat/styled-boxes/StatsBox.js +29 -0
  118. package/dist/cli/ink-cli/components/chat/styled-boxes/StyledBox.d.ts +45 -0
  119. package/dist/cli/ink-cli/components/chat/styled-boxes/StyledBox.d.ts.map +1 -0
  120. package/dist/cli/ink-cli/components/chat/styled-boxes/StyledBox.js +38 -0
  121. package/dist/cli/ink-cli/components/chat/styled-boxes/SyspromptBox.d.ts +10 -0
  122. package/dist/cli/ink-cli/components/chat/styled-boxes/SyspromptBox.d.ts.map +1 -0
  123. package/dist/cli/ink-cli/components/chat/styled-boxes/SyspromptBox.js +6 -0
  124. package/dist/cli/ink-cli/components/chat/styled-boxes/index.d.ts +13 -0
  125. package/dist/cli/ink-cli/components/chat/styled-boxes/index.d.ts.map +1 -0
  126. package/dist/cli/ink-cli/components/chat/styled-boxes/index.js +12 -0
  127. package/dist/cli/ink-cli/components/input/InputArea.d.ts +36 -8
  128. package/dist/cli/ink-cli/components/input/InputArea.d.ts.map +1 -1
  129. package/dist/cli/ink-cli/components/input/InputArea.js +3 -3
  130. package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.d.ts +25 -0
  131. package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.d.ts.map +1 -0
  132. package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.js +166 -0
  133. package/dist/cli/ink-cli/components/modes/StaticCLI.d.ts +27 -0
  134. package/dist/cli/ink-cli/components/modes/StaticCLI.d.ts.map +1 -0
  135. package/dist/cli/ink-cli/components/modes/StaticCLI.js +95 -0
  136. package/dist/cli/ink-cli/components/modes/index.d.ts +10 -0
  137. package/dist/cli/ink-cli/components/modes/index.d.ts.map +1 -0
  138. package/dist/cli/ink-cli/components/modes/index.js +9 -0
  139. package/dist/cli/ink-cli/components/overlays/ApiKeyInput.d.ts +26 -0
  140. package/dist/cli/ink-cli/components/overlays/ApiKeyInput.d.ts.map +1 -0
  141. package/dist/cli/ink-cli/components/overlays/ApiKeyInput.js +92 -0
  142. package/dist/cli/ink-cli/components/overlays/CustomModelWizard.d.ts +21 -0
  143. package/dist/cli/ink-cli/components/overlays/CustomModelWizard.d.ts.map +1 -0
  144. package/dist/cli/ink-cli/components/overlays/CustomModelWizard.js +177 -0
  145. package/dist/cli/ink-cli/components/overlays/LogLevelSelector.d.ts +22 -0
  146. package/dist/cli/ink-cli/components/overlays/LogLevelSelector.d.ts.map +1 -0
  147. package/dist/cli/ink-cli/components/overlays/LogLevelSelector.js +59 -0
  148. package/dist/cli/ink-cli/components/overlays/McpAddChoice.d.ts +22 -0
  149. package/dist/cli/ink-cli/components/overlays/McpAddChoice.d.ts.map +1 -0
  150. package/dist/cli/ink-cli/components/overlays/McpAddChoice.js +59 -0
  151. package/dist/cli/ink-cli/components/overlays/McpAddSelector.d.ts +26 -0
  152. package/dist/cli/ink-cli/components/overlays/McpAddSelector.d.ts.map +1 -0
  153. package/dist/cli/ink-cli/components/overlays/McpAddSelector.js +73 -0
  154. package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.d.ts +21 -0
  155. package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.d.ts.map +1 -0
  156. package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.js +51 -0
  157. package/dist/cli/ink-cli/components/overlays/McpCustomWizard.d.ts +29 -0
  158. package/dist/cli/ink-cli/components/overlays/McpCustomWizard.d.ts.map +1 -0
  159. package/dist/cli/ink-cli/components/overlays/McpCustomWizard.js +215 -0
  160. package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.d.ts +22 -0
  161. package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.d.ts.map +1 -0
  162. package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.js +74 -0
  163. package/dist/cli/ink-cli/components/overlays/McpSelector.d.ts +21 -0
  164. package/dist/cli/ink-cli/components/overlays/McpSelector.d.ts.map +1 -0
  165. package/dist/cli/ink-cli/components/overlays/McpSelector.js +52 -0
  166. package/dist/cli/ink-cli/components/overlays/McpServerActions.d.ts +28 -0
  167. package/dist/cli/ink-cli/components/overlays/McpServerActions.d.ts.map +1 -0
  168. package/dist/cli/ink-cli/components/overlays/McpServerActions.js +84 -0
  169. package/dist/cli/ink-cli/components/overlays/McpServerList.d.ts +29 -0
  170. package/dist/cli/ink-cli/components/overlays/McpServerList.d.ts.map +1 -0
  171. package/dist/cli/ink-cli/components/overlays/McpServerList.js +109 -0
  172. package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts +15 -8
  173. package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts.map +1 -1
  174. package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.js +247 -24
  175. package/dist/cli/ink-cli/components/overlays/PromptAddChoice.d.ts +22 -0
  176. package/dist/cli/ink-cli/components/overlays/PromptAddChoice.d.ts.map +1 -0
  177. package/dist/cli/ink-cli/components/overlays/PromptAddChoice.js +52 -0
  178. package/dist/cli/ink-cli/components/overlays/PromptAddWizard.d.ts +29 -0
  179. package/dist/cli/ink-cli/components/overlays/PromptAddWizard.d.ts.map +1 -0
  180. package/dist/cli/ink-cli/components/overlays/PromptAddWizard.js +166 -0
  181. package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.d.ts +27 -0
  182. package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.d.ts.map +1 -0
  183. package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.js +119 -0
  184. package/dist/cli/ink-cli/components/overlays/PromptList.d.ts +33 -0
  185. package/dist/cli/ink-cli/components/overlays/PromptList.d.ts.map +1 -0
  186. package/dist/cli/ink-cli/components/overlays/PromptList.js +144 -0
  187. package/dist/cli/ink-cli/components/overlays/SearchOverlay.d.ts +23 -0
  188. package/dist/cli/ink-cli/components/overlays/SearchOverlay.d.ts.map +1 -0
  189. package/dist/cli/ink-cli/components/overlays/SearchOverlay.js +189 -0
  190. package/dist/cli/ink-cli/components/overlays/SessionSelectorRefactored.d.ts +7 -2
  191. package/dist/cli/ink-cli/components/overlays/SessionSelectorRefactored.d.ts.map +1 -1
  192. package/dist/cli/ink-cli/components/overlays/SessionSelectorRefactored.js +19 -5
  193. package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.d.ts +21 -0
  194. package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.d.ts.map +1 -0
  195. package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.js +42 -0
  196. package/dist/cli/ink-cli/components/overlays/StreamSelector.d.ts +20 -0
  197. package/dist/cli/ink-cli/components/overlays/StreamSelector.d.ts.map +1 -0
  198. package/dist/cli/ink-cli/components/overlays/StreamSelector.js +58 -0
  199. package/dist/cli/ink-cli/components/overlays/ToolBrowser.d.ts +25 -0
  200. package/dist/cli/ink-cli/components/overlays/ToolBrowser.d.ts.map +1 -0
  201. package/dist/cli/ink-cli/components/overlays/ToolBrowser.js +400 -0
  202. package/dist/cli/ink-cli/components/renderers/DiffRenderer.d.ts +21 -0
  203. package/dist/cli/ink-cli/components/renderers/DiffRenderer.d.ts.map +1 -0
  204. package/dist/cli/ink-cli/components/renderers/DiffRenderer.js +65 -0
  205. package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.d.ts +28 -0
  206. package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.d.ts.map +1 -0
  207. package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.js +66 -0
  208. package/dist/cli/ink-cli/components/renderers/FileRenderer.d.ts +19 -0
  209. package/dist/cli/ink-cli/components/renderers/FileRenderer.d.ts.map +1 -0
  210. package/dist/cli/ink-cli/components/renderers/FileRenderer.js +26 -0
  211. package/dist/cli/ink-cli/components/renderers/GenericRenderer.d.ts +21 -0
  212. package/dist/cli/ink-cli/components/renderers/GenericRenderer.d.ts.map +1 -0
  213. package/dist/cli/ink-cli/components/renderers/GenericRenderer.js +26 -0
  214. package/dist/cli/ink-cli/components/renderers/SearchRenderer.d.ts +20 -0
  215. package/dist/cli/ink-cli/components/renderers/SearchRenderer.d.ts.map +1 -0
  216. package/dist/cli/ink-cli/components/renderers/SearchRenderer.js +12 -0
  217. package/dist/cli/ink-cli/components/renderers/ShellRenderer.d.ts +21 -0
  218. package/dist/cli/ink-cli/components/renderers/ShellRenderer.d.ts.map +1 -0
  219. package/dist/cli/ink-cli/components/renderers/ShellRenderer.js +25 -0
  220. package/dist/cli/ink-cli/components/renderers/diff-shared.d.ts +61 -0
  221. package/dist/cli/ink-cli/components/renderers/diff-shared.d.ts.map +1 -0
  222. package/dist/cli/ink-cli/components/renderers/diff-shared.js +158 -0
  223. package/dist/cli/ink-cli/components/renderers/index.d.ts +28 -0
  224. package/dist/cli/ink-cli/components/renderers/index.d.ts.map +1 -0
  225. package/dist/cli/ink-cli/components/renderers/index.js +36 -0
  226. package/dist/cli/ink-cli/components/shared/MarkdownText.d.ts +38 -0
  227. package/dist/cli/ink-cli/components/shared/MarkdownText.d.ts.map +1 -0
  228. package/dist/cli/ink-cli/components/shared/MarkdownText.js +360 -0
  229. package/dist/cli/ink-cli/components/shared/VirtualizedList.d.ts +44 -0
  230. package/dist/cli/ink-cli/components/shared/VirtualizedList.d.ts.map +1 -0
  231. package/dist/cli/ink-cli/components/shared/VirtualizedList.js +300 -0
  232. package/dist/cli/ink-cli/components/shared/text-buffer.d.ts +185 -0
  233. package/dist/cli/ink-cli/components/shared/text-buffer.d.ts.map +1 -0
  234. package/dist/cli/ink-cli/components/shared/text-buffer.js +1338 -0
  235. package/dist/cli/ink-cli/constants/processingPhrases.d.ts +10 -0
  236. package/dist/cli/ink-cli/constants/processingPhrases.d.ts.map +1 -0
  237. package/dist/cli/ink-cli/constants/processingPhrases.js +64 -0
  238. package/dist/cli/ink-cli/constants/tips.d.ts +15 -0
  239. package/dist/cli/ink-cli/constants/tips.d.ts.map +1 -0
  240. package/dist/cli/ink-cli/constants/tips.js +53 -0
  241. package/dist/cli/ink-cli/containers/InputContainer.d.ts +42 -8
  242. package/dist/cli/ink-cli/containers/InputContainer.d.ts.map +1 -1
  243. package/dist/cli/ink-cli/containers/InputContainer.js +491 -85
  244. package/dist/cli/ink-cli/containers/OverlayContainer.d.ts +23 -5
  245. package/dist/cli/ink-cli/containers/OverlayContainer.d.ts.map +1 -1
  246. package/dist/cli/ink-cli/containers/OverlayContainer.js +1156 -130
  247. package/dist/cli/ink-cli/containers/index.d.ts +1 -1
  248. package/dist/cli/ink-cli/containers/index.d.ts.map +1 -1
  249. package/dist/cli/ink-cli/contexts/KeypressContext.d.ts +36 -0
  250. package/dist/cli/ink-cli/contexts/KeypressContext.d.ts.map +1 -0
  251. package/dist/cli/ink-cli/contexts/KeypressContext.js +461 -0
  252. package/dist/cli/ink-cli/contexts/MouseContext.d.ts +27 -0
  253. package/dist/cli/ink-cli/contexts/MouseContext.d.ts.map +1 -0
  254. package/dist/cli/ink-cli/contexts/MouseContext.js +102 -0
  255. package/dist/cli/ink-cli/contexts/ScrollProvider.d.ts +33 -0
  256. package/dist/cli/ink-cli/contexts/ScrollProvider.d.ts.map +1 -0
  257. package/dist/cli/ink-cli/contexts/ScrollProvider.js +170 -0
  258. package/dist/cli/ink-cli/contexts/index.d.ts +7 -0
  259. package/dist/cli/ink-cli/contexts/index.d.ts.map +1 -0
  260. package/dist/cli/ink-cli/contexts/index.js +6 -0
  261. package/dist/cli/ink-cli/hooks/index.d.ts +5 -0
  262. package/dist/cli/ink-cli/hooks/index.d.ts.map +1 -1
  263. package/dist/cli/ink-cli/hooks/index.js +6 -1
  264. package/dist/cli/ink-cli/hooks/useAgentEvents.d.ts +26 -9
  265. package/dist/cli/ink-cli/hooks/useAgentEvents.d.ts.map +1 -1
  266. package/dist/cli/ink-cli/hooks/useAgentEvents.js +86 -198
  267. package/dist/cli/ink-cli/hooks/useBatchedScroll.d.ts +14 -0
  268. package/dist/cli/ink-cli/hooks/useBatchedScroll.d.ts.map +1 -0
  269. package/dist/cli/ink-cli/hooks/useBatchedScroll.js +25 -0
  270. package/dist/cli/ink-cli/hooks/useCLIState.d.ts +50 -0
  271. package/dist/cli/ink-cli/hooks/useCLIState.d.ts.map +1 -0
  272. package/dist/cli/ink-cli/hooks/useCLIState.js +188 -0
  273. package/dist/cli/ink-cli/hooks/useElapsedTime.d.ts +24 -0
  274. package/dist/cli/ink-cli/hooks/useElapsedTime.d.ts.map +1 -0
  275. package/dist/cli/ink-cli/hooks/useElapsedTime.js +69 -0
  276. package/dist/cli/ink-cli/hooks/useHistorySearch.d.ts +61 -0
  277. package/dist/cli/ink-cli/hooks/useHistorySearch.d.ts.map +1 -0
  278. package/dist/cli/ink-cli/hooks/useHistorySearch.js +210 -0
  279. package/dist/cli/ink-cli/hooks/useInputOrchestrator.d.ts +136 -0
  280. package/dist/cli/ink-cli/hooks/useInputOrchestrator.d.ts.map +1 -0
  281. package/dist/cli/ink-cli/hooks/useInputOrchestrator.js +663 -0
  282. package/dist/cli/ink-cli/hooks/useKeyboardShortcuts.d.ts.map +1 -1
  283. package/dist/cli/ink-cli/hooks/useKeyboardShortcuts.js +7 -26
  284. package/dist/cli/ink-cli/hooks/useKeypress.d.ts +18 -0
  285. package/dist/cli/ink-cli/hooks/useKeypress.d.ts.map +1 -0
  286. package/dist/cli/ink-cli/hooks/useKeypress.js +26 -0
  287. package/dist/cli/ink-cli/hooks/usePhraseCycler.d.ts +30 -0
  288. package/dist/cli/ink-cli/hooks/usePhraseCycler.d.ts.map +1 -0
  289. package/dist/cli/ink-cli/hooks/usePhraseCycler.js +68 -0
  290. package/dist/cli/ink-cli/hooks/useStreaming.d.ts +19 -0
  291. package/dist/cli/ink-cli/hooks/useStreaming.d.ts.map +1 -0
  292. package/dist/cli/ink-cli/hooks/useStreaming.js +26 -0
  293. package/dist/cli/ink-cli/hooks/useTerminalSize.d.ts +14 -0
  294. package/dist/cli/ink-cli/hooks/useTerminalSize.d.ts.map +1 -0
  295. package/dist/cli/ink-cli/hooks/useTerminalSize.js +31 -0
  296. package/dist/cli/ink-cli/hooks/useTokenCounter.d.ts +42 -0
  297. package/dist/cli/ink-cli/hooks/useTokenCounter.d.ts.map +1 -0
  298. package/dist/cli/ink-cli/hooks/useTokenCounter.js +96 -0
  299. package/dist/cli/ink-cli/services/CommandService.d.ts +32 -1
  300. package/dist/cli/ink-cli/services/CommandService.d.ts.map +1 -1
  301. package/dist/cli/ink-cli/services/CommandService.js +36 -5
  302. package/dist/cli/ink-cli/services/InputService.d.ts +1 -5
  303. package/dist/cli/ink-cli/services/InputService.d.ts.map +1 -1
  304. package/dist/cli/ink-cli/services/InputService.js +1 -8
  305. package/dist/cli/ink-cli/services/index.d.ts +2 -1
  306. package/dist/cli/ink-cli/services/index.d.ts.map +1 -1
  307. package/dist/cli/ink-cli/services/index.js +2 -1
  308. package/dist/cli/ink-cli/services/processStream.d.ts +69 -0
  309. package/dist/cli/ink-cli/services/processStream.d.ts.map +1 -0
  310. package/dist/cli/ink-cli/services/processStream.js +674 -0
  311. package/dist/cli/ink-cli/state/actions.d.ts +30 -60
  312. package/dist/cli/ink-cli/state/actions.d.ts.map +1 -1
  313. package/dist/cli/ink-cli/state/actions.js +3 -0
  314. package/dist/cli/ink-cli/state/index.d.ts +5 -3
  315. package/dist/cli/ink-cli/state/index.d.ts.map +1 -1
  316. package/dist/cli/ink-cli/state/index.js +4 -3
  317. package/dist/cli/ink-cli/state/initialState.d.ts +4 -3
  318. package/dist/cli/ink-cli/state/initialState.d.ts.map +1 -1
  319. package/dist/cli/ink-cli/state/initialState.js +20 -4
  320. package/dist/cli/ink-cli/state/reducer.d.ts +3 -0
  321. package/dist/cli/ink-cli/state/reducer.d.ts.map +1 -1
  322. package/dist/cli/ink-cli/state/reducer.js +62 -168
  323. package/dist/cli/ink-cli/state/streaming-state.d.ts +27 -0
  324. package/dist/cli/ink-cli/state/streaming-state.d.ts.map +1 -0
  325. package/dist/cli/ink-cli/state/streaming-state.js +39 -0
  326. package/dist/cli/ink-cli/state/types.d.ts +222 -6
  327. package/dist/cli/ink-cli/state/types.d.ts.map +1 -1
  328. package/dist/cli/ink-cli/utils/bracketedPaste.d.ts +22 -0
  329. package/dist/cli/ink-cli/utils/bracketedPaste.d.ts.map +1 -0
  330. package/dist/cli/ink-cli/utils/bracketedPaste.js +27 -0
  331. package/dist/cli/ink-cli/utils/clipboardUtils.d.ts +49 -0
  332. package/dist/cli/ink-cli/utils/clipboardUtils.d.ts.map +1 -0
  333. package/dist/cli/ink-cli/utils/clipboardUtils.js +356 -0
  334. package/dist/cli/ink-cli/utils/commandOverlays.d.ts +33 -0
  335. package/dist/cli/ink-cli/utils/commandOverlays.d.ts.map +1 -0
  336. package/dist/cli/ink-cli/utils/commandOverlays.js +78 -0
  337. package/dist/cli/ink-cli/utils/debugLog.d.ts +38 -0
  338. package/dist/cli/ink-cli/utils/debugLog.d.ts.map +1 -0
  339. package/dist/cli/ink-cli/utils/debugLog.js +66 -0
  340. package/dist/cli/ink-cli/utils/index.d.ts +2 -1
  341. package/dist/cli/ink-cli/utils/index.d.ts.map +1 -1
  342. package/dist/cli/ink-cli/utils/index.js +3 -1
  343. package/dist/cli/ink-cli/utils/input.d.ts +25 -0
  344. package/dist/cli/ink-cli/utils/input.d.ts.map +1 -0
  345. package/dist/cli/ink-cli/utils/input.js +56 -0
  346. package/dist/cli/ink-cli/utils/inputParsing.d.ts +0 -9
  347. package/dist/cli/ink-cli/utils/inputParsing.d.ts.map +1 -1
  348. package/dist/cli/ink-cli/utils/inputParsing.js +0 -27
  349. package/dist/cli/ink-cli/utils/messageFormatting.d.ts +54 -3
  350. package/dist/cli/ink-cli/utils/messageFormatting.d.ts.map +1 -1
  351. package/dist/cli/ink-cli/utils/messageFormatting.js +290 -20
  352. package/dist/cli/ink-cli/utils/mouse.d.ts +61 -0
  353. package/dist/cli/ink-cli/utils/mouse.d.ts.map +1 -0
  354. package/dist/cli/ink-cli/utils/mouse.js +209 -0
  355. package/dist/cli/ink-cli/utils/streamSplitter.d.ts +44 -0
  356. package/dist/cli/ink-cli/utils/streamSplitter.d.ts.map +1 -0
  357. package/dist/cli/ink-cli/utils/streamSplitter.js +154 -0
  358. package/dist/cli/ink-cli/utils/textUtils.d.ts +63 -0
  359. package/dist/cli/ink-cli/utils/textUtils.d.ts.map +1 -0
  360. package/dist/cli/ink-cli/utils/textUtils.js +248 -0
  361. package/dist/cli/ink-cli/utils/toolUtils.d.ts +9 -0
  362. package/dist/cli/ink-cli/utils/toolUtils.d.ts.map +1 -0
  363. package/dist/cli/ink-cli/utils/toolUtils.js +13 -0
  364. package/dist/cli/utils/options.d.ts.map +1 -1
  365. package/dist/cli/utils/options.js +0 -2
  366. package/dist/config/cli-overrides.d.ts +1 -1
  367. package/dist/config/cli-overrides.d.ts.map +1 -1
  368. package/dist/config/cli-overrides.js +5 -10
  369. package/dist/index.js +66 -48
  370. package/dist/utils/agent-helpers.d.ts +95 -0
  371. package/dist/utils/agent-helpers.d.ts.map +1 -0
  372. package/dist/utils/agent-helpers.js +117 -0
  373. package/dist/webui/assets/index-BkwPkZpd.css +1 -0
  374. package/dist/webui/assets/index-D9u1XfyH.js +2025 -0
  375. package/dist/webui/assets/{tanstack-DgxBONJY.js → tanstack-Br79RQ-n.js} +1 -1
  376. package/dist/webui/index.html +3 -3
  377. package/package.json +16 -14
  378. package/dist/cli/commands/interactive-commands/index.d.ts +0 -63
  379. package/dist/cli/commands/interactive-commands/index.d.ts.map +0 -1
  380. package/dist/cli/commands/interactive-commands/index.js +0 -73
  381. package/dist/cli/commands/interactive-commands/mcp/mcp-add-utils.d.ts +0 -34
  382. package/dist/cli/commands/interactive-commands/mcp/mcp-add-utils.d.ts.map +0 -1
  383. package/dist/cli/commands/interactive-commands/mcp/mcp-add-utils.js +0 -178
  384. package/dist/cli/commands/interactive-commands/mcp/mcp-commands.d.ts +0 -9
  385. package/dist/cli/commands/interactive-commands/mcp/mcp-commands.d.ts.map +0 -1
  386. package/dist/cli/commands/interactive-commands/mcp/mcp-commands.js +0 -325
  387. package/dist/cli/commands/interactive-commands/model/model-commands.d.ts +0 -21
  388. package/dist/cli/commands/interactive-commands/model/model-commands.d.ts.map +0 -1
  389. package/dist/cli/commands/interactive-commands/model/model-commands.js +0 -190
  390. package/dist/cli/ink-cli/components/MultiLineTextInput.d.ts +0 -26
  391. package/dist/cli/ink-cli/components/MultiLineTextInput.d.ts.map +0 -1
  392. package/dist/cli/ink-cli/components/MultiLineTextInput.js +0 -220
  393. package/dist/discord/bot.d.ts +0 -4
  394. package/dist/discord/bot.d.ts.map +0 -1
  395. package/dist/discord/bot.js +0 -193
  396. package/dist/telegram/bot.d.ts +0 -5
  397. package/dist/telegram/bot.d.ts.map +0 -1
  398. package/dist/telegram/bot.js +0 -251
  399. package/dist/webui/assets/index-DKq5Xng1.js +0 -687
  400. package/dist/webui/assets/index-D_0_GBu5.css +0 -1
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Containers module exports
3
3
  */
4
- export { InputContainer } from './InputContainer.js';
4
+ export { InputContainer, type InputContainerHandle } from './InputContainer.js';
5
5
  export { OverlayContainer } from './OverlayContainer.js';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cli/ink-cli/containers/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cli/ink-cli/containers/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * KeypressContext
3
+ *
4
+ * Provides keyboard input handling by reading stdin directly.
5
+ * Filters out mouse events before broadcasting to subscribers.
6
+ *
7
+ * This replaces Ink's useInput hook with a custom implementation that:
8
+ * 1. Reads stdin directly for full control over escape sequence parsing
9
+ * 2. Filters out mouse events so they don't interfere with keyboard handlers
10
+ * 3. Handles paste buffering and backslash+enter detection
11
+ */
12
+ import type React from 'react';
13
+ export declare const BACKSLASH_ENTER_TIMEOUT = 5;
14
+ export declare const ESC_TIMEOUT = 50;
15
+ export declare const PASTE_TIMEOUT = 30000;
16
+ export interface Key {
17
+ name: string;
18
+ ctrl: boolean;
19
+ meta: boolean;
20
+ shift: boolean;
21
+ paste: boolean;
22
+ insertable: boolean;
23
+ sequence: string;
24
+ }
25
+ export type KeypressHandler = (key: Key) => void;
26
+ interface KeypressContextValue {
27
+ subscribe: (handler: KeypressHandler) => void;
28
+ unsubscribe: (handler: KeypressHandler) => void;
29
+ }
30
+ export declare function useKeypressContext(): KeypressContextValue;
31
+ export interface KeypressProviderProps {
32
+ children: React.ReactNode;
33
+ }
34
+ export declare function KeypressProvider({ children }: KeypressProviderProps): import("react/jsx-runtime").JSX.Element;
35
+ export {};
36
+ //# sourceMappingURL=KeypressContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeypressContext.d.ts","sourceRoot":"","sources":["../../../../src/cli/ink-cli/contexts/KeypressContext.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,aAAa,QAAS,CAAC;AAmGpC,MAAM,WAAW,GAAG;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;AAEjD,UAAU,oBAAoB;IAC1B,SAAS,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,IAAI,CAAC;IAC9C,WAAW,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,IAAI,CAAC;CACnD;AAID,wBAAgB,kBAAkB,yBAMjC;AAqUD,MAAM,WAAW,qBAAqB;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,wBAAgB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,EAAE,qBAAqB,2CA+CnE"}
@@ -0,0 +1,461 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * KeypressContext
4
+ *
5
+ * Provides keyboard input handling by reading stdin directly.
6
+ * Filters out mouse events before broadcasting to subscribers.
7
+ *
8
+ * This replaces Ink's useInput hook with a custom implementation that:
9
+ * 1. Reads stdin directly for full control over escape sequence parsing
10
+ * 2. Filters out mouse events so they don't interfere with keyboard handlers
11
+ * 3. Handles paste buffering and backslash+enter detection
12
+ */
13
+ import { useStdin } from 'ink';
14
+ import { createContext, useCallback, useContext, useEffect, useRef } from 'react';
15
+ import { ESC, FOCUS_IN, FOCUS_OUT } from '../utils/input.js';
16
+ import { parseMouseEvent } from '../utils/mouse.js';
17
+ export const BACKSLASH_ENTER_TIMEOUT = 5;
18
+ export const ESC_TIMEOUT = 50;
19
+ export const PASTE_TIMEOUT = 30_000;
20
+ // Key name mapping for escape sequences
21
+ const KEY_INFO_MAP = {
22
+ '[200~': { name: 'paste-start' },
23
+ '[201~': { name: 'paste-end' },
24
+ '[[A': { name: 'f1' },
25
+ '[[B': { name: 'f2' },
26
+ '[[C': { name: 'f3' },
27
+ '[[D': { name: 'f4' },
28
+ '[[E': { name: 'f5' },
29
+ '[1~': { name: 'home' },
30
+ '[2~': { name: 'insert' },
31
+ '[3~': { name: 'delete' },
32
+ '[4~': { name: 'end' },
33
+ '[5~': { name: 'pageup' },
34
+ '[6~': { name: 'pagedown' },
35
+ '[7~': { name: 'home' },
36
+ '[8~': { name: 'end' },
37
+ '[11~': { name: 'f1' },
38
+ '[12~': { name: 'f2' },
39
+ '[13~': { name: 'f3' },
40
+ '[14~': { name: 'f4' },
41
+ '[15~': { name: 'f5' },
42
+ '[17~': { name: 'f6' },
43
+ '[18~': { name: 'f7' },
44
+ '[19~': { name: 'f8' },
45
+ '[20~': { name: 'f9' },
46
+ '[21~': { name: 'f10' },
47
+ '[23~': { name: 'f11' },
48
+ '[24~': { name: 'f12' },
49
+ '[A': { name: 'up' },
50
+ '[B': { name: 'down' },
51
+ '[C': { name: 'right' },
52
+ '[D': { name: 'left' },
53
+ '[E': { name: 'clear' },
54
+ '[F': { name: 'end' },
55
+ '[H': { name: 'home' },
56
+ '[P': { name: 'f1' },
57
+ '[Q': { name: 'f2' },
58
+ '[R': { name: 'f3' },
59
+ '[S': { name: 'f4' },
60
+ OA: { name: 'up' },
61
+ OB: { name: 'down' },
62
+ OC: { name: 'right' },
63
+ OD: { name: 'left' },
64
+ OE: { name: 'clear' },
65
+ OF: { name: 'end' },
66
+ OH: { name: 'home' },
67
+ OP: { name: 'f1' },
68
+ OQ: { name: 'f2' },
69
+ OR: { name: 'f3' },
70
+ OS: { name: 'f4' },
71
+ '[[5~': { name: 'pageup' },
72
+ '[[6~': { name: 'pagedown' },
73
+ '[9u': { name: 'tab' },
74
+ '[13u': { name: 'return' },
75
+ '[27u': { name: 'escape' },
76
+ '[127u': { name: 'backspace' },
77
+ '[57414u': { name: 'return' }, // Numpad Enter
78
+ '[a': { name: 'up', shift: true },
79
+ '[b': { name: 'down', shift: true },
80
+ '[c': { name: 'right', shift: true },
81
+ '[d': { name: 'left', shift: true },
82
+ '[e': { name: 'clear', shift: true },
83
+ '[2$': { name: 'insert', shift: true },
84
+ '[3$': { name: 'delete', shift: true },
85
+ '[5$': { name: 'pageup', shift: true },
86
+ '[6$': { name: 'pagedown', shift: true },
87
+ '[7$': { name: 'home', shift: true },
88
+ '[8$': { name: 'end', shift: true },
89
+ '[Z': { name: 'tab', shift: true },
90
+ Oa: { name: 'up', ctrl: true },
91
+ Ob: { name: 'down', ctrl: true },
92
+ Oc: { name: 'right', ctrl: true },
93
+ Od: { name: 'left', ctrl: true },
94
+ Oe: { name: 'clear', ctrl: true },
95
+ '[2^': { name: 'insert', ctrl: true },
96
+ '[3^': { name: 'delete', ctrl: true },
97
+ '[5^': { name: 'pageup', ctrl: true },
98
+ '[6^': { name: 'pagedown', ctrl: true },
99
+ '[7^': { name: 'home', ctrl: true },
100
+ '[8^': { name: 'end', ctrl: true },
101
+ };
102
+ // Mac Alt key character mapping
103
+ const MAC_ALT_KEY_CHARACTER_MAP = {
104
+ '\u222B': 'b', // "∫" back one word
105
+ '\u0192': 'f', // "ƒ" forward one word
106
+ '\u00B5': 'm', // "µ" toggle markup view
107
+ };
108
+ const kUTF16SurrogateThreshold = 0x10000;
109
+ function charLengthAt(str, i) {
110
+ if (str.length <= i)
111
+ return 1;
112
+ const code = str.codePointAt(i);
113
+ return code !== undefined && code >= kUTF16SurrogateThreshold ? 2 : 1;
114
+ }
115
+ const KeypressContext = createContext(undefined);
116
+ export function useKeypressContext() {
117
+ const context = useContext(KeypressContext);
118
+ if (!context) {
119
+ throw new Error('useKeypressContext must be used within a KeypressProvider');
120
+ }
121
+ return context;
122
+ }
123
+ /**
124
+ * Filter out non-keyboard events (mouse, focus) before passing to handler
125
+ */
126
+ function nonKeyboardEventFilter(keypressHandler) {
127
+ return (key) => {
128
+ if (!parseMouseEvent(key.sequence) &&
129
+ key.sequence !== FOCUS_IN &&
130
+ key.sequence !== FOCUS_OUT) {
131
+ keypressHandler(key);
132
+ }
133
+ };
134
+ }
135
+ /**
136
+ * Buffer backslash followed by enter as shift+enter (newline)
137
+ */
138
+ function bufferBackslashEnter(keypressHandler) {
139
+ const bufferer = (function* () {
140
+ while (true) {
141
+ const key = yield;
142
+ if (key == null) {
143
+ continue;
144
+ }
145
+ else if (key.sequence !== '\\') {
146
+ keypressHandler(key);
147
+ continue;
148
+ }
149
+ const timeoutId = setTimeout(() => bufferer.next(null), BACKSLASH_ENTER_TIMEOUT);
150
+ const nextKey = yield;
151
+ clearTimeout(timeoutId);
152
+ if (nextKey === null) {
153
+ keypressHandler(key);
154
+ }
155
+ else if (nextKey.name === 'return') {
156
+ keypressHandler({
157
+ ...nextKey,
158
+ shift: true,
159
+ sequence: '\r',
160
+ });
161
+ }
162
+ else {
163
+ keypressHandler(key);
164
+ keypressHandler(nextKey);
165
+ }
166
+ }
167
+ })();
168
+ bufferer.next(); // Prime the generator
169
+ return (key) => bufferer.next(key);
170
+ }
171
+ /**
172
+ * Buffer paste events between paste-start and paste-end sequences
173
+ */
174
+ function bufferPaste(keypressHandler) {
175
+ const bufferer = (function* () {
176
+ while (true) {
177
+ let key = yield;
178
+ if (key === null) {
179
+ continue;
180
+ }
181
+ else if (key.name !== 'paste-start') {
182
+ keypressHandler(key);
183
+ continue;
184
+ }
185
+ let buffer = '';
186
+ while (true) {
187
+ const timeoutId = setTimeout(() => bufferer.next(null), PASTE_TIMEOUT);
188
+ key = yield;
189
+ clearTimeout(timeoutId);
190
+ if (key === null) {
191
+ // Paste timeout - emit what we have
192
+ break;
193
+ }
194
+ if (key.name === 'paste-end') {
195
+ break;
196
+ }
197
+ buffer += key.sequence;
198
+ }
199
+ if (buffer.length > 0) {
200
+ keypressHandler({
201
+ name: '',
202
+ ctrl: false,
203
+ meta: false,
204
+ shift: false,
205
+ paste: true,
206
+ insertable: true,
207
+ sequence: buffer,
208
+ });
209
+ }
210
+ }
211
+ })();
212
+ bufferer.next(); // Prime the generator
213
+ return (key) => bufferer.next(key);
214
+ }
215
+ /**
216
+ * Create a data listener that parses raw stdin into keypress events
217
+ */
218
+ function createDataListener(keypressHandler) {
219
+ const parser = emitKeys(keypressHandler);
220
+ parser.next(); // Prime the generator
221
+ let timeoutId;
222
+ return (data) => {
223
+ clearTimeout(timeoutId);
224
+ for (const char of data) {
225
+ parser.next(char);
226
+ }
227
+ if (data.length !== 0) {
228
+ timeoutId = setTimeout(() => parser.next(''), ESC_TIMEOUT);
229
+ }
230
+ };
231
+ }
232
+ /**
233
+ * Generator that translates raw keypress characters into key events.
234
+ * Buffers escape sequences until complete or timeout.
235
+ */
236
+ function* emitKeys(keypressHandler) {
237
+ while (true) {
238
+ let ch = yield;
239
+ let sequence = ch;
240
+ let escaped = false;
241
+ let name = undefined;
242
+ let ctrl = false;
243
+ let meta = false;
244
+ let shift = false;
245
+ let code = undefined;
246
+ let insertable = false;
247
+ if (ch === ESC) {
248
+ escaped = true;
249
+ ch = yield;
250
+ sequence += ch;
251
+ if (ch === ESC) {
252
+ ch = yield;
253
+ sequence += ch;
254
+ }
255
+ }
256
+ if (escaped && (ch === 'O' || ch === '[')) {
257
+ // ANSI escape sequence
258
+ code = ch;
259
+ let modifier = 0;
260
+ if (ch === 'O') {
261
+ // ESC O letter or ESC O modifier letter
262
+ ch = yield;
263
+ sequence += ch;
264
+ if (ch >= '0' && ch <= '9') {
265
+ modifier = parseInt(ch, 10) - 1;
266
+ ch = yield;
267
+ sequence += ch;
268
+ }
269
+ code += ch;
270
+ }
271
+ else if (ch === '[') {
272
+ // ESC [ sequences
273
+ ch = yield;
274
+ sequence += ch;
275
+ if (ch === '[') {
276
+ code += ch;
277
+ ch = yield;
278
+ sequence += ch;
279
+ }
280
+ const cmdStart = sequence.length - 1;
281
+ // Collect digits
282
+ while (ch >= '0' && ch <= '9') {
283
+ ch = yield;
284
+ sequence += ch;
285
+ }
286
+ // Handle modifiers
287
+ if (ch === ';') {
288
+ while (ch === ';') {
289
+ ch = yield;
290
+ sequence += ch;
291
+ while (ch >= '0' && ch <= '9') {
292
+ ch = yield;
293
+ sequence += ch;
294
+ }
295
+ }
296
+ }
297
+ else if (ch === '<') {
298
+ // SGR mouse mode - consume until m/M
299
+ ch = yield;
300
+ sequence += ch;
301
+ while (ch === '' || ch === ';' || (ch >= '0' && ch <= '9')) {
302
+ ch = yield;
303
+ sequence += ch;
304
+ }
305
+ }
306
+ else if (ch === 'M') {
307
+ // X11 mouse mode - 3 bytes after M
308
+ ch = yield;
309
+ sequence += ch;
310
+ ch = yield;
311
+ sequence += ch;
312
+ ch = yield;
313
+ sequence += ch;
314
+ }
315
+ const cmd = sequence.slice(cmdStart);
316
+ let match;
317
+ if ((match = /^(\d+)(?:;(\d+))?(?:;(\d+))?([~^$u])$/.exec(cmd))) {
318
+ if (match[1] === '27' && match[3] && match[4] === '~') {
319
+ // modifyOtherKeys format
320
+ code += match[3] + 'u';
321
+ modifier = parseInt(match[2] ?? '1', 10) - 1;
322
+ }
323
+ else {
324
+ code += (match[1] ?? '') + (match[4] ?? '');
325
+ modifier = parseInt(match[2] ?? '1', 10) - 1;
326
+ }
327
+ }
328
+ else if ((match = /^(\d+)?(?:;(\d+))?([A-Za-z])$/.exec(cmd))) {
329
+ code += match[3] ?? '';
330
+ modifier = parseInt(match[2] ?? match[1] ?? '1', 10) - 1;
331
+ }
332
+ else {
333
+ code += cmd;
334
+ }
335
+ }
336
+ // Parse modifiers (xterm encoding: shift=1, meta/alt=2, ctrl=4)
337
+ ctrl = !!(modifier & 4);
338
+ meta = !!(modifier & 2);
339
+ shift = !!(modifier & 1);
340
+ const keyInfo = KEY_INFO_MAP[code];
341
+ if (keyInfo) {
342
+ name = keyInfo.name;
343
+ if (keyInfo.shift)
344
+ shift = true;
345
+ if (keyInfo.ctrl)
346
+ ctrl = true;
347
+ }
348
+ else {
349
+ name = 'undefined';
350
+ if ((ctrl || meta) && (code.endsWith('u') || code.endsWith('~'))) {
351
+ const codeNumber = parseInt(code.slice(1, -1), 10);
352
+ if (codeNumber >= 'a'.charCodeAt(0) && codeNumber <= 'z'.charCodeAt(0)) {
353
+ name = String.fromCharCode(codeNumber);
354
+ }
355
+ }
356
+ }
357
+ }
358
+ else if (ch === '\r') {
359
+ name = 'return';
360
+ meta = escaped;
361
+ }
362
+ else if (ch === '\n') {
363
+ name = 'enter';
364
+ meta = escaped;
365
+ }
366
+ else if (ch === '\t') {
367
+ name = 'tab';
368
+ meta = escaped;
369
+ }
370
+ else if (ch === '\b' || ch === '\x7f') {
371
+ name = 'backspace';
372
+ meta = escaped;
373
+ }
374
+ else if (ch === ESC) {
375
+ name = 'escape';
376
+ meta = escaped;
377
+ }
378
+ else if (ch === ' ') {
379
+ name = 'space';
380
+ meta = escaped;
381
+ insertable = true;
382
+ }
383
+ else if (!escaped && ch <= '\x1a') {
384
+ // ctrl+letter
385
+ name = String.fromCharCode(ch.charCodeAt(0) + 'a'.charCodeAt(0) - 1);
386
+ ctrl = true;
387
+ }
388
+ else if (/^[0-9A-Za-z]$/.exec(ch) !== null) {
389
+ name = ch.toLowerCase();
390
+ shift = /^[A-Z]$/.exec(ch) !== null;
391
+ meta = escaped;
392
+ insertable = true;
393
+ }
394
+ else if (MAC_ALT_KEY_CHARACTER_MAP[ch] && process.platform === 'darwin') {
395
+ name = MAC_ALT_KEY_CHARACTER_MAP[ch];
396
+ meta = true;
397
+ }
398
+ else if (sequence === `${ESC}${ESC}`) {
399
+ name = 'escape';
400
+ meta = true;
401
+ // Emit first escape key
402
+ keypressHandler({
403
+ name: 'escape',
404
+ ctrl,
405
+ meta,
406
+ shift,
407
+ paste: false,
408
+ insertable: false,
409
+ sequence: ESC,
410
+ });
411
+ }
412
+ else if (escaped) {
413
+ name = ch.length ? undefined : 'escape';
414
+ meta = true;
415
+ }
416
+ else {
417
+ // Any other character is printable
418
+ insertable = true;
419
+ }
420
+ if ((sequence.length !== 0 && (name !== undefined || escaped)) ||
421
+ charLengthAt(sequence, 0) === sequence.length) {
422
+ keypressHandler({
423
+ name: name || '',
424
+ ctrl,
425
+ meta,
426
+ shift,
427
+ paste: false,
428
+ insertable,
429
+ sequence,
430
+ });
431
+ }
432
+ }
433
+ }
434
+ export function KeypressProvider({ children }) {
435
+ const { stdin, setRawMode } = useStdin();
436
+ const subscribers = useRef(new Set()).current;
437
+ const subscribe = useCallback((handler) => subscribers.add(handler), [subscribers]);
438
+ const unsubscribe = useCallback((handler) => subscribers.delete(handler), [subscribers]);
439
+ const broadcast = useCallback((key) => subscribers.forEach((handler) => handler(key)), [subscribers]);
440
+ useEffect(() => {
441
+ const wasRaw = stdin.isRaw;
442
+ if (wasRaw === false) {
443
+ setRawMode(true);
444
+ }
445
+ process.stdin.setEncoding('utf8');
446
+ // Build the processing pipeline:
447
+ // dataListener -> pasteBufferer -> backslashBufferer -> mouseFilterer -> broadcast
448
+ const mouseFilterer = nonKeyboardEventFilter(broadcast);
449
+ const backslashBufferer = bufferBackslashEnter(mouseFilterer);
450
+ const pasteBufferer = bufferPaste(backslashBufferer);
451
+ const dataListener = createDataListener(pasteBufferer);
452
+ stdin.on('data', dataListener);
453
+ return () => {
454
+ stdin.removeListener('data', dataListener);
455
+ if (wasRaw === false) {
456
+ setRawMode(false);
457
+ }
458
+ };
459
+ }, [stdin, setRawMode, broadcast]);
460
+ return (_jsx(KeypressContext.Provider, { value: { subscribe, unsubscribe }, children: children }));
461
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * MouseContext
3
+ *
4
+ * Provides mouse event handling by reading stdin directly.
5
+ * Runs in parallel with KeypressProvider - each reads stdin independently.
6
+ */
7
+ import type React from 'react';
8
+ import { type MouseEvent, type MouseEventName, type MouseHandler } from '../utils/mouse.js';
9
+ export type { MouseEvent, MouseEventName, MouseHandler };
10
+ interface MouseContextValue {
11
+ subscribe: (handler: MouseHandler) => void;
12
+ unsubscribe: (handler: MouseHandler) => void;
13
+ }
14
+ export declare function useMouseContext(): MouseContextValue;
15
+ /**
16
+ * Hook to subscribe to mouse events
17
+ */
18
+ export declare function useMouse(handler: MouseHandler, { isActive }?: {
19
+ isActive?: boolean | undefined;
20
+ }): void;
21
+ export interface MouseProviderProps {
22
+ children: React.ReactNode;
23
+ /** Whether mouse events are enabled (sends terminal escape codes) */
24
+ mouseEventsEnabled?: boolean;
25
+ }
26
+ export declare function MouseProvider({ children, mouseEventsEnabled }: MouseProviderProps): import("react/jsx-runtime").JSX.Element;
27
+ //# sourceMappingURL=MouseContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MouseContext.d.ts","sourceRoot":"","sources":["../../../../src/cli/ink-cli/contexts/MouseContext.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAKH,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,YAAY,EACpB,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC;AAIzD,UAAU,iBAAiB;IACvB,SAAS,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;IAC3C,WAAW,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;CAChD;AAID,wBAAgB,eAAe,sBAM9B;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,QAAe,EAAE;;CAAK,QAWvE;AAED,MAAM,WAAW,kBAAkB;IAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,qEAAqE;IACrE,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,kBAAyB,EAAE,EAAE,kBAAkB,2CA2FxF"}
@@ -0,0 +1,102 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * MouseContext
4
+ *
5
+ * Provides mouse event handling by reading stdin directly.
6
+ * Runs in parallel with KeypressProvider - each reads stdin independently.
7
+ */
8
+ import { useStdin } from 'ink';
9
+ import { createContext, useCallback, useContext, useEffect, useRef } from 'react';
10
+ import { ESC } from '../utils/input.js';
11
+ import { parseMouseEvent, isIncompleteMouseSequence, enableMouseEvents, disableMouseEvents, } from '../utils/mouse.js';
12
+ const MAX_MOUSE_BUFFER_SIZE = 4096;
13
+ const MouseContext = createContext(undefined);
14
+ export function useMouseContext() {
15
+ const context = useContext(MouseContext);
16
+ if (!context) {
17
+ throw new Error('useMouseContext must be used within a MouseProvider');
18
+ }
19
+ return context;
20
+ }
21
+ /**
22
+ * Hook to subscribe to mouse events
23
+ */
24
+ export function useMouse(handler, { isActive = true } = {}) {
25
+ const { subscribe, unsubscribe } = useMouseContext();
26
+ useEffect(() => {
27
+ if (!isActive) {
28
+ return;
29
+ }
30
+ subscribe(handler);
31
+ return () => unsubscribe(handler);
32
+ }, [isActive, handler, subscribe, unsubscribe]);
33
+ }
34
+ export function MouseProvider({ children, mouseEventsEnabled = true }) {
35
+ const { stdin } = useStdin();
36
+ const subscribers = useRef(new Set()).current;
37
+ const subscribe = useCallback((handler) => {
38
+ subscribers.add(handler);
39
+ }, [subscribers]);
40
+ const unsubscribe = useCallback((handler) => {
41
+ subscribers.delete(handler);
42
+ }, [subscribers]);
43
+ // Enable/disable mouse events in terminal
44
+ useEffect(() => {
45
+ if (!mouseEventsEnabled) {
46
+ return;
47
+ }
48
+ enableMouseEvents();
49
+ return () => {
50
+ disableMouseEvents();
51
+ };
52
+ }, [mouseEventsEnabled]);
53
+ // Listen to stdin for mouse events
54
+ useEffect(() => {
55
+ if (!mouseEventsEnabled) {
56
+ return;
57
+ }
58
+ let mouseBuffer = '';
59
+ const broadcast = (event) => {
60
+ for (const handler of subscribers) {
61
+ // Handler can return true to indicate it handled the event
62
+ if (handler(event) === true) {
63
+ break;
64
+ }
65
+ }
66
+ };
67
+ const handleData = (data) => {
68
+ mouseBuffer += typeof data === 'string' ? data : data.toString('utf-8');
69
+ // Safety cap to prevent infinite buffer growth
70
+ if (mouseBuffer.length > MAX_MOUSE_BUFFER_SIZE) {
71
+ mouseBuffer = mouseBuffer.slice(-MAX_MOUSE_BUFFER_SIZE);
72
+ }
73
+ while (mouseBuffer.length > 0) {
74
+ const parsed = parseMouseEvent(mouseBuffer);
75
+ if (parsed) {
76
+ broadcast(parsed.event);
77
+ mouseBuffer = mouseBuffer.slice(parsed.length);
78
+ continue;
79
+ }
80
+ if (isIncompleteMouseSequence(mouseBuffer)) {
81
+ break; // Wait for more data
82
+ }
83
+ // Not a valid sequence at start, and not waiting for more data.
84
+ // Discard garbage until next possible sequence start.
85
+ const nextEsc = mouseBuffer.indexOf(ESC, 1);
86
+ if (nextEsc !== -1) {
87
+ mouseBuffer = mouseBuffer.slice(nextEsc);
88
+ // Loop continues to try parsing at new location
89
+ }
90
+ else {
91
+ mouseBuffer = '';
92
+ break;
93
+ }
94
+ }
95
+ };
96
+ stdin.on('data', handleData);
97
+ return () => {
98
+ stdin.removeListener('data', handleData);
99
+ };
100
+ }, [stdin, mouseEventsEnabled, subscribers]);
101
+ return (_jsx(MouseContext.Provider, { value: { subscribe, unsubscribe }, children: children }));
102
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * ScrollProvider
3
+ *
4
+ * Manages scrollable components and handles mouse scroll events.
5
+ * Components register themselves as scrollable, and the provider
6
+ * routes scroll events to the appropriate component.
7
+ */
8
+ import type React from 'react';
9
+ import { type DOMElement } from 'ink';
10
+ export interface ScrollState {
11
+ scrollTop: number;
12
+ scrollHeight: number;
13
+ innerHeight: number;
14
+ }
15
+ export interface ScrollableEntry {
16
+ id: string;
17
+ ref: React.RefObject<DOMElement | null>;
18
+ getScrollState: () => ScrollState;
19
+ scrollBy: (delta: number) => void;
20
+ scrollTo?: (scrollTop: number, duration?: number) => void;
21
+ hasFocus: () => boolean;
22
+ }
23
+ export interface ScrollProviderProps {
24
+ children: React.ReactNode;
25
+ /** Callback when user attempts to select text (drag without Option key) */
26
+ onSelectionAttempt?: () => void;
27
+ }
28
+ export declare const ScrollProvider: React.FC<ScrollProviderProps>;
29
+ /**
30
+ * Hook to register a component as scrollable
31
+ */
32
+ export declare const useScrollable: (entry: Omit<ScrollableEntry, "id">, isActive: boolean) => void;
33
+ //# sourceMappingURL=ScrollProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScrollProvider.d.ts","sourceRoot":"","sources":["../../../../src/cli/ink-cli/contexts/ScrollProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,OAAO,EAAkB,KAAK,UAAU,EAAE,MAAM,KAAK,CAAC;AAGtD,MAAM,WAAW,WAAW;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IACxC,cAAc,EAAE,MAAM,WAAW,CAAC;IAClC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1D,QAAQ,EAAE,MAAM,OAAO,CAAC;CAC3B;AA8CD,MAAM,WAAW,mBAAmB;IAChC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,2EAA2E;IAC3E,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;CACnC;AAgCD,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAkGxD,CAAC;AAIF;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,EAAE,UAAU,OAAO,SAmClF,CAAC"}