@comma-agents/tui 2.0.0-rc.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 (256) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +10 -0
  3. package/dist/App/App.d.ts +24 -0
  4. package/dist/App/App.theme.d.ts +12 -0
  5. package/dist/App/App.types.d.ts +8 -0
  6. package/dist/App/index.d.ts +4 -0
  7. package/dist/Theme/DefineTheme.d.ts +53 -0
  8. package/dist/Theme/Theme.d.ts +11 -0
  9. package/dist/Theme/Theme.types.d.ts +100 -0
  10. package/dist/Theme/index.d.ts +9 -0
  11. package/dist/Theme/themes/dark.d.ts +14 -0
  12. package/dist/Theme/themes/dracula.d.ts +9 -0
  13. package/dist/Theme/themes/index.d.ts +25 -0
  14. package/dist/Theme/themes/light.d.ts +10 -0
  15. package/dist/Theme/themes/solarized-dark.d.ts +9 -0
  16. package/dist/Theme/useTheme/index.d.ts +3 -0
  17. package/dist/Theme/useTheme/useTheme.context.d.ts +31 -0
  18. package/dist/Theme/useTheme/useTheme.d.ts +11 -0
  19. package/dist/Theme/useTheme/useTheme.types.d.ts +10 -0
  20. package/dist/components/BorderedPanel/BorderedPanel.d.ts +70 -0
  21. package/dist/components/BorderedPanel/BorderedPanel.theme.d.ts +59 -0
  22. package/dist/components/BorderedPanel/index.d.ts +4 -0
  23. package/dist/components/Button/Button.d.ts +69 -0
  24. package/dist/components/Button/Button.theme.d.ts +50 -0
  25. package/dist/components/Button/Button.types.d.ts +9 -0
  26. package/dist/components/Button/index.d.ts +4 -0
  27. package/dist/components/ChatTextArea/ChatTextArea.d.ts +85 -0
  28. package/dist/components/ChatTextArea/ChatTextArea.theme.d.ts +34 -0
  29. package/dist/components/ChatTextArea/index.d.ts +2 -0
  30. package/dist/components/CodeView/CodeView.constants.d.ts +9 -0
  31. package/dist/components/CodeView/CodeView.d.ts +23 -0
  32. package/dist/components/CodeView/CodeView.theme.d.ts +26 -0
  33. package/dist/components/CodeView/index.d.ts +4 -0
  34. package/dist/components/CommandPalette/CommandPalette.constants.d.ts +8 -0
  35. package/dist/components/CommandPalette/CommandPalette.d.ts +62 -0
  36. package/dist/components/CommandPalette/CommandPalette.theme.d.ts +50 -0
  37. package/dist/components/CommandPalette/CommandPalette.types.d.ts +50 -0
  38. package/dist/components/CommandPalette/CommandPalette.utils.d.ts +6 -0
  39. package/dist/components/CommandPalette/index.d.ts +5 -0
  40. package/dist/components/CommandPalette/pages/HelpPage/HelpPage.constants.d.ts +2 -0
  41. package/dist/components/CommandPalette/pages/HelpPage/HelpPage.d.ts +12 -0
  42. package/dist/components/CommandPalette/pages/HelpPage/HelpPage.types.d.ts +5 -0
  43. package/dist/components/CommandPalette/pages/HelpPage/index.d.ts +3 -0
  44. package/dist/components/CommandPalette/pages/ListProvidersPage/ListProvidersPage.d.ts +42 -0
  45. package/dist/components/CommandPalette/pages/ListProvidersPage/index.d.ts +1 -0
  46. package/dist/components/CommandPalette/pages/RegisteredProvidersPage/RegisteredProvidersPage.constants.d.ts +3 -0
  47. package/dist/components/CommandPalette/pages/RegisteredProvidersPage/RegisteredProvidersPage.d.ts +40 -0
  48. package/dist/components/CommandPalette/pages/RegisteredProvidersPage/RegisteredProvidersPage.types.d.ts +13 -0
  49. package/dist/components/CommandPalette/pages/RegisteredProvidersPage/RegisteredProvidersPage.utils.d.ts +9 -0
  50. package/dist/components/CommandPalette/pages/RegisteredProvidersPage/index.d.ts +2 -0
  51. package/dist/components/CommandPalette/pages/RunPickerPage/RunPickerPage.constants.d.ts +3 -0
  52. package/dist/components/CommandPalette/pages/RunPickerPage/RunPickerPage.d.ts +31 -0
  53. package/dist/components/CommandPalette/pages/RunPickerPage/RunPickerPage.types.d.ts +8 -0
  54. package/dist/components/CommandPalette/pages/RunPickerPage/RunPickerPage.utils.d.ts +7 -0
  55. package/dist/components/CommandPalette/pages/RunPickerPage/index.d.ts +3 -0
  56. package/dist/components/CommandPalette/pages/SettingsPage/SettingsPage.d.ts +24 -0
  57. package/dist/components/CommandPalette/pages/SettingsPage/index.d.ts +2 -0
  58. package/dist/components/Frame/Frame.d.ts +48 -0
  59. package/dist/components/Frame/Frame.theme.d.ts +52 -0
  60. package/dist/components/Frame/index.d.ts +4 -0
  61. package/dist/components/Hide/Hide.d.ts +20 -0
  62. package/dist/components/Hide/Hide.types.d.ts +12 -0
  63. package/dist/components/Hide/index.d.ts +2 -0
  64. package/dist/components/MessageList/AgentMessage/AgentMessage.d.ts +71 -0
  65. package/dist/components/MessageList/AgentMessage/index.d.ts +2 -0
  66. package/dist/components/MessageList/ContextUsageModal/ContextUsageModal.constants.d.ts +2 -0
  67. package/dist/components/MessageList/ContextUsageModal/ContextUsageModal.d.ts +9 -0
  68. package/dist/components/MessageList/ContextUsageModal/ContextUsageModal.types.d.ts +12 -0
  69. package/dist/components/MessageList/ContextUsageModal/index.d.ts +4 -0
  70. package/dist/components/MessageList/MarkdownView/MarkdownView.constants.d.ts +51 -0
  71. package/dist/components/MessageList/MarkdownView/MarkdownView.d.ts +34 -0
  72. package/dist/components/MessageList/MarkdownView/MarkdownView.theme.d.ts +89 -0
  73. package/dist/components/MessageList/MarkdownView/MarkdownView.types.d.ts +96 -0
  74. package/dist/components/MessageList/MarkdownView/MarkdownView.utils.d.ts +58 -0
  75. package/dist/components/MessageList/MarkdownView/index.d.ts +6 -0
  76. package/dist/components/MessageList/MessageList.d.ts +20 -0
  77. package/dist/components/MessageList/MessageList.theme.d.ts +170 -0
  78. package/dist/components/MessageList/MessageList.types.d.ts +26 -0
  79. package/dist/components/MessageList/OutputModal/OutputModal.constants.d.ts +22 -0
  80. package/dist/components/MessageList/OutputModal/OutputModal.d.ts +37 -0
  81. package/dist/components/MessageList/OutputModal/OutputModal.theme.d.ts +68 -0
  82. package/dist/components/MessageList/OutputModal/OutputModal.types.d.ts +56 -0
  83. package/dist/components/MessageList/OutputModal/OutputModal.utils.d.ts +3 -0
  84. package/dist/components/MessageList/OutputModal/index.d.ts +6 -0
  85. package/dist/components/MessageList/SpawnedStrategyView/SpawnedStrategyView.d.ts +47 -0
  86. package/dist/components/MessageList/SpawnedStrategyView/SpawnedStrategyView.theme.d.ts +58 -0
  87. package/dist/components/MessageList/SpawnedStrategyView/index.d.ts +4 -0
  88. package/dist/components/MessageList/SystemMessage/SystemMessage.d.ts +21 -0
  89. package/dist/components/MessageList/SystemMessage/index.d.ts +2 -0
  90. package/dist/components/MessageList/ToolCallView/ToolCallView.constants.d.ts +42 -0
  91. package/dist/components/MessageList/ToolCallView/ToolCallView.d.ts +71 -0
  92. package/dist/components/MessageList/ToolCallView/ToolCallView.theme.d.ts +47 -0
  93. package/dist/components/MessageList/ToolCallView/ToolCallView.types.d.ts +60 -0
  94. package/dist/components/MessageList/ToolCallView/ToolCallView.utils.d.ts +40 -0
  95. package/dist/components/MessageList/ToolCallView/index.d.ts +8 -0
  96. package/dist/components/MessageList/UserMessage/UserMessage.d.ts +25 -0
  97. package/dist/components/MessageList/UserMessage/index.d.ts +2 -0
  98. package/dist/components/MessageList/index.d.ts +14 -0
  99. package/dist/components/Modal/Modal.d.ts +64 -0
  100. package/dist/components/Modal/Modal.theme.d.ts +29 -0
  101. package/dist/components/Modal/index.d.ts +4 -0
  102. package/dist/components/MouseProvider/MouseContext.d.ts +36 -0
  103. package/dist/components/MouseProvider/MouseProvider.d.ts +20 -0
  104. package/dist/components/MouseProvider/index.d.ts +4 -0
  105. package/dist/components/PermissionPrompt/PermissionPrompt.d.ts +33 -0
  106. package/dist/components/PermissionPrompt/index.d.ts +2 -0
  107. package/dist/components/QuestionPrompt/QuestionPrompt.d.ts +4 -0
  108. package/dist/components/QuestionPrompt/QuestionPrompt.types.d.ts +18 -0
  109. package/dist/components/QuestionPrompt/index.d.ts +2 -0
  110. package/dist/components/ScrollableList/ScrollableList.d.ts +33 -0
  111. package/dist/components/ScrollableList/ScrollableList.theme.d.ts +33 -0
  112. package/dist/components/ScrollableList/ScrollableList.types.d.ts +66 -0
  113. package/dist/components/ScrollableList/index.d.ts +4 -0
  114. package/dist/components/ScrollableView/ScrollableView.d.ts +34 -0
  115. package/dist/components/ScrollableView/ScrollableView.theme.d.ts +34 -0
  116. package/dist/components/ScrollableView/ScrollableView.types.d.ts +113 -0
  117. package/dist/components/ScrollableView/index.d.ts +4 -0
  118. package/dist/components/Scrollbar/Scrollbar.d.ts +21 -0
  119. package/dist/components/Scrollbar/Scrollbar.theme.d.ts +16 -0
  120. package/dist/components/Scrollbar/Scrollbar.types.d.ts +27 -0
  121. package/dist/components/Scrollbar/Scrollbar.utils.d.ts +21 -0
  122. package/dist/components/Scrollbar/index.d.ts +4 -0
  123. package/dist/components/SearchInput/SearchInput.d.ts +22 -0
  124. package/dist/components/SearchInput/SearchInput.theme.d.ts +30 -0
  125. package/dist/components/SearchInput/SearchInput.types.d.ts +25 -0
  126. package/dist/components/SearchInput/SearchInput.utils.d.ts +22 -0
  127. package/dist/components/SearchInput/index.d.ts +5 -0
  128. package/dist/components/Separator/Separator.d.ts +39 -0
  129. package/dist/components/Separator/Separator.theme.d.ts +22 -0
  130. package/dist/components/Separator/index.d.ts +4 -0
  131. package/dist/components/StatusBar/StatusBar.d.ts +4 -0
  132. package/dist/components/StatusBar/StatusBar.theme.d.ts +35 -0
  133. package/dist/components/StatusBar/StatusBar.types.d.ts +24 -0
  134. package/dist/components/StatusBar/index.d.ts +2 -0
  135. package/dist/components/TextAreaInput/TextAreaInput.d.ts +68 -0
  136. package/dist/components/TextAreaInput/TextAreaInput.theme.d.ts +14 -0
  137. package/dist/components/TextAreaInput/TextAreaInput.utils.d.ts +69 -0
  138. package/dist/components/TextAreaInput/index.d.ts +2 -0
  139. package/dist/components/TitleIcon/TitleIcon.d.ts +13 -0
  140. package/dist/components/TitleIcon/TitleIcon.theme.d.ts +19 -0
  141. package/dist/components/TitleIcon/index.d.ts +1 -0
  142. package/dist/components/index.d.ts +61 -0
  143. package/dist/hooks/index.d.ts +27 -0
  144. package/dist/hooks/useBreakpoint/index.d.ts +2 -0
  145. package/dist/hooks/useBreakpoint/useBreakpoint.d.ts +15 -0
  146. package/dist/hooks/useBreakpoint/useBreakpoint.types.d.ts +18 -0
  147. package/dist/hooks/useChat/index.d.ts +22 -0
  148. package/dist/hooks/useChat/useChat.context.d.ts +7 -0
  149. package/dist/hooks/useChat/useChat.d.ts +11 -0
  150. package/dist/hooks/useChat/useChat.types.d.ts +209 -0
  151. package/dist/hooks/useChat/useChat.utils.d.ts +18 -0
  152. package/dist/hooks/useChat/useChatActions.d.ts +10 -0
  153. package/dist/hooks/useChat/useChatAgentMessages/index.d.ts +1 -0
  154. package/dist/hooks/useChat/useChatAgentMessages/useChatAgentMessages.d.ts +2 -0
  155. package/dist/hooks/useChat/useChatInputRequests/index.d.ts +2 -0
  156. package/dist/hooks/useChat/useChatInputRequests/useChatInputRequests.d.ts +3 -0
  157. package/dist/hooks/useChat/useChatInputRequests/useChatInputRequests.types.d.ts +4 -0
  158. package/dist/hooks/useChat/useChatLifecycle.d.ts +5 -0
  159. package/dist/hooks/useChat/useChatPermissionRequests/index.d.ts +2 -0
  160. package/dist/hooks/useChat/useChatPermissionRequests/useChatPermissionRequestSubscriptions.d.ts +2 -0
  161. package/dist/hooks/useChat/useChatPermissionRequests/useChatPermissionRequests.d.ts +3 -0
  162. package/dist/hooks/useChat/useChatPermissionRequests/useChatPermissionRequests.types.d.ts +4 -0
  163. package/dist/hooks/useChat/useChatQuestionRequests/index.d.ts +2 -0
  164. package/dist/hooks/useChat/useChatQuestionRequests/useChatQuestionRequestSubscriptions.d.ts +2 -0
  165. package/dist/hooks/useChat/useChatQuestionRequests/useChatQuestionRequests.d.ts +3 -0
  166. package/dist/hooks/useChat/useChatQuestionRequests/useChatQuestionRequests.types.d.ts +4 -0
  167. package/dist/hooks/useChat/useChatRunLifecycle/index.d.ts +2 -0
  168. package/dist/hooks/useChat/useChatRunLifecycle/useChatRunLifecycle.d.ts +3 -0
  169. package/dist/hooks/useChat/useChatRunLifecycle/useChatRunLifecycle.types.d.ts +11 -0
  170. package/dist/hooks/useChat/useChatRunLifecycle/useChatRunLifecycleSubscriptions.d.ts +2 -0
  171. package/dist/hooks/useChat/useChatRunStore/index.d.ts +1 -0
  172. package/dist/hooks/useChat/useChatRunStore/useChatRunStore.d.ts +3 -0
  173. package/dist/hooks/useChat/useChatRuns.d.ts +10 -0
  174. package/dist/hooks/useChat/useChatState.d.ts +17 -0
  175. package/dist/hooks/useChat/useChatSteering/index.d.ts +2 -0
  176. package/dist/hooks/useChat/useChatSteering/useChatSteering.d.ts +3 -0
  177. package/dist/hooks/useChat/useChatSteering/useChatSteering.types.d.ts +4 -0
  178. package/dist/hooks/useChat/useChatStepMessages/index.d.ts +1 -0
  179. package/dist/hooks/useChat/useChatStepMessages/useChatStepMessages.d.ts +2 -0
  180. package/dist/hooks/useChat/usePersistedRunList/index.d.ts +2 -0
  181. package/dist/hooks/useChat/usePersistedRunList/usePersistedRunList.d.ts +3 -0
  182. package/dist/hooks/useChat/usePersistedRunList/usePersistedRunList.types.d.ts +5 -0
  183. package/dist/hooks/useDaemon/index.d.ts +6 -0
  184. package/dist/hooks/useDaemon/useDaemon.context.d.ts +18 -0
  185. package/dist/hooks/useDaemon/useDaemon.d.ts +7 -0
  186. package/dist/hooks/useDaemon/useDaemon.types.d.ts +62 -0
  187. package/dist/hooks/useDaemon/useDaemonCommand/index.d.ts +2 -0
  188. package/dist/hooks/useDaemon/useDaemonCommand/useDaemonCommand.d.ts +20 -0
  189. package/dist/hooks/useDaemon/useDaemonCommand/useDaemonCommand.types.d.ts +28 -0
  190. package/dist/hooks/useDaemon/useDaemonSubscription/index.d.ts +1 -0
  191. package/dist/hooks/useDaemon/useDaemonSubscription/useDaemonSubscription.d.ts +18 -0
  192. package/dist/hooks/useDebugRender/index.d.ts +2 -0
  193. package/dist/hooks/useDebugRender/useDebugRender.constants.d.ts +18 -0
  194. package/dist/hooks/useDebugRender/useDebugRender.d.ts +35 -0
  195. package/dist/hooks/useDebugRender/useDebugRender.types.d.ts +60 -0
  196. package/dist/hooks/useDebugRender/useDebugRender.utils.d.ts +34 -0
  197. package/dist/hooks/useLogs/index.d.ts +3 -0
  198. package/dist/hooks/useLogs/logStore.d.ts +18 -0
  199. package/dist/hooks/useLogs/useLogs.constants.d.ts +2 -0
  200. package/dist/hooks/useLogs/useLogs.d.ts +15 -0
  201. package/dist/hooks/useLogs/useLogs.types.d.ts +47 -0
  202. package/dist/hooks/useLogs/useLogs.utils.d.ts +13 -0
  203. package/dist/hooks/useModal/index.d.ts +3 -0
  204. package/dist/hooks/useModal/useModal.context.d.ts +20 -0
  205. package/dist/hooks/useModal/useModal.d.ts +22 -0
  206. package/dist/hooks/useModal/useModal.types.d.ts +49 -0
  207. package/dist/hooks/useMouse/index.d.ts +2 -0
  208. package/dist/hooks/useMouse/useMouse.types.d.ts +43 -0
  209. package/dist/hooks/useMouse/useMouse.utils.d.ts +30 -0
  210. package/dist/hooks/useMouseClick/index.d.ts +2 -0
  211. package/dist/hooks/useMouseClick/useMouseClick.d.ts +23 -0
  212. package/dist/hooks/useMouseClick/useMouseClick.types.d.ts +28 -0
  213. package/dist/hooks/useMouseHover/index.d.ts +2 -0
  214. package/dist/hooks/useMouseHover/useMouseHover.d.ts +25 -0
  215. package/dist/hooks/useMouseHover/useMouseHover.types.d.ts +38 -0
  216. package/dist/hooks/useMouseWheelScroll/index.d.ts +2 -0
  217. package/dist/hooks/useMouseWheelScroll/useMouseWheelScroll.d.ts +28 -0
  218. package/dist/hooks/useMouseWheelScroll/useMouseWheelScroll.types.d.ts +32 -0
  219. package/dist/hooks/useRegion/index.d.ts +3 -0
  220. package/dist/hooks/useRegion/useRegion.d.ts +21 -0
  221. package/dist/hooks/useRegion/useRegion.types.d.ts +41 -0
  222. package/dist/hooks/useRegion/useRegion.utils.d.ts +51 -0
  223. package/dist/hooks/useStrategies/useStrategies.d.ts +10 -0
  224. package/dist/hooks/useToolSpinner/index.d.ts +1 -0
  225. package/dist/hooks/useToolSpinner/useToolSpinner.d.ts +28 -0
  226. package/dist/hooks/useUserConfig/index.d.ts +4 -0
  227. package/dist/hooks/useUserConfig/useUserConfig.constants.d.ts +17 -0
  228. package/dist/hooks/useUserConfig/useUserConfig.context.d.ts +9 -0
  229. package/dist/hooks/useUserConfig/useUserConfig.d.ts +9 -0
  230. package/dist/hooks/useUserConfig/useUserConfig.types.d.ts +30 -0
  231. package/dist/hooks/useUserConfig/useUserConfig.utils.d.ts +19 -0
  232. package/dist/hooks/useWebSocket/index.d.ts +2 -0
  233. package/dist/hooks/useWebSocket/useWebSocket.d.ts +17 -0
  234. package/dist/hooks/useWebSocket/useWebSocket.types.d.ts +27 -0
  235. package/dist/index.d.ts +2 -0
  236. package/dist/index.js +10592 -0
  237. package/dist/main.js +10655 -0
  238. package/dist/pages/ChatPage/ChatPage.constants.d.ts +2 -0
  239. package/dist/pages/ChatPage/ChatPage.d.ts +25 -0
  240. package/dist/pages/ChatPage/ChatPage.theme.d.ts +56 -0
  241. package/dist/pages/ChatPage/index.d.ts +4 -0
  242. package/dist/pages/IntroPage/IntroPage.d.ts +14 -0
  243. package/dist/pages/IntroPage/IntroPage.theme.d.ts +13 -0
  244. package/dist/pages/IntroPage/index.d.ts +4 -0
  245. package/dist/pages/LogsPage/LogsPage.d.ts +14 -0
  246. package/dist/pages/LogsPage/LogsPage.theme.d.ts +49 -0
  247. package/dist/pages/LogsPage/LogsPage.utils.d.ts +5 -0
  248. package/dist/pages/LogsPage/index.d.ts +4 -0
  249. package/dist/pages/SpawnedStrategyPage/SpawnedStrategyPage.d.ts +12 -0
  250. package/dist/pages/SpawnedStrategyPage/index.d.ts +2 -0
  251. package/dist/run-tui.d.ts +12 -0
  252. package/dist/run-tui.types.d.ts +12 -0
  253. package/dist/utils/debug.d.ts +12 -0
  254. package/dist/utils/mouseEscape.d.ts +29 -0
  255. package/dist/utils/yogaLayout.d.ts +32 -0
  256. package/package.json +66 -0
@@ -0,0 +1,7 @@
1
+ import type { DaemonContextValue } from "./useDaemon.types";
2
+ /**
3
+ * Access the daemon context.
4
+ *
5
+ * Must be called inside a `<DaemonContextProvider>`. Throws if used outside.
6
+ */
7
+ export declare function useDaemon(): DaemonContextValue;
@@ -0,0 +1,62 @@
1
+ import type { ClientMessage, DaemonMessage } from "@comma-agents/daemon";
2
+ import type { WebSocketStatus } from "../useWebSocket/useWebSocket.types";
3
+ /**
4
+ * Force TypeScript to eagerly expand a mapped/conditional type.
5
+ *
6
+ * Without this, utility types like `Omit<Extract<...>>` show as-is
7
+ * in hover tooltips instead of the resolved object shape.
8
+ */
9
+ export type Simplify<ObjectType> = {
10
+ [Key in keyof ObjectType]: ObjectType[Key];
11
+ } & {};
12
+ /** Extracts the `type` literal from a DaemonMessage variant. */
13
+ export type DaemonMessageType = DaemonMessage["type"];
14
+ /** Extracts the `type` literal from a ClientMessage variant. */
15
+ export type ClientMessageType = ClientMessage["type"];
16
+ /**
17
+ * Narrow a DaemonMessage to the variant matching a specific `type`.
18
+ *
19
+ * Example: `DaemonMessageOf<"agent_streaming">` resolves to the
20
+ * `AgentStreamingMessage` branch of the union.
21
+ */
22
+ export type DaemonMessageOf<MessageKind extends DaemonMessageType> = Simplify<Extract<DaemonMessage, {
23
+ type: MessageKind;
24
+ }>>;
25
+ /**
26
+ * Narrow a ClientMessage to the variant matching a specific `type`.
27
+ *
28
+ * Example: `ClientMessageOf<"prepare_run">` resolves to the
29
+ * `PrepareRunMessage` branch of the union.
30
+ */
31
+ export type ClientMessageOf<CommandKind extends ClientMessageType> = Simplify<Extract<ClientMessage, {
32
+ type: CommandKind;
33
+ }>>;
34
+ /**
35
+ * Callback for a specific daemon message type.
36
+ * Receives the narrowed message variant — not the full union.
37
+ */
38
+ export type DaemonMessageListener<MessageKind extends DaemonMessageType> = (message: DaemonMessageOf<MessageKind>) => void;
39
+ /** Props for the DaemonContextProvider component. */
40
+ export interface DaemonContextProviderProps {
41
+ /** WebSocket URL for the daemon (e.g. "ws://localhost:7422/ws"). */
42
+ readonly url: string;
43
+ /** Child elements. */
44
+ readonly children: React.ReactNode;
45
+ }
46
+ /** Value exposed by the DaemonContext. */
47
+ export interface DaemonContextValue {
48
+ /** Current connection status. */
49
+ readonly status: WebSocketStatus;
50
+ /**
51
+ * Send a raw client message object to the daemon.
52
+ * Returns false if the WebSocket is not open.
53
+ */
54
+ readonly send: (message: Record<string, unknown>) => boolean;
55
+ /**
56
+ * Register a listener for a specific daemon message type.
57
+ * Returns an unsubscribe function.
58
+ */
59
+ readonly on: <MessageKind extends DaemonMessageType>(type: MessageKind, listener: DaemonMessageListener<MessageKind>) => () => void;
60
+ /** Remove a previously registered listener. */
61
+ readonly off: <MessageKind extends DaemonMessageType>(type: MessageKind, listener: DaemonMessageListener<MessageKind>) => void;
62
+ }
@@ -0,0 +1,2 @@
1
+ export { useDaemonCommand } from "./useDaemonCommand";
2
+ export type { DaemonCommandMap, DaemonCommandType, } from "./useDaemonCommand.types";
@@ -0,0 +1,20 @@
1
+ import type { DaemonCommandMap, DaemonCommandType } from "./useDaemonCommand.types";
2
+ /**
3
+ * React hook that returns a function to send a specific command type
4
+ * to the daemon over the shared WebSocket.
5
+ *
6
+ * The returned function auto-injects the `type` discriminant and a
7
+ * fresh `requestId` (UUID). It returns the `requestId` so the caller
8
+ * can correlate responses if needed.
9
+ *
10
+ * Returns `null` instead of a `requestId` when the send fails
11
+ * (e.g. WebSocket not connected).
12
+ *
13
+ * @param type - The daemon command type to send.
14
+ * @example
15
+ * ```tsx
16
+ * const prepareRun = useDaemonCommand("prepare_run");
17
+ * const reqId = prepareRun({ strategyPath: "/path/plan.json" });
18
+ * ```
19
+ */
20
+ export declare function useDaemonCommand<CommandKind extends DaemonCommandType>(type: CommandKind): (payload: DaemonCommandMap[CommandKind]) => string | null;
@@ -0,0 +1,28 @@
1
+ import type { ClientMessage } from "@comma-agents/daemon";
2
+ import type { Simplify } from "../useDaemon.types";
3
+ /**
4
+ * Maps each client command type to its payload shape.
5
+ *
6
+ * Auto-derived from the `ClientMessage` discriminated union — stays in
7
+ * sync with daemon protocol changes. The `type` and `requestId` fields
8
+ * are stripped because they are auto-injected by `useDaemonCommand`.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * DaemonCommandMap["prepare_run"]
13
+ * // → { strategyPath: string; input?: string | undefined }
14
+ *
15
+ * DaemonCommandMap["ping"]
16
+ * // → {}
17
+ *
18
+ * DaemonCommandMap["user_input"]
19
+ * // → { runId: string; agentName: string; text: string }
20
+ * ```
21
+ */
22
+ export type DaemonCommandMap = {
23
+ [CommandKind in ClientMessage["type"]]: Simplify<Omit<Extract<ClientMessage, {
24
+ type: CommandKind;
25
+ }>, "type" | "requestId">>;
26
+ };
27
+ /** All valid daemon command names. */
28
+ export type DaemonCommandType = keyof DaemonCommandMap;
@@ -0,0 +1 @@
1
+ export { useDaemonSubscription } from "./useDaemonSubscription";
@@ -0,0 +1,18 @@
1
+ import type { DaemonMessageListener, DaemonMessageType } from "../useDaemon.types";
2
+ /**
3
+ * React hook that registers a listener for a specific daemon message type.
4
+ *
5
+ * The callback receives the narrowed message variant (not the full union).
6
+ * When `runId` is provided, only messages matching that `runId` are
7
+ * forwarded — messages without a `runId` field are always forwarded.
8
+ *
9
+ * The listener is automatically removed on unmount or when dependencies
10
+ * change. The callback ref is kept stable so consumers don't need to
11
+ * wrap their handler in `useCallback`.
12
+ *
13
+ * @param type - Daemon message type to listen for (e.g. "agent_streaming").
14
+ * @param callback - Handler invoked per matching message.
15
+ * @param runId - Optional run ID filter. When set, only messages whose
16
+ * `runId` matches are forwarded.
17
+ */
18
+ export declare function useDaemonSubscription<MessageKind extends DaemonMessageType>(type: MessageKind, callback: DaemonMessageListener<MessageKind>, runId?: string | null, enabled?: boolean): void;
@@ -0,0 +1,2 @@
1
+ export { useDebugRender } from "./useDebugRender";
2
+ export type { BoundingBox, DebugRenderColors, DebugRenderOptions, DebugRenderRef, RenderReason, } from "./useDebugRender.types";
@@ -0,0 +1,18 @@
1
+ import type { RenderReason } from "./useDebugRender.types";
2
+ /** How long the colored highlight stays visible before being cleared. */
3
+ export declare const FLASH_DURATION_MS = 200;
4
+ /** ANSI reset sequence. */
5
+ export declare const ANSI_RESET = "\u001B[0m";
6
+ /** ANSI SGR foreground color codes for the border outline. */
7
+ export declare const DEFAULT_BG_COLORS: Record<RenderReason, string>;
8
+ /** ANSI SGR codes for each label pill (background + contrasting foreground). */
9
+ export declare const DEFAULT_LABEL_COLORS: Record<RenderReason, string>;
10
+ /** Unicode box-drawing characters for the border outline. */
11
+ export declare const BORDER_CHARS: {
12
+ readonly topLeft: "┌";
13
+ readonly topRight: "┐";
14
+ readonly bottomLeft: "└";
15
+ readonly bottomRight: "┘";
16
+ readonly horizontal: "─";
17
+ readonly vertical: "│";
18
+ };
@@ -0,0 +1,35 @@
1
+ import type { DebugRenderOptions, DebugRenderRef } from "./useDebugRender.types";
2
+ /**
3
+ * Attach a cursor-drawn debug overlay to a component that briefly
4
+ * highlights the entire bounding box with a colored background tint
5
+ * and draws a label showing all detected render reasons as pills.
6
+ *
7
+ * Returns a `ref` callback to attach to the component's root `<Box>`.
8
+ * When `DEBUG_RENDER` is `false` the ref is a no-op and no effects run.
9
+ *
10
+ * Default color legend:
11
+ * - **Cyan** — mount (first render)
12
+ * - **Red** — unmount
13
+ * - **Magenta** — props changed
14
+ * - **Green** — state changed (no prop diff detected)
15
+ * - **White** — context changed (no prop/state diff)
16
+ * - **Yellow** — generic re-render (always present)
17
+ *
18
+ * @param label - Component name shown in the overlay.
19
+ * @param options - Props for diffing, custom colors, flash duration.
20
+ *
21
+ * @example
22
+ * ```tsx
23
+ * const debug = useDebugRender("MyComponent", { props: { count, name } });
24
+ * return <Box ref={debug.ref}>content</Box>;
25
+ *
26
+ * const debug = useDebugRender("HotPath", {
27
+ * props: { data },
28
+ * colors: {
29
+ * bg: { props: "\x1b[48;5;208m" },
30
+ * label: { props: "\x1b[48;5;208;30m" },
31
+ * },
32
+ * });
33
+ * ```
34
+ */
35
+ export declare function useDebugRender(label: string, options?: DebugRenderOptions): DebugRenderRef;
@@ -0,0 +1,60 @@
1
+ import type { DOMElement } from "ink";
2
+ export type { BoundingBox } from "../../utils/yogaLayout";
3
+ /**
4
+ * Every detectable reason a component rendered.
5
+ * Multiple can be true simultaneously (e.g. props changed *and* rerender).
6
+ */
7
+ export type RenderReason = "mount" | "unmount" | "props" | "state" | "context" | "rerender";
8
+ /**
9
+ * Custom ANSI SGR color strings keyed by render reason.
10
+ * Any reason not specified falls back to the built-in default.
11
+ *
12
+ * Each value should be a raw SGR sequence like `"\x1b[48;5;208m"` (bg only)
13
+ * or `"\x1b[48;5;208;30m"` (bg + fg).
14
+ */
15
+ export interface DebugRenderColors {
16
+ /** Background-only SGR for the full-region tint. */
17
+ readonly bg?: Partial<Record<RenderReason, string>>;
18
+ /** Background + foreground SGR for the label pill. */
19
+ readonly label?: Partial<Record<RenderReason, string>>;
20
+ }
21
+ /** Configuration for `useDebugRender`. */
22
+ export interface DebugRenderOptions {
23
+ /**
24
+ * The component's current props object.
25
+ * Passed each render so the hook can shallow-diff to detect prop changes.
26
+ */
27
+ readonly props?: Record<string, unknown>;
28
+ /**
29
+ * Override the default color palette for this component.
30
+ * Useful for distinguishing specific components at a glance.
31
+ */
32
+ readonly colors?: DebugRenderColors;
33
+ /**
34
+ * Flash duration override in milliseconds. @default 200
35
+ */
36
+ readonly flashMs?: number;
37
+ /**
38
+ * Toggle individual render-reason overlays on or off.
39
+ * Any reason not specified defaults to `true` (enabled).
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * // Only show mount and props flashes, suppress everything else
44
+ * useDebugRender("MyComponent", {
45
+ * enabled: { mount: true, props: true, unmount: false, state: false, context: false, rerender: false },
46
+ * });
47
+ * ```
48
+ */
49
+ readonly enabled?: Partial<Record<RenderReason, boolean>>;
50
+ /**
51
+ * Whether to draw the colored border outline around the component's
52
+ * bounding box. When `false`, only the label pills are shown.
53
+ * @default true
54
+ */
55
+ readonly showBackground?: boolean;
56
+ }
57
+ /** Ref handle returned by `useDebugRender`. Attach to the root `<Box>`. */
58
+ export interface DebugRenderRef {
59
+ readonly ref: React.RefCallback<DOMElement>;
60
+ }
@@ -0,0 +1,34 @@
1
+ import type { DOMElement } from "ink";
2
+ import { getBoundingBox } from "../../utils/yogaLayout";
3
+ import type { RenderReason } from "./useDebugRender.types";
4
+ export { getBoundingBox };
5
+ /** Build one ANSI-colored pill for a single reason. */
6
+ export declare function buildPill(reason: RenderReason, labelSgr: string): string;
7
+ /**
8
+ * Build the full label line: component name, render count, then a
9
+ * colored pill for every detected reason.
10
+ */
11
+ export declare function buildLabelLine(name: string, count: number, reasons: readonly RenderReason[], labelColors: Record<RenderReason, string>): string;
12
+ /** Visible character width of the full label line (for clearing). */
13
+ export declare function labelLineVisibleWidth(name: string, count: number, reasons: readonly RenderReason[]): number;
14
+ /**
15
+ * Draw a colored border outline around the bounding box and overlay
16
+ * the label line on the top edge. The border is drawn with Unicode
17
+ * box-drawing characters so existing content inside is preserved.
18
+ */
19
+ export declare function paintHighlight(stdout: NodeJS.WriteStream, node: DOMElement, reasons: readonly RenderReason[], labelLine: string, bgColors: Record<RenderReason, string>, showBackground: boolean): void;
20
+ /** Clear just the label text on the first row. */
21
+ export declare function clearLabelLine(stdout: NodeJS.WriteStream, node: DOMElement, visibleWidth: number): void;
22
+ /** Clear the border outline by overwriting border cells with spaces. */
23
+ export declare function clearHighlight(stdout: NodeJS.WriteStream, node: DOMElement): void;
24
+ /**
25
+ * Collect all applicable reasons for this render cycle.
26
+ * Returns them sorted by priority (most specific first).
27
+ */
28
+ export declare function detectReasons(isMounted: boolean, props: Record<string, unknown> | undefined, previousProps: Record<string, unknown> | undefined): RenderReason[];
29
+ /** Remove reasons that the caller has explicitly disabled. */
30
+ export declare function filterReasons(reasons: readonly RenderReason[], enabled?: Partial<Record<RenderReason, boolean>>): RenderReason[];
31
+ /** Merge user-provided background color overrides with defaults. */
32
+ export declare function mergeBackgroundColors(overrides?: Partial<Record<RenderReason, string>>): Record<RenderReason, string>;
33
+ /** Merge user-provided label color overrides with defaults. */
34
+ export declare function mergeLabelColors(overrides?: Partial<Record<RenderReason, string>>): Record<RenderReason, string>;
@@ -0,0 +1,3 @@
1
+ export { createLogStore, logStore } from "./logStore";
2
+ export { useLogs } from "./useLogs";
3
+ export type { LogEntry, LogLevel, LogStore, LogStoreListener, LogsState, } from "./useLogs.types";
@@ -0,0 +1,18 @@
1
+ import type { LogStore } from "./useLogs.types";
2
+ /**
3
+ * Create a log store that hijacks global console methods immediately.
4
+ *
5
+ * The store starts in **pass-through mode**: every console call is buffered
6
+ * into the store AND forwarded to the original terminal output (stderr/stdout).
7
+ * This ensures that startup errors — import failures, TTY errors, etc. — are
8
+ * still visible in the terminal if the app crashes before the UI renders.
9
+ *
10
+ * Once the app has successfully rendered, call {@link LogStore.commit} to
11
+ * switch to **capture mode**. After that point all console output is captured
12
+ * exclusively into the store; the Logs tab is the only place to view it.
13
+ *
14
+ * @param maxEntries - Maximum number of entries to retain. @default 500
15
+ */
16
+ export declare function createLogStore(maxEntries?: number): LogStore;
17
+ /** Singleton log store, created at module load time so no console calls are missed. */
18
+ export declare const logStore: LogStore;
@@ -0,0 +1,2 @@
1
+ /** Maximum number of log entries to retain in memory. */
2
+ export declare const MAX_LOG_ENTRIES = 500;
@@ -0,0 +1,15 @@
1
+ import type { LogsState } from "./useLogs.types";
2
+ /**
3
+ * Subscribe to the global log store that captures console output.
4
+ *
5
+ * The store is shared across the whole app and is created once at module
6
+ * load time. Every component that calls this hook re-renders whenever a new
7
+ * log entry is appended.
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * const { logs, clearLogs } = useLogs();
12
+ * return <Text>{logs.length} entries</Text>;
13
+ * ```
14
+ */
15
+ export declare function useLogs(): LogsState;
@@ -0,0 +1,47 @@
1
+ /** Severity level for a captured log entry. */
2
+ export type LogLevel = "debug" | "info" | "warn" | "error" | "log";
3
+ /** A single captured console log entry. */
4
+ export interface LogEntry {
5
+ /** Unique identifier for the log entry. */
6
+ readonly id: string;
7
+ /** Timestamp when the log was captured. */
8
+ readonly timestamp: number;
9
+ /** The severity level of the log. */
10
+ readonly level: LogLevel;
11
+ /** The stringified log message. */
12
+ readonly message: string;
13
+ }
14
+ /** Callback invoked when the log store contents change. */
15
+ export type LogStoreListener = () => void;
16
+ /** Module-level log store that captures console output. */
17
+ export interface LogStore {
18
+ /** Returns the current snapshot of all log entries. */
19
+ readonly getSnapshot: () => readonly LogEntry[];
20
+ /** Registers a listener notified on every log change. Returns an unsubscribe function. */
21
+ readonly subscribe: (listener: LogStoreListener) => () => void;
22
+ /** Push a log entry directly into the store (bypasses console interception). */
23
+ readonly push: (level: LogLevel, message: string) => void;
24
+ /** Clears all captured logs. */
25
+ readonly clear: () => void;
26
+ /**
27
+ * Switches from pass-through mode to full capture mode.
28
+ *
29
+ * During startup the store buffers log entries AND forwards them to the
30
+ * original terminal output so that errors are visible if the app crashes
31
+ * before the UI renders. Call `commit()` once the app is ready — after that
32
+ * point all console output is captured exclusively into the store and the
33
+ * Logs tab is the only place to view it.
34
+ */
35
+ readonly commit: () => void;
36
+ /** Whether the store has been committed (true) or is still in pass-through mode. */
37
+ readonly isCommitted: () => boolean;
38
+ /** Restores original console methods and stops capturing. */
39
+ readonly destroy: () => void;
40
+ }
41
+ /** Return value of the useLogs hook. */
42
+ export interface LogsState {
43
+ /** All captured log entries, oldest first. */
44
+ readonly logs: readonly LogEntry[];
45
+ /** Clears all captured logs. */
46
+ readonly clearLogs: () => void;
47
+ }
@@ -0,0 +1,13 @@
1
+ /** Generate a unique sequential log entry ID. */
2
+ export declare function nextLogId(): string;
3
+ /**
4
+ * Stringify console arguments into a single space-separated message.
5
+ *
6
+ * Strings are passed through verbatim. Everything else is rendered with
7
+ * `util.inspect`, which handles `Error` instances, circular references,
8
+ * `Symbol`, `BigInt`, and class instances cleanly — JSON.stringify would
9
+ * either throw or strip these.
10
+ */
11
+ export declare function formatArgs(args: readonly unknown[]): string;
12
+ /** @internal Reset the log id counter. Test-only. */
13
+ export declare function _resetLogIdCounterForTests(): void;
@@ -0,0 +1,3 @@
1
+ export { useModal } from "./useModal";
2
+ export { ModalContextProvider } from "./useModal.context";
3
+ export type { ModalContextProviderProps, ModalContextType, ModalControls, ModalEntry, ModalId, } from "./useModal.types";
@@ -0,0 +1,20 @@
1
+ import type React from "react";
2
+ import type { ModalContextProviderProps, ModalContextType } from "./useModal.types";
3
+ export declare const ModalContext: React.Context<ModalContextType>;
4
+ /**
5
+ * Provides a shared modal registry so any descendant can open, close,
6
+ * or query modals by id without prop-drilling.
7
+ *
8
+ * Tracks an ordered stack of open modals — the last id in the stack is the
9
+ * topmost modal and is the only one that should receive input and respond
10
+ * to Esc.
11
+ *
12
+ * @param props - Provider props containing children.
13
+ * @example
14
+ * ```tsx
15
+ * <ModalContextProvider>
16
+ * <App />
17
+ * </ModalContextProvider>
18
+ * ```
19
+ */
20
+ export declare function ModalContextProvider(props: ModalContextProviderProps): React.ReactElement;
@@ -0,0 +1,22 @@
1
+ import type { ModalControls, ModalId } from "./useModal.types";
2
+ /**
3
+ * Programmatic controls for a specific modal identified by its id.
4
+ *
5
+ * Reads from the nearest `<ModalContextProvider>`. When called outside any
6
+ * provider — most notably inside the detached `measureLayout` tree — the
7
+ * context falls back to an inert no-op API so components render
8
+ * structurally without crashing. In the live app the provider always wins.
9
+ *
10
+ * @param modalId - Unique identifier for the modal to control.
11
+ * @example
12
+ * ```tsx
13
+ * const confirmModal = useModal("confirm-delete");
14
+ *
15
+ * // Open with data
16
+ * confirmModal.open({ itemId: 42 });
17
+ *
18
+ * // Close
19
+ * confirmModal.close();
20
+ * ```
21
+ */
22
+ export declare function useModal(modalId: ModalId): ModalControls;
@@ -0,0 +1,49 @@
1
+ import type React from "react";
2
+ /** Unique identifier for a registered modal. */
3
+ export type ModalId = string;
4
+ /** State of a single modal instance. */
5
+ export interface ModalEntry {
6
+ /** Whether this modal is currently visible. */
7
+ readonly isOpen: boolean;
8
+ /** Arbitrary data passed when opening the modal. */
9
+ readonly data: unknown;
10
+ }
11
+ /** Controls returned by the `useModal` consumer hook. */
12
+ export interface ModalControls {
13
+ /** Whether this modal is currently visible. */
14
+ readonly isOpen: boolean;
15
+ /** Whether this modal is the topmost currently open modal. */
16
+ readonly isTopmost: boolean;
17
+ /** Arbitrary data passed via `open(data)`. */
18
+ readonly data: unknown;
19
+ /** Show the modal, optionally passing data to it. */
20
+ readonly open: (data?: unknown) => void;
21
+ /** Hide the modal and clear its data. */
22
+ readonly close: () => void;
23
+ /** Toggle visibility. */
24
+ readonly toggle: (data?: unknown) => void;
25
+ }
26
+ /** Shape of the modal registry context value. */
27
+ export interface ModalContextType {
28
+ /** Map of all registered modal states keyed by id. */
29
+ readonly modals: ReadonlyMap<ModalId, ModalEntry>;
30
+ /** Ordered stack of currently open modal ids; last element is topmost. */
31
+ readonly openStack: readonly ModalId[];
32
+ /** Open a modal by id, optionally passing data. */
33
+ readonly open: (modalId: ModalId, data?: unknown) => void;
34
+ /** Close a modal by id. */
35
+ readonly close: (modalId: ModalId) => void;
36
+ /** Toggle a modal by id. */
37
+ readonly toggle: (modalId: ModalId, data?: unknown) => void;
38
+ /** Check whether a modal is open. */
39
+ readonly isOpen: (modalId: ModalId) => boolean;
40
+ /** Check whether a modal is the topmost open modal. */
41
+ readonly isTopmost: (modalId: ModalId) => boolean;
42
+ /** Retrieve the data for a modal. */
43
+ readonly getData: (modalId: ModalId) => unknown;
44
+ }
45
+ /** Props for the ModalContextProvider component. */
46
+ export interface ModalContextProviderProps {
47
+ /** Child components that can consume the modal context. */
48
+ readonly children: React.ReactNode;
49
+ }
@@ -0,0 +1,2 @@
1
+ export type { MouseEvent, MouseEventKind, MouseModifiers, } from "./useMouse.types";
2
+ export { isInsideRef, isMouseEscape, parseMouseEvents, SGR_MOUSE_PREFIX, SGR_MOUSE_TAIL_PATTERN, } from "./useMouse.utils";
@@ -0,0 +1,43 @@
1
+ /**
2
+ * The kind of SGR mouse event received from the terminal.
3
+ *
4
+ * - `"press"` — button pressed (terminator `M`, non-wheel, non-motion).
5
+ * - `"release"` — button released (terminator `m`, non-wheel).
6
+ * - `"move"` — cursor motion with no button held (requires `?1003h`).
7
+ * - `"drag"` — cursor motion while a button is held (`?1002h`/`?1003h`).
8
+ * - `"wheel-up"` — mouse wheel scrolled up (button 64).
9
+ * - `"wheel-down"` — mouse wheel scrolled down (button 65).
10
+ */
11
+ export type MouseEventKind = "press" | "release" | "move" | "drag" | "wheel-up" | "wheel-down";
12
+ /**
13
+ * Keyboard modifier keys held at the time of a mouse event.
14
+ * Encoded in the SGR button byte: shift=bit2, meta=bit3, ctrl=bit4.
15
+ */
16
+ export interface MouseModifiers {
17
+ readonly shift: boolean;
18
+ readonly meta: boolean;
19
+ readonly ctrl: boolean;
20
+ }
21
+ /**
22
+ * A single parsed SGR (1006) mouse event.
23
+ *
24
+ * Coordinates are **1-indexed absolute terminal cells**, matching the
25
+ * values emitted by the terminal. Column 1 is the leftmost column;
26
+ * row 1 is the topmost row.
27
+ */
28
+ export interface MouseEvent {
29
+ /** What kind of event this is. */
30
+ readonly kind: MouseEventKind;
31
+ /**
32
+ * Which mouse button triggered the event.
33
+ * `0` = left, `1` = middle, `2` = right.
34
+ * `null` for motion-without-button and wheel events.
35
+ */
36
+ readonly button: 0 | 1 | 2 | null;
37
+ /** 1-indexed column (horizontal position) in terminal cells. */
38
+ readonly column: number;
39
+ /** 1-indexed row (vertical position) in terminal cells. */
40
+ readonly row: number;
41
+ /** Keyboard modifiers held at the time of the event. */
42
+ readonly modifiers: MouseModifiers;
43
+ }
@@ -0,0 +1,30 @@
1
+ import type { DOMElement } from "ink";
2
+ import type React from "react";
3
+ import { isMouseEscape, SGR_MOUSE_PREFIX, SGR_MOUSE_TAIL_PATTERN } from "../../utils/mouseEscape";
4
+ import type { MouseEvent } from "./useMouse.types";
5
+ /**
6
+ * Parse all SGR (1006) mouse events bundled into a single `useInput` chunk.
7
+ *
8
+ * Node's stdin decoder can group several rapid mouse events into one string.
9
+ * This function walks the chunk and returns every event found, in order.
10
+ * Non-mouse input yields an empty array (fast-path via prefix check).
11
+ */
12
+ export declare function parseMouseEvents(input: string): readonly MouseEvent[];
13
+ /**
14
+ * Return `true` when the terminal cell (`column`, `row`) falls inside the
15
+ * bounding box of the element referenced by `ref`.
16
+ *
17
+ * Coordinates follow SGR convention: **1-indexed**. The Yoga layout values
18
+ * from `getBoundingBox` are **0-indexed**, so we convert: a SGR column of 1
19
+ * corresponds to Yoga left of 0.
20
+ *
21
+ * The test is inclusive-low / exclusive-high on both axes, matching standard
22
+ * AABB convention:
23
+ * ```
24
+ * left <= col0 < left + width
25
+ * top <= row0 < top + height
26
+ * ```
27
+ * Returns `false` when the ref is not yet mounted (`ref.current` is `null`).
28
+ */
29
+ export declare function isInsideRef(ref: React.RefObject<DOMElement | null>, column: number, row: number): boolean;
30
+ export { isMouseEscape, SGR_MOUSE_PREFIX, SGR_MOUSE_TAIL_PATTERN };
@@ -0,0 +1,2 @@
1
+ export { useMouseClick } from "./useMouseClick";
2
+ export type { UseMouseClickOptions } from "./useMouseClick.types";
@@ -0,0 +1,23 @@
1
+ import type { UseMouseClickOptions } from "./useMouseClick.types";
2
+ /**
3
+ * Fire a callback when the user clicks inside a specific element.
4
+ *
5
+ * Works under the existing `?1000h` / `?1006h` mouse mode that {@link Frame}
6
+ * enables by default — no motion tracking (`?1003h`) required.
7
+ * Wrap the component tree in `<MouseProvider>` (done by `<Frame>`) before
8
+ * using this hook.
9
+ *
10
+ * Only `press` events are surfaced (not release or drag). AABB hit-testing
11
+ * runs on every press event by walking the Yoga layout tree.
12
+ *
13
+ * **Click-to-focus pattern:**
14
+ * ```tsx
15
+ * const ref = useRef<DOMElement>(null);
16
+ * const { focus } = useFocusManager();
17
+ * useMouseClick({ ref, onClick: () => focus(myId) });
18
+ * return <Box ref={ref}>...</Box>;
19
+ * ```
20
+ *
21
+ * @param options - See {@link UseMouseClickOptions}.
22
+ */
23
+ export declare function useMouseClick({ ref, onClick, buttons, }: UseMouseClickOptions): void;
@@ -0,0 +1,28 @@
1
+ import type { DOMElement } from "ink";
2
+ import type React from "react";
3
+ import type { MouseEvent } from "../useMouse/useMouse.types";
4
+ /**
5
+ * Options accepted by {@link useMouseClick}.
6
+ */
7
+ export interface UseMouseClickOptions {
8
+ /**
9
+ * Ref to the `DOMElement` (Ink `<Box>` or similar) whose bounds are used
10
+ * for hit-testing. The element must be mounted before click events fire.
11
+ */
12
+ readonly ref: React.RefObject<DOMElement | null>;
13
+ /**
14
+ * Called when a mouse button press event hits the element's bounding box.
15
+ * Receives the full {@link MouseEvent} so the caller can inspect which
16
+ * button was pressed and what modifier keys were held.
17
+ */
18
+ readonly onClick: (event: MouseEvent) => void;
19
+ /**
20
+ * Which button indices trigger `onClick`. Defaults to `[0]` (left button
21
+ * only). Pass `[0, 1, 2]` to react to any button.
22
+ *
23
+ * `0` = left, `1` = middle, `2` = right.
24
+ *
25
+ * @default [0]
26
+ */
27
+ readonly buttons?: readonly (0 | 1 | 2)[];
28
+ }
@@ -0,0 +1,2 @@
1
+ export { useMouseHover } from "./useMouseHover";
2
+ export type { UseMouseHoverOptions, UseMouseHoverResult, } from "./useMouseHover.types";