openhorse 0.1.5

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 (587) hide show
  1. package/README.md +460 -0
  2. package/bin/openhorse +56 -0
  3. package/dist/agents/coder.d.ts +12 -0
  4. package/dist/agents/coder.d.ts.map +1 -0
  5. package/dist/agents/coder.js +48 -0
  6. package/dist/agents/coder.js.map +1 -0
  7. package/dist/agents/leader.d.ts +12 -0
  8. package/dist/agents/leader.d.ts.map +1 -0
  9. package/dist/agents/leader.js +49 -0
  10. package/dist/agents/leader.js.map +1 -0
  11. package/dist/agents/router.d.ts +59 -0
  12. package/dist/agents/router.d.ts.map +1 -0
  13. package/dist/agents/router.js +193 -0
  14. package/dist/agents/router.js.map +1 -0
  15. package/dist/cli-ink.d.ts +7 -0
  16. package/dist/cli-ink.d.ts.map +1 -0
  17. package/dist/cli-ink.js +135 -0
  18. package/dist/cli-ink.js.map +1 -0
  19. package/dist/cli.d.ts +7 -0
  20. package/dist/cli.d.ts.map +1 -0
  21. package/dist/cli.js +638 -0
  22. package/dist/cli.js.map +1 -0
  23. package/dist/commands/index.d.ts +12 -0
  24. package/dist/commands/index.d.ts.map +1 -0
  25. package/dist/commands/index.js +1095 -0
  26. package/dist/commands/index.js.map +1 -0
  27. package/dist/commands/parser.d.ts +26 -0
  28. package/dist/commands/parser.d.ts.map +1 -0
  29. package/dist/commands/parser.js +61 -0
  30. package/dist/commands/parser.js.map +1 -0
  31. package/dist/commands/types.d.ts +61 -0
  32. package/dist/commands/types.d.ts.map +1 -0
  33. package/dist/commands/types.js +32 -0
  34. package/dist/commands/types.js.map +1 -0
  35. package/dist/core/agent.d.ts +66 -0
  36. package/dist/core/agent.d.ts.map +1 -0
  37. package/dist/core/agent.js +55 -0
  38. package/dist/core/agent.js.map +1 -0
  39. package/dist/core/brain.d.ts +41 -0
  40. package/dist/core/brain.d.ts.map +1 -0
  41. package/dist/core/brain.js +92 -0
  42. package/dist/core/brain.js.map +1 -0
  43. package/dist/core/cost-tracker.d.ts +107 -0
  44. package/dist/core/cost-tracker.d.ts.map +1 -0
  45. package/dist/core/cost-tracker.js +199 -0
  46. package/dist/core/cost-tracker.js.map +1 -0
  47. package/dist/core/strategy-tracker.d.ts +61 -0
  48. package/dist/core/strategy-tracker.d.ts.map +1 -0
  49. package/dist/core/strategy-tracker.js +124 -0
  50. package/dist/core/strategy-tracker.js.map +1 -0
  51. package/dist/framework/index.d.ts +20 -0
  52. package/dist/framework/index.d.ts.map +1 -0
  53. package/dist/framework/index.js +29 -0
  54. package/dist/framework/index.js.map +1 -0
  55. package/dist/framework/prompt.d.ts +40 -0
  56. package/dist/framework/prompt.d.ts.map +1 -0
  57. package/dist/framework/prompt.js +112 -0
  58. package/dist/framework/prompt.js.map +1 -0
  59. package/dist/framework/query.d.ts +86 -0
  60. package/dist/framework/query.d.ts.map +1 -0
  61. package/dist/framework/query.js +177 -0
  62. package/dist/framework/query.js.map +1 -0
  63. package/dist/framework/store.d.ts +64 -0
  64. package/dist/framework/store.d.ts.map +1 -0
  65. package/dist/framework/store.js +78 -0
  66. package/dist/framework/store.js.map +1 -0
  67. package/dist/framework/tool-state.d.ts +22 -0
  68. package/dist/framework/tool-state.d.ts.map +1 -0
  69. package/dist/framework/tool-state.js +40 -0
  70. package/dist/framework/tool-state.js.map +1 -0
  71. package/dist/framework/tool.d.ts +88 -0
  72. package/dist/framework/tool.d.ts.map +1 -0
  73. package/dist/framework/tool.js +60 -0
  74. package/dist/framework/tool.js.map +1 -0
  75. package/dist/harness/harness.d.ts +96 -0
  76. package/dist/harness/harness.d.ts.map +1 -0
  77. package/dist/harness/harness.js +224 -0
  78. package/dist/harness/harness.js.map +1 -0
  79. package/dist/harness/safety.d.ts +89 -0
  80. package/dist/harness/safety.d.ts.map +1 -0
  81. package/dist/harness/safety.js +178 -0
  82. package/dist/harness/safety.js.map +1 -0
  83. package/dist/index.d.ts +30 -0
  84. package/dist/index.d.ts.map +1 -0
  85. package/dist/index.js +57 -0
  86. package/dist/index.js.map +1 -0
  87. package/dist/init.d.ts +178 -0
  88. package/dist/init.d.ts.map +1 -0
  89. package/dist/init.js +473 -0
  90. package/dist/init.js.map +1 -0
  91. package/dist/ink/bidi.d.ts +16 -0
  92. package/dist/ink/bidi.d.ts.map +1 -0
  93. package/dist/ink/bidi.js +124 -0
  94. package/dist/ink/bidi.js.map +1 -0
  95. package/dist/ink/clearTerminal.d.ts +14 -0
  96. package/dist/ink/clearTerminal.d.ts.map +1 -0
  97. package/dist/ink/clearTerminal.js +63 -0
  98. package/dist/ink/clearTerminal.js.map +1 -0
  99. package/dist/ink/colorize.d.ts +17 -0
  100. package/dist/ink/colorize.d.ts.map +1 -0
  101. package/dist/ink/colorize.js +208 -0
  102. package/dist/ink/colorize.js.map +1 -0
  103. package/dist/ink/components/App.d.ts +73 -0
  104. package/dist/ink/components/App.d.ts.map +1 -0
  105. package/dist/ink/components/App.js +646 -0
  106. package/dist/ink/components/App.js.map +1 -0
  107. package/dist/ink/components/AppContext.d.ts +12 -0
  108. package/dist/ink/components/AppContext.d.ts.map +1 -0
  109. package/dist/ink/components/AppContext.js +14 -0
  110. package/dist/ink/components/AppContext.js.map +1 -0
  111. package/dist/ink/components/Box.d.ts +44 -0
  112. package/dist/ink/components/Box.d.ts.map +1 -0
  113. package/dist/ink/components/Box.js +191 -0
  114. package/dist/ink/components/Box.js.map +1 -0
  115. package/dist/ink/components/ClockContext.d.ts +9 -0
  116. package/dist/ink/components/ClockContext.d.ts.map +1 -0
  117. package/dist/ink/components/ClockContext.js +146 -0
  118. package/dist/ink/components/ClockContext.js.map +1 -0
  119. package/dist/ink/components/CursorDeclarationContext.d.ts +23 -0
  120. package/dist/ink/components/CursorDeclarationContext.d.ts.map +1 -0
  121. package/dist/ink/components/CursorDeclarationContext.js +6 -0
  122. package/dist/ink/components/CursorDeclarationContext.js.map +1 -0
  123. package/dist/ink/components/ErrorOverview.d.ts +6 -0
  124. package/dist/ink/components/ErrorOverview.d.ts.map +1 -0
  125. package/dist/ink/components/ErrorOverview.js +27 -0
  126. package/dist/ink/components/ErrorOverview.js.map +1 -0
  127. package/dist/ink/components/Newline.d.ts +13 -0
  128. package/dist/ink/components/Newline.d.ts.map +1 -0
  129. package/dist/ink/components/Newline.js +36 -0
  130. package/dist/ink/components/Newline.js.map +1 -0
  131. package/dist/ink/components/NoSelect.d.ts +20 -0
  132. package/dist/ink/components/NoSelect.d.ts.map +1 -0
  133. package/dist/ink/components/NoSelect.js +63 -0
  134. package/dist/ink/components/NoSelect.js.map +1 -0
  135. package/dist/ink/components/RawAnsi.d.ts +17 -0
  136. package/dist/ink/components/RawAnsi.d.ts.map +1 -0
  137. package/dist/ink/components/RawAnsi.js +52 -0
  138. package/dist/ink/components/RawAnsi.js.map +1 -0
  139. package/dist/ink/components/Spacer.d.ts +6 -0
  140. package/dist/ink/components/Spacer.d.ts.map +1 -0
  141. package/dist/ink/components/Spacer.js +26 -0
  142. package/dist/ink/components/Spacer.js.map +1 -0
  143. package/dist/ink/components/StdinContext.d.ts +28 -0
  144. package/dist/ink/components/StdinContext.d.ts.map +1 -0
  145. package/dist/ink/components/StdinContext.js +19 -0
  146. package/dist/ink/components/StdinContext.js.map +1 -0
  147. package/dist/ink/components/TerminalFocusContext.d.ts +10 -0
  148. package/dist/ink/components/TerminalFocusContext.d.ts.map +1 -0
  149. package/dist/ink/components/TerminalFocusContext.js +81 -0
  150. package/dist/ink/components/TerminalFocusContext.js.map +1 -0
  151. package/dist/ink/components/TerminalSizeContext.d.ts +6 -0
  152. package/dist/ink/components/TerminalSizeContext.d.ts.map +1 -0
  153. package/dist/ink/components/TerminalSizeContext.js +6 -0
  154. package/dist/ink/components/TerminalSizeContext.js.map +1 -0
  155. package/dist/ink/components/Text.d.ts +56 -0
  156. package/dist/ink/components/Text.d.ts.map +1 -0
  157. package/dist/ink/components/Text.js +201 -0
  158. package/dist/ink/components/Text.js.map +1 -0
  159. package/dist/ink/constants.d.ts +2 -0
  160. package/dist/ink/constants.d.ts.map +1 -0
  161. package/dist/ink/constants.js +6 -0
  162. package/dist/ink/constants.js.map +1 -0
  163. package/dist/ink/devtools.d.ts +3 -0
  164. package/dist/ink/devtools.d.ts.map +1 -0
  165. package/dist/ink/devtools.js +5 -0
  166. package/dist/ink/devtools.js.map +1 -0
  167. package/dist/ink/dom.d.ts +77 -0
  168. package/dist/ink/dom.d.ts.map +1 -0
  169. package/dist/ink/dom.js +322 -0
  170. package/dist/ink/dom.js.map +1 -0
  171. package/dist/ink/events/click-event.d.ts +32 -0
  172. package/dist/ink/events/click-event.d.ts.map +1 -0
  173. package/dist/ink/events/click-event.js +30 -0
  174. package/dist/ink/events/click-event.js.map +1 -0
  175. package/dist/ink/events/dispatcher.d.ts +41 -0
  176. package/dist/ink/events/dispatcher.d.ts.map +1 -0
  177. package/dist/ink/events/dispatcher.js +181 -0
  178. package/dist/ink/events/dispatcher.js.map +1 -0
  179. package/dist/ink/events/emitter.d.ts +6 -0
  180. package/dist/ink/events/emitter.d.ts.map +1 -0
  181. package/dist/ink/events/emitter.js +36 -0
  182. package/dist/ink/events/emitter.js.map +1 -0
  183. package/dist/ink/events/event-handlers.d.ts +47 -0
  184. package/dist/ink/events/event-handlers.d.ts.map +1 -0
  185. package/dist/ink/events/event-handlers.js +34 -0
  186. package/dist/ink/events/event-handlers.js.map +1 -0
  187. package/dist/ink/events/event.d.ts +6 -0
  188. package/dist/ink/events/event.d.ts.map +1 -0
  189. package/dist/ink/events/event.js +16 -0
  190. package/dist/ink/events/event.js.map +1 -0
  191. package/dist/ink/events/focus-event.d.ts +14 -0
  192. package/dist/ink/events/focus-event.d.ts.map +1 -0
  193. package/dist/ink/events/focus-event.js +20 -0
  194. package/dist/ink/events/focus-event.js.map +1 -0
  195. package/dist/ink/events/input-event.d.ts +31 -0
  196. package/dist/ink/events/input-event.d.ts.map +1 -0
  197. package/dist/ink/events/input-event.js +163 -0
  198. package/dist/ink/events/input-event.js.map +1 -0
  199. package/dist/ink/events/keyboard-event.d.ts +20 -0
  200. package/dist/ink/events/keyboard-event.d.ts.map +1 -0
  201. package/dist/ink/events/keyboard-event.js +44 -0
  202. package/dist/ink/events/keyboard-event.js.map +1 -0
  203. package/dist/ink/events/terminal-event.d.ts +55 -0
  204. package/dist/ink/events/terminal-event.d.ts.map +1 -0
  205. package/dist/ink/events/terminal-event.js +79 -0
  206. package/dist/ink/events/terminal-event.js.map +1 -0
  207. package/dist/ink/events/terminal-focus-event.d.ts +14 -0
  208. package/dist/ink/events/terminal-focus-event.d.ts.map +1 -0
  209. package/dist/ink/events/terminal-focus-event.js +19 -0
  210. package/dist/ink/events/terminal-focus-event.js.map +1 -0
  211. package/dist/ink/focus.d.ts +44 -0
  212. package/dist/ink/focus.d.ts.map +1 -0
  213. package/dist/ink/focus.js +164 -0
  214. package/dist/ink/focus.js.map +1 -0
  215. package/dist/ink/frame.d.ts +95 -0
  216. package/dist/ink/frame.d.ts.map +1 -0
  217. package/dist/ink/frame.js +35 -0
  218. package/dist/ink/frame.js.map +1 -0
  219. package/dist/ink/get-max-width.d.ts +18 -0
  220. package/dist/ink/get-max-width.d.ts.map +1 -0
  221. package/dist/ink/get-max-width.js +26 -0
  222. package/dist/ink/get-max-width.js.map +1 -0
  223. package/dist/ink/hit-test.d.ts +34 -0
  224. package/dist/ink/hit-test.d.ts.map +1 -0
  225. package/dist/ink/hit-test.js +119 -0
  226. package/dist/ink/hit-test.js.map +1 -0
  227. package/dist/ink/hooks/use-animation-frame.d.ts +27 -0
  228. package/dist/ink/hooks/use-animation-frame.d.ts.map +1 -0
  229. package/dist/ink/hooks/use-animation-frame.js +52 -0
  230. package/dist/ink/hooks/use-animation-frame.js.map +1 -0
  231. package/dist/ink/hooks/use-app.d.ts +6 -0
  232. package/dist/ink/hooks/use-app.d.ts.map +1 -0
  233. package/dist/ink/hooks/use-app.js +13 -0
  234. package/dist/ink/hooks/use-app.js.map +1 -0
  235. package/dist/ink/hooks/use-declared-cursor.d.ts +27 -0
  236. package/dist/ink/hooks/use-declared-cursor.d.ts.map +1 -0
  237. package/dist/ink/hooks/use-declared-cursor.js +67 -0
  238. package/dist/ink/hooks/use-declared-cursor.js.map +1 -0
  239. package/dist/ink/hooks/use-input.d.ts +38 -0
  240. package/dist/ink/hooks/use-input.d.ts.map +1 -0
  241. package/dist/ink/hooks/use-input.js +86 -0
  242. package/dist/ink/hooks/use-input.js.map +1 -0
  243. package/dist/ink/hooks/use-interval.d.ts +19 -0
  244. package/dist/ink/hooks/use-interval.d.ts.map +1 -0
  245. package/dist/ink/hooks/use-interval.js +59 -0
  246. package/dist/ink/hooks/use-interval.js.map +1 -0
  247. package/dist/ink/hooks/use-search-highlight.d.ts +31 -0
  248. package/dist/ink/hooks/use-search-highlight.d.ts.map +1 -0
  249. package/dist/ink/hooks/use-search-highlight.js +39 -0
  250. package/dist/ink/hooks/use-search-highlight.js.map +1 -0
  251. package/dist/ink/hooks/use-selection.d.ts +40 -0
  252. package/dist/ink/hooks/use-selection.d.ts.map +1 -0
  253. package/dist/ink/hooks/use-selection.js +68 -0
  254. package/dist/ink/hooks/use-selection.js.map +1 -0
  255. package/dist/ink/hooks/use-stdin.d.ts +6 -0
  256. package/dist/ink/hooks/use-stdin.d.ts.map +1 -0
  257. package/dist/ink/hooks/use-stdin.js +13 -0
  258. package/dist/ink/hooks/use-stdin.js.map +1 -0
  259. package/dist/ink/hooks/use-tab-status.d.ts +14 -0
  260. package/dist/ink/hooks/use-tab-status.d.ts.map +1 -0
  261. package/dist/ink/hooks/use-tab-status.js +61 -0
  262. package/dist/ink/hooks/use-tab-status.js.map +1 -0
  263. package/dist/ink/hooks/use-terminal-focus.d.ts +11 -0
  264. package/dist/ink/hooks/use-terminal-focus.d.ts.map +1 -0
  265. package/dist/ink/hooks/use-terminal-focus.js +22 -0
  266. package/dist/ink/hooks/use-terminal-focus.js.map +1 -0
  267. package/dist/ink/hooks/use-terminal-title.d.ts +13 -0
  268. package/dist/ink/hooks/use-terminal-title.d.ts.map +1 -0
  269. package/dist/ink/hooks/use-terminal-title.js +36 -0
  270. package/dist/ink/hooks/use-terminal-title.js.map +1 -0
  271. package/dist/ink/hooks/use-terminal-viewport.d.ts +30 -0
  272. package/dist/ink/hooks/use-terminal-viewport.d.ts.map +1 -0
  273. package/dist/ink/hooks/use-terminal-viewport.js +81 -0
  274. package/dist/ink/hooks/use-terminal-viewport.js.map +1 -0
  275. package/dist/ink/index.d.ts +54 -0
  276. package/dist/ink/index.d.ts.map +1 -0
  277. package/dist/ink/index.js +111 -0
  278. package/dist/ink/index.js.map +1 -0
  279. package/dist/ink/ink.d.ts +371 -0
  280. package/dist/ink/ink.d.ts.map +1 -0
  281. package/dist/ink/ink.js +1686 -0
  282. package/dist/ink/ink.js.map +1 -0
  283. package/dist/ink/instances.d.ts +4 -0
  284. package/dist/ink/instances.d.ts.map +1 -0
  285. package/dist/ink/instances.js +10 -0
  286. package/dist/ink/instances.js.map +1 -0
  287. package/dist/ink/line-width-cache.d.ts +2 -0
  288. package/dist/ink/line-width-cache.d.ts.map +1 -0
  289. package/dist/ink/line-width-cache.js +23 -0
  290. package/dist/ink/line-width-cache.js.map +1 -0
  291. package/dist/ink/log-update.d.ts +18 -0
  292. package/dist/ink/log-update.d.ts.map +1 -0
  293. package/dist/ink/log-update.js +637 -0
  294. package/dist/ink/log-update.js.map +1 -0
  295. package/dist/ink/measure-element.d.ts +17 -0
  296. package/dist/ink/measure-element.d.ts.map +1 -0
  297. package/dist/ink/measure-element.js +11 -0
  298. package/dist/ink/measure-element.js.map +1 -0
  299. package/dist/ink/measure-text.d.ts +7 -0
  300. package/dist/ink/measure-text.d.ts.map +1 -0
  301. package/dist/ink/measure-text.js +38 -0
  302. package/dist/ink/measure-text.js.map +1 -0
  303. package/dist/ink/node-cache.d.ts +21 -0
  304. package/dist/ink/node-cache.d.ts.map +1 -0
  305. package/dist/ink/node-cache.js +36 -0
  306. package/dist/ink/node-cache.js.map +1 -0
  307. package/dist/ink/optimizer.d.ts +16 -0
  308. package/dist/ink/optimizer.d.ts.map +1 -0
  309. package/dist/ink/optimizer.js +85 -0
  310. package/dist/ink/optimizer.js.map +1 -0
  311. package/dist/ink/output.d.ts +120 -0
  312. package/dist/ink/output.d.ts.map +1 -0
  313. package/dist/ink/output.js +559 -0
  314. package/dist/ink/output.js.map +1 -0
  315. package/dist/ink/parse-keypress.d.ts +112 -0
  316. package/dist/ink/parse-keypress.d.ts.map +1 -0
  317. package/dist/ink/parse-keypress.js +719 -0
  318. package/dist/ink/parse-keypress.js.map +1 -0
  319. package/dist/ink/parse-keypress.test.d.ts +2 -0
  320. package/dist/ink/parse-keypress.test.d.ts.map +1 -0
  321. package/dist/ink/parse-keypress.test.js +37 -0
  322. package/dist/ink/parse-keypress.test.js.map +1 -0
  323. package/dist/ink/reconciler.d.ts +12 -0
  324. package/dist/ink/reconciler.d.ts.map +1 -0
  325. package/dist/ink/reconciler.js +456 -0
  326. package/dist/ink/reconciler.js.map +1 -0
  327. package/dist/ink/render-border.d.ts +25 -0
  328. package/dist/ink/render-border.d.ts.map +1 -0
  329. package/dist/ink/render-border.js +141 -0
  330. package/dist/ink/render-border.js.map +1 -0
  331. package/dist/ink/render-node-to-output.d.ts +46 -0
  332. package/dist/ink/render-node-to-output.d.ts.map +1 -0
  333. package/dist/ink/render-node-to-output.js +1257 -0
  334. package/dist/ink/render-node-to-output.js.map +1 -0
  335. package/dist/ink/render-to-screen.d.ts +47 -0
  336. package/dist/ink/render-to-screen.d.ts.map +1 -0
  337. package/dist/ink/render-to-screen.js +213 -0
  338. package/dist/ink/render-to-screen.js.map +1 -0
  339. package/dist/ink/renderer.d.ts +15 -0
  340. package/dist/ink/renderer.d.ts.map +1 -0
  341. package/dist/ink/renderer.js +169 -0
  342. package/dist/ink/renderer.js.map +1 -0
  343. package/dist/ink/root.d.ts +75 -0
  344. package/dist/ink/root.d.ts.map +1 -0
  345. package/dist/ink/root.js +89 -0
  346. package/dist/ink/root.js.map +1 -0
  347. package/dist/ink/screen.d.ts +270 -0
  348. package/dist/ink/screen.d.ts.map +1 -0
  349. package/dist/ink/screen.js +1194 -0
  350. package/dist/ink/screen.js.map +1 -0
  351. package/dist/ink/searchHighlight.d.ts +21 -0
  352. package/dist/ink/searchHighlight.d.ts.map +1 -0
  353. package/dist/ink/searchHighlight.js +82 -0
  354. package/dist/ink/searchHighlight.js.map +1 -0
  355. package/dist/ink/selection.d.ts +230 -0
  356. package/dist/ink/selection.d.ts.map +1 -0
  357. package/dist/ink/selection.js +814 -0
  358. package/dist/ink/selection.js.map +1 -0
  359. package/dist/ink/squash-text-nodes.d.ts +23 -0
  360. package/dist/ink/squash-text-nodes.d.ts.map +1 -0
  361. package/dist/ink/squash-text-nodes.js +60 -0
  362. package/dist/ink/squash-text-nodes.js.map +1 -0
  363. package/dist/ink/stringWidth.d.ts +2 -0
  364. package/dist/ink/stringWidth.d.ts.map +1 -0
  365. package/dist/ink/stringWidth.js +207 -0
  366. package/dist/ink/stringWidth.js.map +1 -0
  367. package/dist/ink/styles.d.ts +307 -0
  368. package/dist/ink/styles.d.ts.map +1 -0
  369. package/dist/ink/styles.js +302 -0
  370. package/dist/ink/styles.js.map +1 -0
  371. package/dist/ink/supports-hyperlinks.d.ts +14 -0
  372. package/dist/ink/supports-hyperlinks.d.ts.map +1 -0
  373. package/dist/ink/supports-hyperlinks.js +48 -0
  374. package/dist/ink/supports-hyperlinks.js.map +1 -0
  375. package/dist/ink/tabstops.d.ts +2 -0
  376. package/dist/ink/tabstops.d.ts.map +1 -0
  377. package/dist/ink/tabstops.js +43 -0
  378. package/dist/ink/tabstops.js.map +1 -0
  379. package/dist/ink/terminal-focus-state.d.ts +7 -0
  380. package/dist/ink/terminal-focus-state.d.ts.map +1 -0
  381. package/dist/ink/terminal-focus-state.js +43 -0
  382. package/dist/ink/terminal-focus-state.js.map +1 -0
  383. package/dist/ink/terminal-querier.d.ts +130 -0
  384. package/dist/ink/terminal-querier.d.ts.map +1 -0
  385. package/dist/ink/terminal-querier.js +184 -0
  386. package/dist/ink/terminal-querier.js.map +1 -0
  387. package/dist/ink/terminal.d.ts +56 -0
  388. package/dist/ink/terminal.d.ts.map +1 -0
  389. package/dist/ink/terminal.js +249 -0
  390. package/dist/ink/terminal.js.map +1 -0
  391. package/dist/ink/termio/csi.d.ts +166 -0
  392. package/dist/ink/termio/csi.d.ts.map +1 -0
  393. package/dist/ink/termio/csi.js +285 -0
  394. package/dist/ink/termio/csi.js.map +1 -0
  395. package/dist/ink/termio/dec.d.ts +38 -0
  396. package/dist/ink/termio/dec.d.ts.map +1 -0
  397. package/dist/ink/termio/dec.js +59 -0
  398. package/dist/ink/termio/dec.js.map +1 -0
  399. package/dist/ink/termio.d.ts +25 -0
  400. package/dist/ink/termio.d.ts.map +1 -0
  401. package/dist/ink/termio.js +32 -0
  402. package/dist/ink/termio.js.map +1 -0
  403. package/dist/ink/useTerminalNotification.d.ts +27 -0
  404. package/dist/ink/useTerminalNotification.d.ts.map +1 -0
  405. package/dist/ink/useTerminalNotification.js +62 -0
  406. package/dist/ink/useTerminalNotification.js.map +1 -0
  407. package/dist/ink/warn.d.ts +2 -0
  408. package/dist/ink/warn.d.ts.map +1 -0
  409. package/dist/ink/warn.js +14 -0
  410. package/dist/ink/warn.js.map +1 -0
  411. package/dist/ink/widest-line.d.ts +2 -0
  412. package/dist/ink/widest-line.d.ts.map +1 -0
  413. package/dist/ink/widest-line.js +18 -0
  414. package/dist/ink/widest-line.js.map +1 -0
  415. package/dist/ink/wrap-text.d.ts +3 -0
  416. package/dist/ink/wrap-text.d.ts.map +1 -0
  417. package/dist/ink/wrap-text.js +61 -0
  418. package/dist/ink/wrap-text.js.map +1 -0
  419. package/dist/ink/wrapAnsi.d.ts +8 -0
  420. package/dist/ink/wrapAnsi.d.ts.map +1 -0
  421. package/dist/ink/wrapAnsi.js +13 -0
  422. package/dist/ink/wrapAnsi.js.map +1 -0
  423. package/dist/memory/embeddings.d.ts +33 -0
  424. package/dist/memory/embeddings.d.ts.map +1 -0
  425. package/dist/memory/embeddings.js +123 -0
  426. package/dist/memory/embeddings.js.map +1 -0
  427. package/dist/memory/index.d.ts +14 -0
  428. package/dist/memory/index.d.ts.map +1 -0
  429. package/dist/memory/index.js +31 -0
  430. package/dist/memory/index.js.map +1 -0
  431. package/dist/memory/prompts.d.ts +12 -0
  432. package/dist/memory/prompts.d.ts.map +1 -0
  433. package/dist/memory/prompts.js +117 -0
  434. package/dist/memory/prompts.js.map +1 -0
  435. package/dist/memory/semantic-search.d.ts +45 -0
  436. package/dist/memory/semantic-search.d.ts.map +1 -0
  437. package/dist/memory/semantic-search.js +112 -0
  438. package/dist/memory/semantic-search.js.map +1 -0
  439. package/dist/memory/storage.d.ts +79 -0
  440. package/dist/memory/storage.d.ts.map +1 -0
  441. package/dist/memory/storage.js +285 -0
  442. package/dist/memory/storage.js.map +1 -0
  443. package/dist/memory/store.d.ts +103 -0
  444. package/dist/memory/store.d.ts.map +1 -0
  445. package/dist/memory/store.js +226 -0
  446. package/dist/memory/store.js.map +1 -0
  447. package/dist/memory/types.d.ts +40 -0
  448. package/dist/memory/types.d.ts.map +1 -0
  449. package/dist/memory/types.js +71 -0
  450. package/dist/memory/types.js.map +1 -0
  451. package/dist/memory/validation.d.ts +28 -0
  452. package/dist/memory/validation.d.ts.map +1 -0
  453. package/dist/memory/validation.js +147 -0
  454. package/dist/memory/validation.js.map +1 -0
  455. package/dist/memory/vector-store.d.ts +49 -0
  456. package/dist/memory/vector-store.d.ts.map +1 -0
  457. package/dist/memory/vector-store.js +259 -0
  458. package/dist/memory/vector-store.js.map +1 -0
  459. package/dist/screens/REPL.d.ts +21 -0
  460. package/dist/screens/REPL.d.ts.map +1 -0
  461. package/dist/screens/REPL.js +139 -0
  462. package/dist/screens/REPL.js.map +1 -0
  463. package/dist/services/agent-runner.d.ts +68 -0
  464. package/dist/services/agent-runner.d.ts.map +1 -0
  465. package/dist/services/agent-runner.js +186 -0
  466. package/dist/services/agent-runner.js.map +1 -0
  467. package/dist/services/atomic-write.d.ts +12 -0
  468. package/dist/services/atomic-write.d.ts.map +1 -0
  469. package/dist/services/atomic-write.js +27 -0
  470. package/dist/services/atomic-write.js.map +1 -0
  471. package/dist/services/config-dir.d.ts +55 -0
  472. package/dist/services/config-dir.d.ts.map +1 -0
  473. package/dist/services/config-dir.js +136 -0
  474. package/dist/services/config-dir.js.map +1 -0
  475. package/dist/services/config.d.ts +54 -0
  476. package/dist/services/config.d.ts.map +1 -0
  477. package/dist/services/config.js +98 -0
  478. package/dist/services/config.js.map +1 -0
  479. package/dist/services/file-glob.d.ts +26 -0
  480. package/dist/services/file-glob.d.ts.map +1 -0
  481. package/dist/services/file-glob.js +134 -0
  482. package/dist/services/file-glob.js.map +1 -0
  483. package/dist/services/global-config.d.ts +109 -0
  484. package/dist/services/global-config.d.ts.map +1 -0
  485. package/dist/services/global-config.js +211 -0
  486. package/dist/services/global-config.js.map +1 -0
  487. package/dist/services/llm.d.ts +139 -0
  488. package/dist/services/llm.d.ts.map +1 -0
  489. package/dist/services/llm.js +376 -0
  490. package/dist/services/llm.js.map +1 -0
  491. package/dist/services/memory.d.ts +39 -0
  492. package/dist/services/memory.d.ts.map +1 -0
  493. package/dist/services/memory.js +88 -0
  494. package/dist/services/memory.js.map +1 -0
  495. package/dist/services/session-storage.d.ts +136 -0
  496. package/dist/services/session-storage.d.ts.map +1 -0
  497. package/dist/services/session-storage.js +304 -0
  498. package/dist/services/session-storage.js.map +1 -0
  499. package/dist/services/task-manager.d.ts +154 -0
  500. package/dist/services/task-manager.d.ts.map +1 -0
  501. package/dist/services/task-manager.js +288 -0
  502. package/dist/services/task-manager.js.map +1 -0
  503. package/dist/services/yaml-config.d.ts +57 -0
  504. package/dist/services/yaml-config.d.ts.map +1 -0
  505. package/dist/services/yaml-config.js +176 -0
  506. package/dist/services/yaml-config.js.map +1 -0
  507. package/dist/skills/discovery.d.ts +22 -0
  508. package/dist/skills/discovery.d.ts.map +1 -0
  509. package/dist/skills/discovery.js +75 -0
  510. package/dist/skills/discovery.js.map +1 -0
  511. package/dist/skills/index.d.ts +10 -0
  512. package/dist/skills/index.d.ts.map +1 -0
  513. package/dist/skills/index.js +26 -0
  514. package/dist/skills/index.js.map +1 -0
  515. package/dist/skills/loader.d.ts +48 -0
  516. package/dist/skills/loader.d.ts.map +1 -0
  517. package/dist/skills/loader.js +231 -0
  518. package/dist/skills/loader.js.map +1 -0
  519. package/dist/skills/registry.d.ts +37 -0
  520. package/dist/skills/registry.d.ts.map +1 -0
  521. package/dist/skills/registry.js +134 -0
  522. package/dist/skills/registry.js.map +1 -0
  523. package/dist/skills/types.d.ts +89 -0
  524. package/dist/skills/types.d.ts.map +1 -0
  525. package/dist/skills/types.js +24 -0
  526. package/dist/skills/types.js.map +1 -0
  527. package/dist/tools/bash_security.d.ts +64 -0
  528. package/dist/tools/bash_security.d.ts.map +1 -0
  529. package/dist/tools/bash_security.js +291 -0
  530. package/dist/tools/bash_security.js.map +1 -0
  531. package/dist/tools/index.d.ts +23 -0
  532. package/dist/tools/index.d.ts.map +1 -0
  533. package/dist/tools/index.js +965 -0
  534. package/dist/tools/index.js.map +1 -0
  535. package/dist/tools/mcp.d.ts +72 -0
  536. package/dist/tools/mcp.d.ts.map +1 -0
  537. package/dist/tools/mcp.js +422 -0
  538. package/dist/tools/mcp.js.map +1 -0
  539. package/dist/tools/plan.d.ts +18 -0
  540. package/dist/tools/plan.d.ts.map +1 -0
  541. package/dist/tools/plan.js +75 -0
  542. package/dist/tools/plan.js.map +1 -0
  543. package/dist/tools/todo.d.ts +18 -0
  544. package/dist/tools/todo.d.ts.map +1 -0
  545. package/dist/tools/todo.js +153 -0
  546. package/dist/tools/todo.js.map +1 -0
  547. package/dist/tools/web.d.ts +13 -0
  548. package/dist/tools/web.d.ts.map +1 -0
  549. package/dist/tools/web.js +377 -0
  550. package/dist/tools/web.js.map +1 -0
  551. package/dist/ui/box.d.ts +56 -0
  552. package/dist/ui/box.d.ts.map +1 -0
  553. package/dist/ui/box.js +241 -0
  554. package/dist/ui/box.js.map +1 -0
  555. package/dist/ui/command-panel.d.ts +55 -0
  556. package/dist/ui/command-panel.d.ts.map +1 -0
  557. package/dist/ui/command-panel.js +212 -0
  558. package/dist/ui/command-panel.js.map +1 -0
  559. package/dist/ui/file-completion.d.ts +62 -0
  560. package/dist/ui/file-completion.d.ts.map +1 -0
  561. package/dist/ui/file-completion.js +209 -0
  562. package/dist/ui/file-completion.js.map +1 -0
  563. package/dist/ui/markdown.d.ts +12 -0
  564. package/dist/ui/markdown.d.ts.map +1 -0
  565. package/dist/ui/markdown.js +215 -0
  566. package/dist/ui/markdown.js.map +1 -0
  567. package/dist/ui/multiline-input.d.ts +47 -0
  568. package/dist/ui/multiline-input.d.ts.map +1 -0
  569. package/dist/ui/multiline-input.js +94 -0
  570. package/dist/ui/multiline-input.js.map +1 -0
  571. package/dist/ui/status-bar.d.ts +33 -0
  572. package/dist/ui/status-bar.d.ts.map +1 -0
  573. package/dist/ui/status-bar.js +96 -0
  574. package/dist/ui/status-bar.js.map +1 -0
  575. package/dist/ui/stream-markdown.d.ts +35 -0
  576. package/dist/ui/stream-markdown.d.ts.map +1 -0
  577. package/dist/ui/stream-markdown.js +138 -0
  578. package/dist/ui/stream-markdown.js.map +1 -0
  579. package/dist/ui/suggestions.d.ts +35 -0
  580. package/dist/ui/suggestions.d.ts.map +1 -0
  581. package/dist/ui/suggestions.js +118 -0
  582. package/dist/ui/suggestions.js.map +1 -0
  583. package/dist/ui/tool-preview.d.ts +34 -0
  584. package/dist/ui/tool-preview.d.ts.map +1 -0
  585. package/dist/ui/tool-preview.js +128 -0
  586. package/dist/ui/tool-preview.js.map +1 -0
  587. package/package.json +93 -0
@@ -0,0 +1,34 @@
1
+ import type { DOMElement } from './dom.js';
2
+ /**
3
+ * Find the deepest DOM element whose rendered rect contains (col, row).
4
+ *
5
+ * Uses the nodeCache populated by renderNodeToOutput — rects are in screen
6
+ * coordinates with all offsets (including scrollTop translation) already
7
+ * applied. Children are traversed in reverse so later siblings (painted on
8
+ * top) win. Nodes not in nodeCache (not rendered this frame, or lacking a
9
+ * yogaNode) are skipped along with their subtrees.
10
+ *
11
+ * Returns the hit node even if it has no onClick — dispatchClick walks up
12
+ * via parentNode to find handlers.
13
+ */
14
+ export declare function hitTest(node: DOMElement, col: number, row: number): DOMElement | null;
15
+ /**
16
+ * Hit-test the root at (col, row) and bubble a ClickEvent from the deepest
17
+ * containing node up through parentNode. Only nodes with an onClick handler
18
+ * fire. Stops when a handler calls stopImmediatePropagation(). Returns
19
+ * true if at least one onClick handler fired.
20
+ */
21
+ export declare function dispatchClick(root: DOMElement, col: number, row: number, cellIsBlank?: boolean): boolean;
22
+ /**
23
+ * Fire onMouseEnter/onMouseLeave as the pointer moves. Like DOM
24
+ * mouseenter/mouseleave: does NOT bubble — moving between children does
25
+ * not re-fire on the parent. Walks up from the hit node collecting every
26
+ * ancestor with a hover handler; diffs against the previous hovered set;
27
+ * fires leave on the nodes exited, enter on the nodes entered.
28
+ *
29
+ * Mutates `hovered` in place so the caller (App instance) can hold it
30
+ * across calls. Clears the set when the hit is null (cursor moved into a
31
+ * non-rendered gap or off the root rect).
32
+ */
33
+ export declare function dispatchHover(root: DOMElement, col: number, row: number, hovered: Set<DOMElement>): void;
34
+ //# sourceMappingURL=hit-test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hit-test.d.ts","sourceRoot":"","sources":["../../src/ink/hit-test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAK1C;;;;;;;;;;;GAWG;AACH,wBAAgB,OAAO,CACrB,IAAI,EAAE,UAAU,EAChB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,GACV,UAAU,GAAG,IAAI,CAmBnB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,UAAU,EAChB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,WAAW,UAAQ,GAClB,OAAO,CAmCT;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,UAAU,EAChB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,GAAG,CAAC,UAAU,CAAC,GACvB,IAAI,CAuBN"}
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hitTest = hitTest;
4
+ exports.dispatchClick = dispatchClick;
5
+ exports.dispatchHover = dispatchHover;
6
+ const click_event_js_1 = require("./events/click-event.js");
7
+ const node_cache_js_1 = require("./node-cache.js");
8
+ /**
9
+ * Find the deepest DOM element whose rendered rect contains (col, row).
10
+ *
11
+ * Uses the nodeCache populated by renderNodeToOutput — rects are in screen
12
+ * coordinates with all offsets (including scrollTop translation) already
13
+ * applied. Children are traversed in reverse so later siblings (painted on
14
+ * top) win. Nodes not in nodeCache (not rendered this frame, or lacking a
15
+ * yogaNode) are skipped along with their subtrees.
16
+ *
17
+ * Returns the hit node even if it has no onClick — dispatchClick walks up
18
+ * via parentNode to find handlers.
19
+ */
20
+ function hitTest(node, col, row) {
21
+ const rect = node_cache_js_1.nodeCache.get(node);
22
+ if (!rect)
23
+ return null;
24
+ if (col < rect.x ||
25
+ col >= rect.x + rect.width ||
26
+ row < rect.y ||
27
+ row >= rect.y + rect.height) {
28
+ return null;
29
+ }
30
+ // Later siblings paint on top; reversed traversal returns topmost hit.
31
+ for (let i = node.childNodes.length - 1; i >= 0; i--) {
32
+ const child = node.childNodes[i];
33
+ if (child.nodeName === '#text')
34
+ continue;
35
+ const hit = hitTest(child, col, row);
36
+ if (hit)
37
+ return hit;
38
+ }
39
+ return node;
40
+ }
41
+ /**
42
+ * Hit-test the root at (col, row) and bubble a ClickEvent from the deepest
43
+ * containing node up through parentNode. Only nodes with an onClick handler
44
+ * fire. Stops when a handler calls stopImmediatePropagation(). Returns
45
+ * true if at least one onClick handler fired.
46
+ */
47
+ function dispatchClick(root, col, row, cellIsBlank = false) {
48
+ let target = hitTest(root, col, row) ?? undefined;
49
+ if (!target)
50
+ return false;
51
+ // Click-to-focus: find the closest focusable ancestor and focus it.
52
+ // root is always ink-root, which owns the FocusManager.
53
+ if (root.focusManager) {
54
+ let focusTarget = target;
55
+ while (focusTarget) {
56
+ if (typeof focusTarget.attributes['tabIndex'] === 'number') {
57
+ root.focusManager.handleClickFocus(focusTarget);
58
+ break;
59
+ }
60
+ focusTarget = focusTarget.parentNode;
61
+ }
62
+ }
63
+ const event = new click_event_js_1.ClickEvent(col, row, cellIsBlank);
64
+ let handled = false;
65
+ while (target) {
66
+ const handler = target._eventHandlers?.onClick;
67
+ if (handler) {
68
+ handled = true;
69
+ const rect = node_cache_js_1.nodeCache.get(target);
70
+ if (rect) {
71
+ event.localCol = col - rect.x;
72
+ event.localRow = row - rect.y;
73
+ }
74
+ handler(event);
75
+ if (event.didStopImmediatePropagation())
76
+ return true;
77
+ }
78
+ target = target.parentNode;
79
+ }
80
+ return handled;
81
+ }
82
+ /**
83
+ * Fire onMouseEnter/onMouseLeave as the pointer moves. Like DOM
84
+ * mouseenter/mouseleave: does NOT bubble — moving between children does
85
+ * not re-fire on the parent. Walks up from the hit node collecting every
86
+ * ancestor with a hover handler; diffs against the previous hovered set;
87
+ * fires leave on the nodes exited, enter on the nodes entered.
88
+ *
89
+ * Mutates `hovered` in place so the caller (App instance) can hold it
90
+ * across calls. Clears the set when the hit is null (cursor moved into a
91
+ * non-rendered gap or off the root rect).
92
+ */
93
+ function dispatchHover(root, col, row, hovered) {
94
+ const next = new Set();
95
+ let node = hitTest(root, col, row) ?? undefined;
96
+ while (node) {
97
+ const h = node._eventHandlers;
98
+ if (h?.onMouseEnter || h?.onMouseLeave)
99
+ next.add(node);
100
+ node = node.parentNode;
101
+ }
102
+ for (const old of hovered) {
103
+ if (!next.has(old)) {
104
+ hovered.delete(old);
105
+ // Skip handlers on detached nodes (removed between mouse events)
106
+ if (old.parentNode) {
107
+ ;
108
+ old._eventHandlers?.onMouseLeave?.();
109
+ }
110
+ }
111
+ }
112
+ for (const n of next) {
113
+ if (!hovered.has(n)) {
114
+ hovered.add(n);
115
+ n._eventHandlers?.onMouseEnter?.();
116
+ }
117
+ }
118
+ }
119
+ //# sourceMappingURL=hit-test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hit-test.js","sourceRoot":"","sources":["../../src/ink/hit-test.ts"],"names":[],"mappings":";;AAiBA,0BAuBC;AAQD,sCAwCC;AAaD,sCA4BC;AAhID,4DAAoD;AAEpD,mDAA2C;AAE3C;;;;;;;;;;;GAWG;AACH,SAAgB,OAAO,CACrB,IAAgB,EAChB,GAAW,EACX,GAAW;IAEX,MAAM,IAAI,GAAG,yBAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IAChC,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAA;IACtB,IACE,GAAG,GAAG,IAAI,CAAC,CAAC;QACZ,GAAG,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK;QAC1B,GAAG,GAAG,IAAI,CAAC,CAAC;QACZ,GAAG,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,EAC3B,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IACD,uEAAuE;IACvE,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACrD,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAE,CAAA;QACjC,IAAI,KAAK,CAAC,QAAQ,KAAK,OAAO;YAAE,SAAQ;QACxC,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;QACpC,IAAI,GAAG;YAAE,OAAO,GAAG,CAAA;IACrB,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;;;GAKG;AACH,SAAgB,aAAa,CAC3B,IAAgB,EAChB,GAAW,EACX,GAAW,EACX,WAAW,GAAG,KAAK;IAEnB,IAAI,MAAM,GAA2B,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,SAAS,CAAA;IACzE,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAA;IAEzB,oEAAoE;IACpE,wDAAwD;IACxD,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;QACtB,IAAI,WAAW,GAA2B,MAAM,CAAA;QAChD,OAAO,WAAW,EAAE,CAAC;YACnB,IAAI,OAAO,WAAW,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,QAAQ,EAAE,CAAC;gBAC3D,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAA;gBAC/C,MAAK;YACP,CAAC;YACD,WAAW,GAAG,WAAW,CAAC,UAAU,CAAA;QACtC,CAAC;IACH,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,2BAAU,CAAC,GAAG,EAAE,GAAG,EAAE,WAAW,CAAC,CAAA;IACnD,IAAI,OAAO,GAAG,KAAK,CAAA;IACnB,OAAO,MAAM,EAAE,CAAC;QACd,MAAM,OAAO,GAAG,MAAM,CAAC,cAAc,EAAE,OAE1B,CAAA;QACb,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,GAAG,IAAI,CAAA;YACd,MAAM,IAAI,GAAG,yBAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;YAClC,IAAI,IAAI,EAAE,CAAC;gBACT,KAAK,CAAC,QAAQ,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC,CAAA;gBAC7B,KAAK,CAAC,QAAQ,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC,CAAA;YAC/B,CAAC;YACD,OAAO,CAAC,KAAK,CAAC,CAAA;YACd,IAAI,KAAK,CAAC,2BAA2B,EAAE;gBAAE,OAAO,IAAI,CAAA;QACtD,CAAC;QACD,MAAM,GAAG,MAAM,CAAC,UAAU,CAAA;IAC5B,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,aAAa,CAC3B,IAAgB,EAChB,GAAW,EACX,GAAW,EACX,OAAwB;IAExB,MAAM,IAAI,GAAG,IAAI,GAAG,EAAc,CAAA;IAClC,IAAI,IAAI,GAA2B,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,SAAS,CAAA;IACvE,OAAO,IAAI,EAAE,CAAC;QACZ,MAAM,CAAC,GAAG,IAAI,CAAC,cAA+C,CAAA;QAC9D,IAAI,CAAC,EAAE,YAAY,IAAI,CAAC,EAAE,YAAY;YAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACtD,IAAI,GAAG,IAAI,CAAC,UAAU,CAAA;IACxB,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC1B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACnB,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;YACnB,iEAAiE;YACjE,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC;gBACnB,CAAC;gBAAC,GAAG,CAAC,cAAgD,EAAE,YAAY,EAAE,EAAE,CAAA;YAC1E,CAAC;QACH,CAAC;IACH,CAAC;IACD,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;QACrB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YACpB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CACb;YAAC,CAAC,CAAC,cAAgD,EAAE,YAAY,EAAE,EAAE,CAAA;QACxE,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { DOMElement } from '../dom.js';
2
+ /**
3
+ * Hook for synchronized animations that pause when offscreen.
4
+ *
5
+ * Returns a ref to attach to the animated element and the current animation time.
6
+ * All instances share the same clock, so animations stay in sync.
7
+ * The clock only runs when at least one keepAlive subscriber exists.
8
+ *
9
+ * Pass `null` to pause — unsubscribes from the clock so no ticks fire.
10
+ * Time freezes at the last value and resumes from the current clock time
11
+ * when a number is passed again.
12
+ *
13
+ * @param intervalMs - How often to update, or null to pause
14
+ * @returns [ref, time] - Ref to attach to element, elapsed time in ms
15
+ *
16
+ * @example
17
+ * function Spinner() {
18
+ * const [ref, time] = useAnimationFrame(120)
19
+ * const frame = Math.floor(time / 120) % FRAMES.length
20
+ * return <Box ref={ref}>{FRAMES[frame]}</Box>
21
+ * }
22
+ *
23
+ * The clock automatically slows when the terminal is blurred,
24
+ * so consumers don't need to handle focus state.
25
+ */
26
+ export declare function useAnimationFrame(intervalMs?: number | null): [ref: (element: DOMElement | null) => void, time: number];
27
+ //# sourceMappingURL=use-animation-frame.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-animation-frame.d.ts","sourceRoot":"","sources":["../../../src/ink/hooks/use-animation-frame.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAG3C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,GAAE,MAAM,GAAG,IAAS,GAC7B,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,KAAK,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAyB3D"}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useAnimationFrame = useAnimationFrame;
4
+ const react_1 = require("react");
5
+ const ClockContext_js_1 = require("../components/ClockContext.js");
6
+ const use_terminal_viewport_js_1 = require("./use-terminal-viewport.js");
7
+ /**
8
+ * Hook for synchronized animations that pause when offscreen.
9
+ *
10
+ * Returns a ref to attach to the animated element and the current animation time.
11
+ * All instances share the same clock, so animations stay in sync.
12
+ * The clock only runs when at least one keepAlive subscriber exists.
13
+ *
14
+ * Pass `null` to pause — unsubscribes from the clock so no ticks fire.
15
+ * Time freezes at the last value and resumes from the current clock time
16
+ * when a number is passed again.
17
+ *
18
+ * @param intervalMs - How often to update, or null to pause
19
+ * @returns [ref, time] - Ref to attach to element, elapsed time in ms
20
+ *
21
+ * @example
22
+ * function Spinner() {
23
+ * const [ref, time] = useAnimationFrame(120)
24
+ * const frame = Math.floor(time / 120) % FRAMES.length
25
+ * return <Box ref={ref}>{FRAMES[frame]}</Box>
26
+ * }
27
+ *
28
+ * The clock automatically slows when the terminal is blurred,
29
+ * so consumers don't need to handle focus state.
30
+ */
31
+ function useAnimationFrame(intervalMs = 16) {
32
+ const clock = (0, react_1.useContext)(ClockContext_js_1.ClockContext);
33
+ const [viewportRef, { isVisible }] = (0, use_terminal_viewport_js_1.useTerminalViewport)();
34
+ const [time, setTime] = (0, react_1.useState)(() => clock?.now() ?? 0);
35
+ const active = isVisible && intervalMs !== null;
36
+ (0, react_1.useEffect)(() => {
37
+ if (!clock || !active)
38
+ return;
39
+ let lastUpdate = clock.now();
40
+ const onChange = () => {
41
+ const now = clock.now();
42
+ if (now - lastUpdate >= intervalMs) {
43
+ lastUpdate = now;
44
+ setTime(now);
45
+ }
46
+ };
47
+ // keepAlive: true — visible animations drive the clock
48
+ return clock.subscribe(onChange, true);
49
+ }, [clock, intervalMs, active]);
50
+ return [viewportRef, time];
51
+ }
52
+ //# sourceMappingURL=use-animation-frame.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-animation-frame.js","sourceRoot":"","sources":["../../../src/ink/hooks/use-animation-frame.ts"],"names":[],"mappings":";;AA6BA,8CA2BC;AAxDD,iCAAuD;AACvD,mEAA4D;AAE5D,yEAAgE;AAEhE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,SAAgB,iBAAiB,CAC/B,aAA4B,EAAE;IAE9B,MAAM,KAAK,GAAG,IAAA,kBAAU,EAAC,8BAAY,CAAC,CAAA;IACtC,MAAM,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,CAAC,GAAG,IAAA,8CAAmB,GAAE,CAAA;IAC1D,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAA,gBAAQ,EAAC,GAAG,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,CAAA;IAEzD,MAAM,MAAM,GAAG,SAAS,IAAI,UAAU,KAAK,IAAI,CAAA;IAE/C,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM;YAAE,OAAM;QAE7B,IAAI,UAAU,GAAG,KAAK,CAAC,GAAG,EAAE,CAAA;QAE5B,MAAM,QAAQ,GAAG,GAAS,EAAE;YAC1B,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,EAAE,CAAA;YACvB,IAAI,GAAG,GAAG,UAAU,IAAI,UAAW,EAAE,CAAC;gBACpC,UAAU,GAAG,GAAG,CAAA;gBAChB,OAAO,CAAC,GAAG,CAAC,CAAA;YACd,CAAC;QACH,CAAC,CAAA;QAED,uDAAuD;QACvD,OAAO,KAAK,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;IACxC,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,CAAA;IAE/B,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,CAAA;AAC5B,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * `useApp` is a React hook, which exposes a method to manually exit the app (unmount).
3
+ */
4
+ declare const useApp: () => any;
5
+ export default useApp;
6
+ //# sourceMappingURL=use-app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-app.d.ts","sourceRoot":"","sources":["../../../src/ink/hooks/use-app.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,QAAA,MAAM,MAAM,WAA+B,CAAA;AAC3C,eAAe,MAAM,CAAA"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = require("react");
7
+ const AppContext_js_1 = __importDefault(require("../components/AppContext.js"));
8
+ /**
9
+ * `useApp` is a React hook, which exposes a method to manually exit the app (unmount).
10
+ */
11
+ const useApp = () => (0, react_1.useContext)(AppContext_js_1.default);
12
+ exports.default = useApp;
13
+ //# sourceMappingURL=use-app.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-app.js","sourceRoot":"","sources":["../../../src/ink/hooks/use-app.ts"],"names":[],"mappings":";;;;;AAAA,iCAAkC;AAClC,gFAAoD;AAEpD;;GAEG;AACH,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,IAAA,kBAAU,EAAC,uBAAU,CAAC,CAAA;AAC3C,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,27 @@
1
+ import type { DOMElement } from '../dom.js';
2
+ /**
3
+ * Declares where the terminal cursor should be parked after each frame.
4
+ *
5
+ * Terminal emulators render IME preedit text at the physical cursor
6
+ * position, and screen readers / screen magnifiers track the native
7
+ * cursor — so parking it at the text input's caret makes CJK input
8
+ * appear inline and lets accessibility tools follow the input.
9
+ *
10
+ * Returns a ref callback to attach to the Box that contains the input.
11
+ * The declared (line, column) is interpreted relative to that Box's
12
+ * nodeCache rect (populated by renderNodeToOutput).
13
+ *
14
+ * Timing: Both ref attach and useLayoutEffect fire in React's layout
15
+ * phase — after resetAfterCommit calls scheduleRender. scheduleRender
16
+ * defers onRender via queueMicrotask, so onRender runs AFTER layout
17
+ * effects commit and reads the fresh declaration on the first frame
18
+ * (no one-keystroke lag). Test env uses onImmediateRender (synchronous,
19
+ * no microtask), so tests compensate by calling ink.onRender()
20
+ * explicitly after render.
21
+ */
22
+ export declare function useDeclaredCursor({ line, column, active, }: {
23
+ line: number;
24
+ column: number;
25
+ active: boolean;
26
+ }): (element: DOMElement | null) => void;
27
+ //# sourceMappingURL=use-declared-cursor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-declared-cursor.d.ts","sourceRoot":"","sources":["../../../src/ink/hooks/use-declared-cursor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAE3C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,MAAM,EACN,MAAM,GACP,EAAE;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,OAAO,CAAA;CAChB,GAAG,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,KAAK,IAAI,CAwCvC"}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.useDeclaredCursor = useDeclaredCursor;
7
+ const react_1 = require("react");
8
+ const CursorDeclarationContext_js_1 = __importDefault(require("../components/CursorDeclarationContext.js"));
9
+ /**
10
+ * Declares where the terminal cursor should be parked after each frame.
11
+ *
12
+ * Terminal emulators render IME preedit text at the physical cursor
13
+ * position, and screen readers / screen magnifiers track the native
14
+ * cursor — so parking it at the text input's caret makes CJK input
15
+ * appear inline and lets accessibility tools follow the input.
16
+ *
17
+ * Returns a ref callback to attach to the Box that contains the input.
18
+ * The declared (line, column) is interpreted relative to that Box's
19
+ * nodeCache rect (populated by renderNodeToOutput).
20
+ *
21
+ * Timing: Both ref attach and useLayoutEffect fire in React's layout
22
+ * phase — after resetAfterCommit calls scheduleRender. scheduleRender
23
+ * defers onRender via queueMicrotask, so onRender runs AFTER layout
24
+ * effects commit and reads the fresh declaration on the first frame
25
+ * (no one-keystroke lag). Test env uses onImmediateRender (synchronous,
26
+ * no microtask), so tests compensate by calling ink.onRender()
27
+ * explicitly after render.
28
+ */
29
+ function useDeclaredCursor({ line, column, active, }) {
30
+ const setCursorDeclaration = (0, react_1.useContext)(CursorDeclarationContext_js_1.default);
31
+ const nodeRef = (0, react_1.useRef)(null);
32
+ const setNode = (0, react_1.useCallback)((node) => {
33
+ nodeRef.current = node;
34
+ }, []);
35
+ // When active, set unconditionally. When inactive, clear conditionally
36
+ // (only if the currently-declared node is ours). The node-identity check
37
+ // handles two hazards:
38
+ // 1. A memo()ized active instance elsewhere (e.g. the search input in
39
+ // a memo'd Footer) doesn't re-render this commit — an inactive
40
+ // instance re-rendering here must not clobber it.
41
+ // 2. Sibling handoff (menu focus moving between list items) — when
42
+ // focus moves opposite to sibling order, the newly-inactive item's
43
+ // effect runs AFTER the newly-active item's set. Without the node
44
+ // check it would clobber.
45
+ // No dep array: must re-declare every commit so the active instance
46
+ // re-claims the declaration after another instance's unmount-cleanup or
47
+ // sibling handoff nulls it.
48
+ (0, react_1.useLayoutEffect)(() => {
49
+ const node = nodeRef.current;
50
+ if (active && node) {
51
+ setCursorDeclaration({ relativeX: column, relativeY: line, node });
52
+ }
53
+ else {
54
+ setCursorDeclaration(null, node);
55
+ }
56
+ });
57
+ // Clear on unmount (conditionally — another instance may own by then).
58
+ // Separate effect with empty deps so cleanup only fires once — not on
59
+ // every line/column change, which would transiently null between commits.
60
+ (0, react_1.useLayoutEffect)(() => {
61
+ return () => {
62
+ setCursorDeclaration(null, nodeRef.current);
63
+ };
64
+ }, [setCursorDeclaration]);
65
+ return setNode;
66
+ }
67
+ //# sourceMappingURL=use-declared-cursor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-declared-cursor.js","sourceRoot":"","sources":["../../../src/ink/hooks/use-declared-cursor.ts"],"names":[],"mappings":";;;;;AAwBA,8CAgDC;AAxED,iCAAwE;AACxE,4GAAgF;AAGhF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,MAAM,EACN,MAAM,GAKP;IACC,MAAM,oBAAoB,GAAG,IAAA,kBAAU,EAAC,qCAAwB,CAAC,CAAA;IACjE,MAAM,OAAO,GAAG,IAAA,cAAM,EAAoB,IAAI,CAAC,CAAA;IAE/C,MAAM,OAAO,GAAG,IAAA,mBAAW,EAAC,CAAC,IAAuB,EAAE,EAAE;QACtD,OAAO,CAAC,OAAO,GAAG,IAAI,CAAA;IACxB,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,uEAAuE;IACvE,yEAAyE;IACzE,uBAAuB;IACvB,wEAAwE;IACxE,oEAAoE;IACpE,uDAAuD;IACvD,qEAAqE;IACrE,wEAAwE;IACxE,uEAAuE;IACvE,+BAA+B;IAC/B,oEAAoE;IACpE,wEAAwE;IACxE,4BAA4B;IAC5B,IAAA,uBAAe,EAAC,GAAG,EAAE;QACnB,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAA;QAC5B,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;YACnB,oBAAoB,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;QACpE,CAAC;aAAM,CAAC;YACN,oBAAoB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;QAClC,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,uEAAuE;IACvE,sEAAsE;IACtE,0EAA0E;IAC1E,IAAA,uBAAe,EAAC,GAAG,EAAE;QACnB,OAAO,GAAG,EAAE;YACV,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;QAC7C,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAA;IAE1B,OAAO,OAAO,CAAA;AAChB,CAAC"}
@@ -0,0 +1,38 @@
1
+ import type { InputEvent, Key } from '../events/input-event.js';
2
+ type Handler = (input: string, key: Key, event: InputEvent) => void;
3
+ type Options = {
4
+ /**
5
+ * Enable or disable capturing of user input.
6
+ * Useful when there are multiple useInput hooks used at once to avoid handling the same input several times.
7
+ *
8
+ * @default true
9
+ */
10
+ isActive?: boolean;
11
+ };
12
+ /**
13
+ * This hook is used for handling user input.
14
+ * It's a more convenient alternative to using `StdinContext` and listening to `data` events.
15
+ * The callback you pass to `useInput` is called for each character when user enters any input.
16
+ * However, if user pastes text and it's more than one character, the callback will be called only once and the whole string will be passed as `input`.
17
+ *
18
+ * ```
19
+ * import {useInput} from 'ink';
20
+ *
21
+ * const UserInput = () => {
22
+ * useInput((input, key) => {
23
+ * if (input === 'q') {
24
+ * // Exit program
25
+ * }
26
+ *
27
+ * if (key.leftArrow) {
28
+ * // Left arrow key pressed
29
+ * }
30
+ * });
31
+ *
32
+ * return …
33
+ * };
34
+ * ```
35
+ */
36
+ declare const useInput: (inputHandler: Handler, options?: Options) => void;
37
+ export default useInput;
38
+ //# sourceMappingURL=use-input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-input.d.ts","sourceRoot":"","sources":["../../../src/ink/hooks/use-input.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAA;AAG/D,KAAK,OAAO,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;AAEnE,KAAK,OAAO,GAAG;IACb;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,QAAA,MAAM,QAAQ,GAAI,cAAc,OAAO,EAAE,UAAS,OAAY,SA0D7D,CAAA;AAED,eAAe,QAAQ,CAAA"}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = require("react");
7
+ const usehooks_ts_1 = require("usehooks-ts");
8
+ const use_stdin_js_1 = __importDefault(require("./use-stdin.js"));
9
+ /**
10
+ * This hook is used for handling user input.
11
+ * It's a more convenient alternative to using `StdinContext` and listening to `data` events.
12
+ * The callback you pass to `useInput` is called for each character when user enters any input.
13
+ * However, if user pastes text and it's more than one character, the callback will be called only once and the whole string will be passed as `input`.
14
+ *
15
+ * ```
16
+ * import {useInput} from 'ink';
17
+ *
18
+ * const UserInput = () => {
19
+ * useInput((input, key) => {
20
+ * if (input === 'q') {
21
+ * // Exit program
22
+ * }
23
+ *
24
+ * if (key.leftArrow) {
25
+ * // Left arrow key pressed
26
+ * }
27
+ * });
28
+ *
29
+ * return …
30
+ * };
31
+ * ```
32
+ */
33
+ const useInput = (inputHandler, options = {}) => {
34
+ const { setRawMode, internal_exitOnCtrlC, internal_eventEmitter } = (0, use_stdin_js_1.default)();
35
+ // useLayoutEffect (not useEffect) so that raw mode is enabled synchronously
36
+ // during React's commit phase, before render() returns. With useEffect, raw
37
+ // mode setup is deferred to the next event loop tick via React's scheduler,
38
+ // leaving the terminal in cooked mode — keystrokes echo and the cursor is
39
+ // visible until the effect fires.
40
+ (0, react_1.useLayoutEffect)(() => {
41
+ if (options.isActive === false) {
42
+ return;
43
+ }
44
+ setRawMode(true);
45
+ return () => {
46
+ setRawMode(false);
47
+ };
48
+ }, [options.isActive, setRawMode]);
49
+ // Register the listener once on mount so its slot in the EventEmitter's
50
+ // listener array is stable. If isActive were in the effect's deps, the
51
+ // listener would re-append on false→true, moving it behind listeners
52
+ // that registered while it was inactive — breaking
53
+ // stopImmediatePropagation() ordering. useEventCallback keeps the
54
+ // reference stable while reading latest isActive/inputHandler from
55
+ // closure (it syncs via useLayoutEffect, so it's compiler-safe).
56
+ //
57
+ // Use useLayoutEffect (not useEffect) so the handler is registered
58
+ // synchronously during the commit phase, before any stdin data can be
59
+ // processed. In data mode, stdin.write() fires handleDataChunk
60
+ // synchronously, which calls processInput → discreteUpdates → emit('input').
61
+ // If the handler were in useEffect (passive effect, fires asynchronously
62
+ // after the scheduler flushes), there's a window where stdin has a
63
+ // listener but the EventEmitter has no handlers — keys are silently
64
+ // dropped. This is safe because EventEmitter listener registration is
65
+ // synchronous, lightweight, and has no visual side effects.
66
+ const handleData = (0, usehooks_ts_1.useEventCallback)((event) => {
67
+ if (options.isActive === false) {
68
+ return;
69
+ }
70
+ const { input, key } = event;
71
+ // If app is not supposed to exit on Ctrl+C, then let input listener handle it
72
+ // Note: discreteUpdates is called at the App level when emitting events,
73
+ // so all listeners are already within a high-priority update context.
74
+ if (!(input === 'c' && key.ctrl) || !internal_exitOnCtrlC) {
75
+ inputHandler(input, key, event);
76
+ }
77
+ });
78
+ (0, react_1.useLayoutEffect)(() => {
79
+ internal_eventEmitter?.on('input', handleData);
80
+ return () => {
81
+ internal_eventEmitter?.removeListener('input', handleData);
82
+ };
83
+ }, [internal_eventEmitter, handleData]);
84
+ };
85
+ exports.default = useInput;
86
+ //# sourceMappingURL=use-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-input.js","sourceRoot":"","sources":["../../../src/ink/hooks/use-input.ts"],"names":[],"mappings":";;;;;AAAA,iCAAuC;AACvC,6CAA8C;AAE9C,kEAAqC;AAcrC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,QAAQ,GAAG,CAAC,YAAqB,EAAE,UAAmB,EAAE,EAAE,EAAE;IAChE,MAAM,EAAE,UAAU,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,GAAG,IAAA,sBAAQ,GAAE,CAAA;IAE9E,4EAA4E;IAC5E,4EAA4E;IAC5E,4EAA4E;IAC5E,0EAA0E;IAC1E,kCAAkC;IAClC,IAAA,uBAAe,EAAC,GAAG,EAAE;QACnB,IAAI,OAAO,CAAC,QAAQ,KAAK,KAAK,EAAE,CAAC;YAC/B,OAAM;QACR,CAAC;QAED,UAAU,CAAC,IAAI,CAAC,CAAA;QAEhB,OAAO,GAAG,EAAE;YACV,UAAU,CAAC,KAAK,CAAC,CAAA;QACnB,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAA;IAElC,wEAAwE;IACxE,uEAAuE;IACvE,qEAAqE;IACrE,mDAAmD;IACnD,kEAAkE;IAClE,mEAAmE;IACnE,iEAAiE;IACjE,EAAE;IACF,mEAAmE;IACnE,sEAAsE;IACtE,+DAA+D;IAC/D,6EAA6E;IAC7E,yEAAyE;IACzE,mEAAmE;IACnE,oEAAoE;IACpE,sEAAsE;IACtE,4DAA4D;IAC5D,MAAM,UAAU,GAAG,IAAA,8BAAgB,EAAC,CAAC,KAAiB,EAAE,EAAE;QACxD,IAAI,OAAO,CAAC,QAAQ,KAAK,KAAK,EAAE,CAAC;YAC/B,OAAM;QACR,CAAC;QACD,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,KAAK,CAAA;QAE5B,8EAA8E;QAC9E,yEAAyE;QACzE,sEAAsE;QACtE,IAAI,CAAC,CAAC,KAAK,KAAK,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC1D,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA;QACjC,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,IAAA,uBAAe,EAAC,GAAG,EAAE;QACnB,qBAAqB,EAAE,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;QAE9C,OAAO,GAAG,EAAE;YACV,qBAAqB,EAAE,cAAc,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;QAC5D,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,qBAAqB,EAAE,UAAU,CAAC,CAAC,CAAA;AACzC,CAAC,CAAA;AAED,kBAAe,QAAQ,CAAA"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Returns the clock time, updating at the given interval.
3
+ * Subscribes as non-keepAlive — won't keep the clock alive on its own,
4
+ * but updates whenever a keepAlive subscriber (e.g. the spinner)
5
+ * is driving the clock.
6
+ *
7
+ * Use this to drive pure time-based computations (shimmer position,
8
+ * frame index) from the shared clock.
9
+ */
10
+ export declare function useAnimationTimer(intervalMs: number): number;
11
+ /**
12
+ * Interval hook backed by the shared Clock.
13
+ *
14
+ * Unlike `useInterval` from `usehooks-ts` (which creates its own setInterval),
15
+ * this piggybacks on the single shared clock so all timers consolidate into
16
+ * one wake-up. Pass `null` for intervalMs to pause.
17
+ */
18
+ export declare function useInterval(callback: () => void, intervalMs: number | null): void;
19
+ //# sourceMappingURL=use-interval.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-interval.d.ts","sourceRoot":"","sources":["../../../src/ink/hooks/use-interval.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAqB5D;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,IAAI,EACpB,UAAU,EAAE,MAAM,GAAG,IAAI,GACxB,IAAI,CAqBN"}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useAnimationTimer = useAnimationTimer;
4
+ exports.useInterval = useInterval;
5
+ const react_1 = require("react");
6
+ const ClockContext_js_1 = require("../components/ClockContext.js");
7
+ /**
8
+ * Returns the clock time, updating at the given interval.
9
+ * Subscribes as non-keepAlive — won't keep the clock alive on its own,
10
+ * but updates whenever a keepAlive subscriber (e.g. the spinner)
11
+ * is driving the clock.
12
+ *
13
+ * Use this to drive pure time-based computations (shimmer position,
14
+ * frame index) from the shared clock.
15
+ */
16
+ function useAnimationTimer(intervalMs) {
17
+ const clock = (0, react_1.useContext)(ClockContext_js_1.ClockContext);
18
+ const [time, setTime] = (0, react_1.useState)(() => clock?.now() ?? 0);
19
+ (0, react_1.useEffect)(() => {
20
+ if (!clock)
21
+ return;
22
+ let lastUpdate = clock.now();
23
+ const onChange = () => {
24
+ const now = clock.now();
25
+ if (now - lastUpdate >= intervalMs) {
26
+ lastUpdate = now;
27
+ setTime(now);
28
+ }
29
+ };
30
+ return clock.subscribe(onChange, false);
31
+ }, [clock, intervalMs]);
32
+ return time;
33
+ }
34
+ /**
35
+ * Interval hook backed by the shared Clock.
36
+ *
37
+ * Unlike `useInterval` from `usehooks-ts` (which creates its own setInterval),
38
+ * this piggybacks on the single shared clock so all timers consolidate into
39
+ * one wake-up. Pass `null` for intervalMs to pause.
40
+ */
41
+ function useInterval(callback, intervalMs) {
42
+ const callbackRef = (0, react_1.useRef)(callback);
43
+ callbackRef.current = callback;
44
+ const clock = (0, react_1.useContext)(ClockContext_js_1.ClockContext);
45
+ (0, react_1.useEffect)(() => {
46
+ if (!clock || intervalMs === null)
47
+ return;
48
+ let lastUpdate = clock.now();
49
+ const onChange = () => {
50
+ const now = clock.now();
51
+ if (now - lastUpdate >= intervalMs) {
52
+ lastUpdate = now;
53
+ callbackRef.current();
54
+ }
55
+ };
56
+ return clock.subscribe(onChange, false);
57
+ }, [clock, intervalMs]);
58
+ }
59
+ //# sourceMappingURL=use-interval.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-interval.js","sourceRoot":"","sources":["../../../src/ink/hooks/use-interval.ts"],"names":[],"mappings":";;AAYA,8CAqBC;AASD,kCAwBC;AAlED,iCAA+D;AAC/D,mEAA4D;AAE5D;;;;;;;;GAQG;AACH,SAAgB,iBAAiB,CAAC,UAAkB;IAClD,MAAM,KAAK,GAAG,IAAA,kBAAU,EAAC,8BAAY,CAAC,CAAA;IACtC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAA,gBAAQ,EAAC,GAAG,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,CAAA;IAEzD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,KAAK;YAAE,OAAM;QAElB,IAAI,UAAU,GAAG,KAAK,CAAC,GAAG,EAAE,CAAA;QAE5B,MAAM,QAAQ,GAAG,GAAS,EAAE;YAC1B,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,EAAE,CAAA;YACvB,IAAI,GAAG,GAAG,UAAU,IAAI,UAAU,EAAE,CAAC;gBACnC,UAAU,GAAG,GAAG,CAAA;gBAChB,OAAO,CAAC,GAAG,CAAC,CAAA;YACd,CAAC;QACH,CAAC,CAAA;QAED,OAAO,KAAK,CAAC,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;IACzC,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAA;IAEvB,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,WAAW,CACzB,QAAoB,EACpB,UAAyB;IAEzB,MAAM,WAAW,GAAG,IAAA,cAAM,EAAC,QAAQ,CAAC,CAAA;IACpC,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAA;IAE9B,MAAM,KAAK,GAAG,IAAA,kBAAU,EAAC,8BAAY,CAAC,CAAA;IAEtC,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,KAAK,IAAI,UAAU,KAAK,IAAI;YAAE,OAAM;QAEzC,IAAI,UAAU,GAAG,KAAK,CAAC,GAAG,EAAE,CAAA;QAE5B,MAAM,QAAQ,GAAG,GAAS,EAAE;YAC1B,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,EAAE,CAAA;YACvB,IAAI,GAAG,GAAG,UAAU,IAAI,UAAU,EAAE,CAAC;gBACnC,UAAU,GAAG,GAAG,CAAA;gBAChB,WAAW,CAAC,OAAO,EAAE,CAAA;YACvB,CAAC;QACH,CAAC,CAAA;QAED,OAAO,KAAK,CAAC,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;IACzC,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAA;AACzB,CAAC"}
@@ -0,0 +1,31 @@
1
+ import type { DOMElement } from '../dom.js';
2
+ import type { MatchPosition } from '../render-to-screen.js';
3
+ /**
4
+ * Set the search highlight query on the Ink instance. Non-empty → all
5
+ * visible occurrences are inverted on the next frame (SGR 7, screen-buffer
6
+ * overlay, same damage machinery as selection). Empty → clears.
7
+ *
8
+ * This is a screen-space highlight — it matches the RENDERED text, not the
9
+ * source message text. Works for anything visible (bash output, file paths,
10
+ * error messages) regardless of where it came from in the message tree. A
11
+ * query that matched in source but got truncated/ellipsized in rendering
12
+ * won't highlight; that's acceptable — we highlight what you see.
13
+ */
14
+ export declare function useSearchHighlight(): {
15
+ setQuery: (query: string) => void;
16
+ /** Paint an existing DOM subtree (from the MAIN tree) to a fresh
17
+ * Screen at its natural height, scan. Element-relative positions
18
+ * (row 0 = element top). Zero context duplication — the element
19
+ * IS the one built with all real providers. */
20
+ scanElement: (el: DOMElement) => MatchPosition[];
21
+ /** Position-based CURRENT highlight. Every frame writes yellow at
22
+ * positions[currentIdx] + rowOffset. The scan-highlight (inverse on
23
+ * all matches) still runs — this overlays on top. rowOffset tracks
24
+ * scroll; positions stay stable (message-relative). null clears. */
25
+ setPositions: (state: {
26
+ positions: MatchPosition[];
27
+ rowOffset: number;
28
+ currentIdx: number;
29
+ } | null) => void;
30
+ };
31
+ //# sourceMappingURL=use-search-highlight.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-search-highlight.d.ts","sourceRoot":"","sources":["../../../src/ink/hooks/use-search-highlight.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAE3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAE3D;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,IAAI;IACpC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC;;;oDAGgD;IAChD,WAAW,EAAE,CAAC,EAAE,EAAE,UAAU,KAAK,aAAa,EAAE,CAAA;IAChD;;;yEAGqE;IACrE,YAAY,EAAE,CACZ,KAAK,EAAE;QACL,SAAS,EAAE,aAAa,EAAE,CAAA;QAC1B,SAAS,EAAE,MAAM,CAAA;QACjB,UAAU,EAAE,MAAM,CAAA;KACnB,GAAG,IAAI,KACL,IAAI,CAAA;CACV,CAiBA"}