mu-harness 0.16.3

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 (515) hide show
  1. package/esm/core/src/agent.d.ts +39 -0
  2. package/esm/core/src/agent.js +96 -0
  3. package/esm/core/src/index.d.ts +4 -0
  4. package/esm/core/src/index.js +2 -0
  5. package/esm/core/src/types.d.ts +59 -0
  6. package/esm/core/src/types.js +3 -0
  7. package/esm/harness/npm/src/_dnt.polyfills.d.ts +11 -0
  8. package/esm/harness/npm/src/_dnt.polyfills.js +15 -0
  9. package/esm/harness/npm/src/agents/index.d.ts +4 -0
  10. package/esm/harness/npm/src/agents/index.js +3 -0
  11. package/esm/harness/npm/src/agents/loader.d.ts +2 -0
  12. package/esm/harness/npm/src/agents/loader.js +24 -0
  13. package/esm/harness/npm/src/agents/parser.d.ts +2 -0
  14. package/esm/harness/npm/src/agents/parser.js +20 -0
  15. package/esm/harness/npm/src/agents/registry.d.ts +6 -0
  16. package/esm/harness/npm/src/agents/registry.js +31 -0
  17. package/esm/harness/npm/src/agents/types.d.ts +8 -0
  18. package/esm/harness/npm/src/agents/types.js +1 -0
  19. package/esm/harness/npm/src/channels/channel.d.ts +7 -0
  20. package/esm/harness/npm/src/channels/channel.js +25 -0
  21. package/esm/harness/npm/src/channels/index.d.ts +3 -0
  22. package/esm/harness/npm/src/channels/index.js +2 -0
  23. package/esm/harness/npm/src/channels/manager.d.ts +6 -0
  24. package/esm/harness/npm/src/channels/manager.js +28 -0
  25. package/esm/harness/npm/src/channels/types.d.ts +30 -0
  26. package/esm/harness/npm/src/channels/types.js +1 -0
  27. package/esm/harness/npm/src/commands/defaults.d.ts +9 -0
  28. package/esm/harness/npm/src/commands/defaults.js +53 -0
  29. package/esm/harness/npm/src/commands/index.d.ts +3 -0
  30. package/esm/harness/npm/src/commands/index.js +2 -0
  31. package/esm/harness/npm/src/commands/registry.d.ts +2 -0
  32. package/esm/harness/npm/src/commands/registry.js +59 -0
  33. package/esm/harness/npm/src/commands/types.d.ts +23 -0
  34. package/esm/harness/npm/src/commands/types.js +1 -0
  35. package/esm/harness/npm/src/common/frontmatter.d.ts +6 -0
  36. package/esm/harness/npm/src/common/frontmatter.js +18 -0
  37. package/esm/harness/npm/src/common/index.d.ts +2 -0
  38. package/esm/harness/npm/src/common/index.js +2 -0
  39. package/esm/harness/npm/src/common/utils.d.ts +5 -0
  40. package/esm/harness/npm/src/common/utils.js +13 -0
  41. package/esm/harness/npm/src/config/index.d.ts +2 -0
  42. package/esm/harness/npm/src/config/index.js +1 -0
  43. package/esm/harness/npm/src/config/resolve.d.ts +2 -0
  44. package/esm/harness/npm/src/config/resolve.js +10 -0
  45. package/esm/harness/npm/src/config/types.d.ts +15 -0
  46. package/esm/harness/npm/src/config/types.js +1 -0
  47. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_chars.d.ts +32 -0
  48. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_chars.js +48 -0
  49. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_dumper_state.d.ts +105 -0
  50. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_dumper_state.js +638 -0
  51. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_loader_state.d.ts +63 -0
  52. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_loader_state.js +1371 -0
  53. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_schema.d.ts +43 -0
  54. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_schema.js +117 -0
  55. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/binary.d.ts +2 -0
  56. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/binary.js +103 -0
  57. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/bool.d.ts +2 -0
  58. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/bool.js +32 -0
  59. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/float.d.ts +2 -0
  60. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/float.js +96 -0
  61. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/int.d.ts +2 -0
  62. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/int.js +159 -0
  63. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/map.d.ts +2 -0
  64. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/map.js +14 -0
  65. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/merge.d.ts +2 -0
  66. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/merge.js +10 -0
  67. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/nil.d.ts +2 -0
  68. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/nil.js +22 -0
  69. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/omap.d.ts +2 -0
  70. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/omap.js +29 -0
  71. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/pairs.d.ts +2 -0
  72. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/pairs.js +19 -0
  73. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/regexp.d.ts +2 -0
  74. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/regexp.js +30 -0
  75. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/seq.d.ts +2 -0
  76. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/seq.js +10 -0
  77. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/set.d.ts +2 -0
  78. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/set.js +14 -0
  79. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/str.d.ts +2 -0
  80. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/str.js +9 -0
  81. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/timestamp.d.ts +2 -0
  82. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/timestamp.js +81 -0
  83. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/undefined.d.ts +2 -0
  84. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/undefined.js +20 -0
  85. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type.d.ts +31 -0
  86. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type.js +6 -0
  87. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_utils.d.ts +3 -0
  88. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_utils.js +13 -0
  89. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/mod.d.ts +49 -0
  90. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/mod.js +52 -0
  91. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/parse.d.ts +75 -0
  92. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/parse.js +91 -0
  93. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/stringify.d.ts +99 -0
  94. package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/stringify.js +33 -0
  95. package/esm/harness/npm/src/harness/create.d.ts +2 -0
  96. package/esm/harness/npm/src/harness/create.js +139 -0
  97. package/esm/harness/npm/src/harness/index.d.ts +3 -0
  98. package/esm/harness/npm/src/harness/index.js +2 -0
  99. package/esm/harness/npm/src/harness/models.d.ts +16 -0
  100. package/esm/harness/npm/src/harness/models.js +30 -0
  101. package/esm/harness/npm/src/harness/types.d.ts +35 -0
  102. package/esm/harness/npm/src/harness/types.js +1 -0
  103. package/esm/harness/npm/src/hooks/index.d.ts +3 -0
  104. package/esm/harness/npm/src/hooks/index.js +2 -0
  105. package/esm/harness/npm/src/hooks/merge-hooks.d.ts +2 -0
  106. package/esm/harness/npm/src/hooks/merge-hooks.js +42 -0
  107. package/esm/harness/npm/src/hooks/types.d.ts +20 -0
  108. package/esm/harness/npm/src/hooks/types.js +1 -0
  109. package/esm/harness/npm/src/hooks/with-hooks.d.ts +3 -0
  110. package/esm/harness/npm/src/hooks/with-hooks.js +12 -0
  111. package/esm/harness/npm/src/index.d.ts +15 -0
  112. package/esm/harness/npm/src/index.js +15 -0
  113. package/esm/harness/npm/src/permissions/allow-list.d.ts +4 -0
  114. package/esm/harness/npm/src/permissions/allow-list.js +8 -0
  115. package/esm/harness/npm/src/permissions/approval.d.ts +17 -0
  116. package/esm/harness/npm/src/permissions/approval.js +13 -0
  117. package/esm/harness/npm/src/permissions/glob.d.ts +1 -0
  118. package/esm/harness/npm/src/permissions/glob.js +2 -0
  119. package/esm/harness/npm/src/permissions/index.d.ts +3 -0
  120. package/esm/harness/npm/src/permissions/index.js +3 -0
  121. package/esm/harness/npm/src/plugin/define.d.ts +2 -0
  122. package/esm/harness/npm/src/plugin/define.js +1 -0
  123. package/esm/harness/npm/src/plugin/import-ts.d.ts +1 -0
  124. package/esm/harness/npm/src/plugin/import-ts.js +85 -0
  125. package/esm/harness/npm/src/plugin/index.d.ts +5 -0
  126. package/esm/harness/npm/src/plugin/index.js +4 -0
  127. package/esm/harness/npm/src/plugin/resolve.d.ts +13 -0
  128. package/esm/harness/npm/src/plugin/resolve.js +17 -0
  129. package/esm/harness/npm/src/plugin/store.d.ts +8 -0
  130. package/esm/harness/npm/src/plugin/store.js +26 -0
  131. package/esm/harness/npm/src/plugin/types.d.ts +11 -0
  132. package/esm/harness/npm/src/plugin/types.js +1 -0
  133. package/esm/harness/npm/src/scheduler/command.d.ts +3 -0
  134. package/esm/harness/npm/src/scheduler/command.js +19 -0
  135. package/esm/harness/npm/src/scheduler/engine/index.d.ts +3 -0
  136. package/esm/harness/npm/src/scheduler/engine/index.js +2 -0
  137. package/esm/harness/npm/src/scheduler/engine/scheduler.d.ts +12 -0
  138. package/esm/harness/npm/src/scheduler/engine/scheduler.js +65 -0
  139. package/esm/harness/npm/src/scheduler/engine/store.d.ts +4 -0
  140. package/esm/harness/npm/src/scheduler/engine/store.js +55 -0
  141. package/esm/harness/npm/src/scheduler/engine/types.d.ts +37 -0
  142. package/esm/harness/npm/src/scheduler/engine/types.js +1 -0
  143. package/esm/harness/npm/src/scheduler/index.d.ts +4 -0
  144. package/esm/harness/npm/src/scheduler/index.js +3 -0
  145. package/esm/harness/npm/src/scheduler/tool.d.ts +8 -0
  146. package/esm/harness/npm/src/scheduler/tool.js +49 -0
  147. package/esm/harness/npm/src/session/agent-session.d.ts +15 -0
  148. package/esm/harness/npm/src/session/agent-session.js +82 -0
  149. package/esm/harness/npm/src/session/catalog.d.ts +24 -0
  150. package/esm/harness/npm/src/session/catalog.js +55 -0
  151. package/esm/harness/npm/src/session/index.d.ts +7 -0
  152. package/esm/harness/npm/src/session/index.js +6 -0
  153. package/esm/harness/npm/src/session/manager.d.ts +39 -0
  154. package/esm/harness/npm/src/session/manager.js +62 -0
  155. package/esm/harness/npm/src/session/persist.d.ts +3 -0
  156. package/esm/harness/npm/src/session/persist.js +21 -0
  157. package/esm/harness/npm/src/session/store.d.ts +13 -0
  158. package/esm/harness/npm/src/session/store.js +24 -0
  159. package/esm/harness/npm/src/session/title.d.ts +9 -0
  160. package/esm/harness/npm/src/session/title.js +24 -0
  161. package/esm/harness/npm/src/session/types.d.ts +17 -0
  162. package/esm/harness/npm/src/session/types.js +1 -0
  163. package/esm/harness/npm/src/skills/index.d.ts +7 -0
  164. package/esm/harness/npm/src/skills/index.js +6 -0
  165. package/esm/harness/npm/src/skills/loader.d.ts +2 -0
  166. package/esm/harness/npm/src/skills/loader.js +26 -0
  167. package/esm/harness/npm/src/skills/parser.d.ts +2 -0
  168. package/esm/harness/npm/src/skills/parser.js +10 -0
  169. package/esm/harness/npm/src/skills/registry.d.ts +8 -0
  170. package/esm/harness/npm/src/skills/registry.js +16 -0
  171. package/esm/harness/npm/src/skills/run.d.ts +14 -0
  172. package/esm/harness/npm/src/skills/run.js +45 -0
  173. package/esm/harness/npm/src/skills/tool.d.ts +3 -0
  174. package/esm/harness/npm/src/skills/tool.js +31 -0
  175. package/esm/harness/npm/src/skills/types.d.ts +6 -0
  176. package/esm/harness/npm/src/skills/types.js +1 -0
  177. package/esm/harness/npm/src/skills/writer.d.ts +7 -0
  178. package/esm/harness/npm/src/skills/writer.js +43 -0
  179. package/esm/harness/npm/src/subAgents/index.d.ts +4 -0
  180. package/esm/harness/npm/src/subAgents/index.js +3 -0
  181. package/esm/harness/npm/src/subAgents/registry.d.ts +2 -0
  182. package/esm/harness/npm/src/subAgents/registry.js +18 -0
  183. package/esm/harness/npm/src/subAgents/runner.d.ts +15 -0
  184. package/esm/harness/npm/src/subAgents/runner.js +33 -0
  185. package/esm/harness/npm/src/subAgents/tool.d.ts +6 -0
  186. package/esm/harness/npm/src/subAgents/tool.js +30 -0
  187. package/esm/harness/npm/src/subAgents/types.d.ts +18 -0
  188. package/esm/harness/npm/src/subAgents/types.js +1 -0
  189. package/esm/harness/npm/src/tui/channel.d.ts +3 -0
  190. package/esm/harness/npm/src/tui/channel.js +53 -0
  191. package/esm/harness/npm/src/tui/components/composer.d.ts +3 -0
  192. package/esm/harness/npm/src/tui/components/composer.js +13 -0
  193. package/esm/harness/npm/src/tui/components/header.d.ts +3 -0
  194. package/esm/harness/npm/src/tui/components/header.js +1 -0
  195. package/esm/harness/npm/src/tui/components/index.d.ts +5 -0
  196. package/esm/harness/npm/src/tui/components/index.js +5 -0
  197. package/esm/harness/npm/src/tui/components/message.d.ts +6 -0
  198. package/esm/harness/npm/src/tui/components/message.js +26 -0
  199. package/esm/harness/npm/src/tui/components/status.d.ts +3 -0
  200. package/esm/harness/npm/src/tui/components/status.js +8 -0
  201. package/esm/harness/npm/src/tui/components/transcript.d.ts +4 -0
  202. package/esm/harness/npm/src/tui/components/transcript.js +4 -0
  203. package/esm/harness/npm/src/tui/index.d.ts +7 -0
  204. package/esm/harness/npm/src/tui/index.js +10 -0
  205. package/esm/harness/npm/src/tui/kit.d.ts +15 -0
  206. package/esm/harness/npm/src/tui/kit.js +7 -0
  207. package/esm/harness/npm/src/tui/types.d.ts +38 -0
  208. package/esm/harness/npm/src/tui/types.js +1 -0
  209. package/esm/package.json +3 -0
  210. package/esm/tui/src/capabilities.d.ts +72 -0
  211. package/esm/tui/src/capabilities.js +90 -0
  212. package/esm/tui/src/components/command-palette.d.ts +24 -0
  213. package/esm/tui/src/components/command-palette.js +60 -0
  214. package/esm/tui/src/components/editor.d.ts +26 -0
  215. package/esm/tui/src/components/editor.js +111 -0
  216. package/esm/tui/src/components/scroll-view.d.ts +14 -0
  217. package/esm/tui/src/components/scroll-view.js +45 -0
  218. package/esm/tui/src/components/select-list.d.ts +24 -0
  219. package/esm/tui/src/components/select-list.js +69 -0
  220. package/esm/tui/src/events.d.ts +56 -0
  221. package/esm/tui/src/events.js +6 -0
  222. package/esm/tui/src/index.d.ts +17 -0
  223. package/esm/tui/src/index.js +13 -0
  224. package/esm/tui/src/inputRouter.d.ts +28 -0
  225. package/esm/tui/src/inputRouter.js +122 -0
  226. package/esm/tui/src/keybinds.d.ts +13 -0
  227. package/esm/tui/src/keybinds.js +15 -0
  228. package/esm/tui/src/keyboard.d.ts +2 -0
  229. package/esm/tui/src/keyboard.js +305 -0
  230. package/esm/tui/src/layout/ansi.d.ts +3 -0
  231. package/esm/tui/src/layout/ansi.js +323 -0
  232. package/esm/tui/src/layout/cell.d.ts +24 -0
  233. package/esm/tui/src/layout/cell.js +46 -0
  234. package/esm/tui/src/layout/cellbuffer.d.ts +29 -0
  235. package/esm/tui/src/layout/cellbuffer.js +306 -0
  236. package/esm/tui/src/layout/color.d.ts +22 -0
  237. package/esm/tui/src/layout/color.js +163 -0
  238. package/esm/tui/src/layout/insets.d.ts +8 -0
  239. package/esm/tui/src/layout/insets.js +55 -0
  240. package/esm/tui/src/layout/types.d.ts +33 -0
  241. package/esm/tui/src/layout/types.js +8 -0
  242. package/esm/tui/src/parser.d.ts +18 -0
  243. package/esm/tui/src/parser.js +136 -0
  244. package/esm/tui/src/renderer.d.ts +32 -0
  245. package/esm/tui/src/renderer.js +168 -0
  246. package/esm/tui/src/surface.d.ts +27 -0
  247. package/esm/tui/src/surface.js +110 -0
  248. package/esm/tui/src/terminal.d.ts +48 -0
  249. package/esm/tui/src/terminal.js +255 -0
  250. package/esm/tui/src/tui.d.ts +60 -0
  251. package/esm/tui/src/tui.js +194 -0
  252. package/esm/tui/src/types/terminal.d.ts +20 -0
  253. package/esm/tui/src/types/terminal.js +1 -0
  254. package/esm/tui/src/utils.d.ts +6 -0
  255. package/esm/tui/src/utils.js +292 -0
  256. package/esm/tui/src/views.d.ts +35 -0
  257. package/esm/tui/src/views.js +112 -0
  258. package/package.json +23 -0
  259. package/script/core/src/agent.d.ts +39 -0
  260. package/script/core/src/agent.js +101 -0
  261. package/script/core/src/index.d.ts +4 -0
  262. package/script/core/src/index.js +10 -0
  263. package/script/core/src/types.d.ts +59 -0
  264. package/script/core/src/types.js +9 -0
  265. package/script/harness/npm/src/_dnt.polyfills.d.ts +11 -0
  266. package/script/harness/npm/src/_dnt.polyfills.js +16 -0
  267. package/script/harness/npm/src/agents/index.d.ts +4 -0
  268. package/script/harness/npm/src/agents/index.js +9 -0
  269. package/script/harness/npm/src/agents/loader.d.ts +2 -0
  270. package/script/harness/npm/src/agents/loader.js +28 -0
  271. package/script/harness/npm/src/agents/parser.d.ts +2 -0
  272. package/script/harness/npm/src/agents/parser.js +24 -0
  273. package/script/harness/npm/src/agents/registry.d.ts +6 -0
  274. package/script/harness/npm/src/agents/registry.js +35 -0
  275. package/script/harness/npm/src/agents/types.d.ts +8 -0
  276. package/script/harness/npm/src/agents/types.js +2 -0
  277. package/script/harness/npm/src/channels/channel.d.ts +7 -0
  278. package/script/harness/npm/src/channels/channel.js +29 -0
  279. package/script/harness/npm/src/channels/index.d.ts +3 -0
  280. package/script/harness/npm/src/channels/index.js +7 -0
  281. package/script/harness/npm/src/channels/manager.d.ts +6 -0
  282. package/script/harness/npm/src/channels/manager.js +32 -0
  283. package/script/harness/npm/src/channels/types.d.ts +30 -0
  284. package/script/harness/npm/src/channels/types.js +2 -0
  285. package/script/harness/npm/src/commands/defaults.d.ts +9 -0
  286. package/script/harness/npm/src/commands/defaults.js +61 -0
  287. package/script/harness/npm/src/commands/index.d.ts +3 -0
  288. package/script/harness/npm/src/commands/index.js +11 -0
  289. package/script/harness/npm/src/commands/registry.d.ts +2 -0
  290. package/script/harness/npm/src/commands/registry.js +63 -0
  291. package/script/harness/npm/src/commands/types.d.ts +23 -0
  292. package/script/harness/npm/src/commands/types.js +2 -0
  293. package/script/harness/npm/src/common/frontmatter.d.ts +6 -0
  294. package/script/harness/npm/src/common/frontmatter.js +23 -0
  295. package/script/harness/npm/src/common/index.d.ts +2 -0
  296. package/script/harness/npm/src/common/index.js +8 -0
  297. package/script/harness/npm/src/common/utils.d.ts +5 -0
  298. package/script/harness/npm/src/common/utils.js +17 -0
  299. package/script/harness/npm/src/config/index.d.ts +2 -0
  300. package/script/harness/npm/src/config/index.js +5 -0
  301. package/script/harness/npm/src/config/resolve.d.ts +2 -0
  302. package/script/harness/npm/src/config/resolve.js +14 -0
  303. package/script/harness/npm/src/config/types.d.ts +15 -0
  304. package/script/harness/npm/src/config/types.js +2 -0
  305. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_chars.d.ts +32 -0
  306. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_chars.js +55 -0
  307. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_dumper_state.d.ts +105 -0
  308. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_dumper_state.js +642 -0
  309. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_loader_state.d.ts +63 -0
  310. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_loader_state.js +1375 -0
  311. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_schema.d.ts +43 -0
  312. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_schema.js +121 -0
  313. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/binary.d.ts +2 -0
  314. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/binary.js +106 -0
  315. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/bool.d.ts +2 -0
  316. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/bool.js +35 -0
  317. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/float.d.ts +2 -0
  318. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/float.js +99 -0
  319. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/int.d.ts +2 -0
  320. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/int.js +162 -0
  321. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/map.d.ts +2 -0
  322. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/map.js +17 -0
  323. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/merge.d.ts +2 -0
  324. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/merge.js +13 -0
  325. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/nil.d.ts +2 -0
  326. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/nil.js +25 -0
  327. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/omap.d.ts +2 -0
  328. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/omap.js +32 -0
  329. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/pairs.d.ts +2 -0
  330. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/pairs.js +22 -0
  331. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/regexp.d.ts +2 -0
  332. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/regexp.js +33 -0
  333. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/seq.d.ts +2 -0
  334. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/seq.js +13 -0
  335. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/set.d.ts +2 -0
  336. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/set.js +17 -0
  337. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/str.d.ts +2 -0
  338. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/str.js +12 -0
  339. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/timestamp.d.ts +2 -0
  340. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/timestamp.js +84 -0
  341. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/undefined.d.ts +2 -0
  342. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/undefined.js +23 -0
  343. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type.d.ts +31 -0
  344. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type.js +7 -0
  345. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_utils.d.ts +3 -0
  346. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_utils.js +18 -0
  347. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/mod.d.ts +49 -0
  348. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/mod.js +68 -0
  349. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/parse.d.ts +75 -0
  350. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/parse.js +95 -0
  351. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/stringify.d.ts +99 -0
  352. package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/stringify.js +36 -0
  353. package/script/harness/npm/src/harness/create.d.ts +2 -0
  354. package/script/harness/npm/src/harness/create.js +146 -0
  355. package/script/harness/npm/src/harness/index.d.ts +3 -0
  356. package/script/harness/npm/src/harness/index.js +7 -0
  357. package/script/harness/npm/src/harness/models.d.ts +16 -0
  358. package/script/harness/npm/src/harness/models.js +34 -0
  359. package/script/harness/npm/src/harness/types.d.ts +35 -0
  360. package/script/harness/npm/src/harness/types.js +2 -0
  361. package/script/harness/npm/src/hooks/index.d.ts +3 -0
  362. package/script/harness/npm/src/hooks/index.js +7 -0
  363. package/script/harness/npm/src/hooks/merge-hooks.d.ts +2 -0
  364. package/script/harness/npm/src/hooks/merge-hooks.js +46 -0
  365. package/script/harness/npm/src/hooks/types.d.ts +20 -0
  366. package/script/harness/npm/src/hooks/types.js +2 -0
  367. package/script/harness/npm/src/hooks/with-hooks.d.ts +3 -0
  368. package/script/harness/npm/src/hooks/with-hooks.js +16 -0
  369. package/script/harness/npm/src/index.d.ts +15 -0
  370. package/script/harness/npm/src/index.js +31 -0
  371. package/script/harness/npm/src/permissions/allow-list.d.ts +4 -0
  372. package/script/harness/npm/src/permissions/allow-list.js +13 -0
  373. package/script/harness/npm/src/permissions/approval.d.ts +17 -0
  374. package/script/harness/npm/src/permissions/approval.js +17 -0
  375. package/script/harness/npm/src/permissions/glob.d.ts +1 -0
  376. package/script/harness/npm/src/permissions/glob.js +6 -0
  377. package/script/harness/npm/src/permissions/index.d.ts +3 -0
  378. package/script/harness/npm/src/permissions/index.js +10 -0
  379. package/script/harness/npm/src/plugin/define.d.ts +2 -0
  380. package/script/harness/npm/src/plugin/define.js +5 -0
  381. package/script/harness/npm/src/plugin/import-ts.d.ts +1 -0
  382. package/script/harness/npm/src/plugin/import-ts.js +122 -0
  383. package/script/harness/npm/src/plugin/index.d.ts +5 -0
  384. package/script/harness/npm/src/plugin/index.js +11 -0
  385. package/script/harness/npm/src/plugin/resolve.d.ts +13 -0
  386. package/script/harness/npm/src/plugin/resolve.js +21 -0
  387. package/script/harness/npm/src/plugin/store.d.ts +8 -0
  388. package/script/harness/npm/src/plugin/store.js +30 -0
  389. package/script/harness/npm/src/plugin/types.d.ts +11 -0
  390. package/script/harness/npm/src/plugin/types.js +2 -0
  391. package/script/harness/npm/src/scheduler/command.d.ts +3 -0
  392. package/script/harness/npm/src/scheduler/command.js +23 -0
  393. package/script/harness/npm/src/scheduler/engine/index.d.ts +3 -0
  394. package/script/harness/npm/src/scheduler/engine/index.js +7 -0
  395. package/script/harness/npm/src/scheduler/engine/scheduler.d.ts +12 -0
  396. package/script/harness/npm/src/scheduler/engine/scheduler.js +69 -0
  397. package/script/harness/npm/src/scheduler/engine/store.d.ts +4 -0
  398. package/script/harness/npm/src/scheduler/engine/store.js +59 -0
  399. package/script/harness/npm/src/scheduler/engine/types.d.ts +37 -0
  400. package/script/harness/npm/src/scheduler/engine/types.js +2 -0
  401. package/script/harness/npm/src/scheduler/index.d.ts +4 -0
  402. package/script/harness/npm/src/scheduler/index.js +10 -0
  403. package/script/harness/npm/src/scheduler/tool.d.ts +8 -0
  404. package/script/harness/npm/src/scheduler/tool.js +53 -0
  405. package/script/harness/npm/src/session/agent-session.d.ts +15 -0
  406. package/script/harness/npm/src/session/agent-session.js +86 -0
  407. package/script/harness/npm/src/session/catalog.d.ts +24 -0
  408. package/script/harness/npm/src/session/catalog.js +59 -0
  409. package/script/harness/npm/src/session/index.d.ts +7 -0
  410. package/script/harness/npm/src/session/index.js +17 -0
  411. package/script/harness/npm/src/session/manager.d.ts +39 -0
  412. package/script/harness/npm/src/session/manager.js +66 -0
  413. package/script/harness/npm/src/session/persist.d.ts +3 -0
  414. package/script/harness/npm/src/session/persist.js +25 -0
  415. package/script/harness/npm/src/session/store.d.ts +13 -0
  416. package/script/harness/npm/src/session/store.js +28 -0
  417. package/script/harness/npm/src/session/title.d.ts +9 -0
  418. package/script/harness/npm/src/session/title.js +30 -0
  419. package/script/harness/npm/src/session/types.d.ts +17 -0
  420. package/script/harness/npm/src/session/types.js +2 -0
  421. package/script/harness/npm/src/skills/index.d.ts +7 -0
  422. package/script/harness/npm/src/skills/index.js +16 -0
  423. package/script/harness/npm/src/skills/loader.d.ts +2 -0
  424. package/script/harness/npm/src/skills/loader.js +30 -0
  425. package/script/harness/npm/src/skills/parser.d.ts +2 -0
  426. package/script/harness/npm/src/skills/parser.js +14 -0
  427. package/script/harness/npm/src/skills/registry.d.ts +8 -0
  428. package/script/harness/npm/src/skills/registry.js +20 -0
  429. package/script/harness/npm/src/skills/run.d.ts +14 -0
  430. package/script/harness/npm/src/skills/run.js +50 -0
  431. package/script/harness/npm/src/skills/tool.d.ts +3 -0
  432. package/script/harness/npm/src/skills/tool.js +35 -0
  433. package/script/harness/npm/src/skills/types.d.ts +6 -0
  434. package/script/harness/npm/src/skills/types.js +2 -0
  435. package/script/harness/npm/src/skills/writer.d.ts +7 -0
  436. package/script/harness/npm/src/skills/writer.js +47 -0
  437. package/script/harness/npm/src/subAgents/index.d.ts +4 -0
  438. package/script/harness/npm/src/subAgents/index.js +9 -0
  439. package/script/harness/npm/src/subAgents/registry.d.ts +2 -0
  440. package/script/harness/npm/src/subAgents/registry.js +22 -0
  441. package/script/harness/npm/src/subAgents/runner.d.ts +15 -0
  442. package/script/harness/npm/src/subAgents/runner.js +37 -0
  443. package/script/harness/npm/src/subAgents/tool.d.ts +6 -0
  444. package/script/harness/npm/src/subAgents/tool.js +34 -0
  445. package/script/harness/npm/src/subAgents/types.d.ts +18 -0
  446. package/script/harness/npm/src/subAgents/types.js +2 -0
  447. package/script/harness/npm/src/tui/channel.d.ts +3 -0
  448. package/script/harness/npm/src/tui/channel.js +57 -0
  449. package/script/harness/npm/src/tui/components/composer.d.ts +3 -0
  450. package/script/harness/npm/src/tui/components/composer.js +17 -0
  451. package/script/harness/npm/src/tui/components/header.d.ts +3 -0
  452. package/script/harness/npm/src/tui/components/header.js +5 -0
  453. package/script/harness/npm/src/tui/components/index.d.ts +5 -0
  454. package/script/harness/npm/src/tui/components/index.js +16 -0
  455. package/script/harness/npm/src/tui/components/message.d.ts +6 -0
  456. package/script/harness/npm/src/tui/components/message.js +32 -0
  457. package/script/harness/npm/src/tui/components/status.d.ts +3 -0
  458. package/script/harness/npm/src/tui/components/status.js +12 -0
  459. package/script/harness/npm/src/tui/components/transcript.d.ts +4 -0
  460. package/script/harness/npm/src/tui/components/transcript.js +9 -0
  461. package/script/harness/npm/src/tui/index.d.ts +7 -0
  462. package/script/harness/npm/src/tui/index.js +29 -0
  463. package/script/harness/npm/src/tui/kit.d.ts +15 -0
  464. package/script/harness/npm/src/tui/kit.js +10 -0
  465. package/script/harness/npm/src/tui/types.d.ts +38 -0
  466. package/script/harness/npm/src/tui/types.js +2 -0
  467. package/script/package.json +3 -0
  468. package/script/tui/src/capabilities.d.ts +72 -0
  469. package/script/tui/src/capabilities.js +98 -0
  470. package/script/tui/src/components/command-palette.d.ts +24 -0
  471. package/script/tui/src/components/command-palette.js +65 -0
  472. package/script/tui/src/components/editor.d.ts +26 -0
  473. package/script/tui/src/components/editor.js +116 -0
  474. package/script/tui/src/components/scroll-view.d.ts +14 -0
  475. package/script/tui/src/components/scroll-view.js +50 -0
  476. package/script/tui/src/components/select-list.d.ts +24 -0
  477. package/script/tui/src/components/select-list.js +74 -0
  478. package/script/tui/src/events.d.ts +56 -0
  479. package/script/tui/src/events.js +9 -0
  480. package/script/tui/src/index.d.ts +17 -0
  481. package/script/tui/src/index.js +46 -0
  482. package/script/tui/src/inputRouter.d.ts +28 -0
  483. package/script/tui/src/inputRouter.js +126 -0
  484. package/script/tui/src/keybinds.d.ts +13 -0
  485. package/script/tui/src/keybinds.js +18 -0
  486. package/script/tui/src/keyboard.d.ts +2 -0
  487. package/script/tui/src/keyboard.js +308 -0
  488. package/script/tui/src/layout/ansi.d.ts +3 -0
  489. package/script/tui/src/layout/ansi.js +327 -0
  490. package/script/tui/src/layout/cell.d.ts +24 -0
  491. package/script/tui/src/layout/cell.js +54 -0
  492. package/script/tui/src/layout/cellbuffer.d.ts +29 -0
  493. package/script/tui/src/layout/cellbuffer.js +321 -0
  494. package/script/tui/src/layout/color.d.ts +22 -0
  495. package/script/tui/src/layout/color.js +174 -0
  496. package/script/tui/src/layout/insets.d.ts +8 -0
  497. package/script/tui/src/layout/insets.js +64 -0
  498. package/script/tui/src/layout/types.d.ts +33 -0
  499. package/script/tui/src/layout/types.js +11 -0
  500. package/script/tui/src/parser.d.ts +18 -0
  501. package/script/tui/src/parser.js +140 -0
  502. package/script/tui/src/renderer.d.ts +32 -0
  503. package/script/tui/src/renderer.js +175 -0
  504. package/script/tui/src/surface.d.ts +27 -0
  505. package/script/tui/src/surface.js +115 -0
  506. package/script/tui/src/terminal.d.ts +48 -0
  507. package/script/tui/src/terminal.js +262 -0
  508. package/script/tui/src/tui.d.ts +60 -0
  509. package/script/tui/src/tui.js +198 -0
  510. package/script/tui/src/types/terminal.d.ts +20 -0
  511. package/script/tui/src/types/terminal.js +2 -0
  512. package/script/tui/src/utils.d.ts +6 -0
  513. package/script/tui/src/utils.js +300 -0
  514. package/script/tui/src/views.d.ts +35 -0
  515. package/script/tui/src/views.js +123 -0
@@ -0,0 +1,262 @@
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.ProcessTerminal = void 0;
7
+ const node_process_1 = __importDefault(require("node:process"));
8
+ const capabilities_1 = require("./capabilities");
9
+ async function drainStdin(opts) {
10
+ const maxMs = opts?.maxMs ?? 200;
11
+ const idleMs = opts?.idleMs ?? 30;
12
+ let lastDataTime = Date.now();
13
+ const onData = () => {
14
+ lastDataTime = Date.now();
15
+ };
16
+ node_process_1.default.stdin.on('data', onData);
17
+ const endTime = Date.now() + maxMs;
18
+ try {
19
+ while (true) {
20
+ const now = Date.now();
21
+ if (now - endTime >= 0)
22
+ break;
23
+ if (now - lastDataTime >= idleMs)
24
+ break;
25
+ await new Promise((resolve) => setTimeout(resolve, Math.min(idleMs, endTime - now)));
26
+ }
27
+ }
28
+ finally {
29
+ node_process_1.default.stdin.removeListener('data', onData);
30
+ }
31
+ }
32
+ const MODE_ENABLE = {
33
+ alternateScreen: '\x1b[?1049h',
34
+ bracketedPaste: '\x1b[?2004h',
35
+ focusEvents: '\x1b[?1004h',
36
+ sgrMouse: '\x1b[?1006h',
37
+ mouseDrag: '\x1b[?1002h',
38
+ mouseMotion: '\x1b[?1003h',
39
+ pixelMouse: '\x1b[?1016h',
40
+ synchronizedOutput: '\x1b[?2026h',
41
+ kittyKeyboard: '\x1b[>1u',
42
+ modifyOtherKeys: '\x1b[>4;2m',
43
+ };
44
+ const MODE_DISABLE = {
45
+ alternateScreen: '\x1b[?1049l',
46
+ bracketedPaste: '\x1b[?2004l',
47
+ focusEvents: '\x1b[?1004l',
48
+ sgrMouse: '\x1b[?1006l',
49
+ mouseDrag: '\x1b[?1002l',
50
+ mouseMotion: '\x1b[?1003l',
51
+ pixelMouse: '\x1b[?1016l',
52
+ synchronizedOutput: '\x1b[?2026l',
53
+ kittyKeyboard: '\x1b[<u',
54
+ modifyOtherKeys: '\x1b[>4;0m',
55
+ };
56
+ class ProcessTerminal {
57
+ options;
58
+ _columns;
59
+ _rows;
60
+ onData = null;
61
+ onResize = null;
62
+ cleanupHandlers = [];
63
+ stdinDataHandler = null;
64
+ stdoutResizeHandler = null;
65
+ started = false;
66
+ enabledModes = [];
67
+ capabilities;
68
+ constructor(options = {}) {
69
+ this.options = options;
70
+ this._columns = node_process_1.default.stdout.columns || 80;
71
+ this._rows = node_process_1.default.stdout.rows || 24;
72
+ this.capabilities = (0, capabilities_1.mergeCapabilities)((0, capabilities_1.createDefaultCapabilities)(), options.capabilities);
73
+ }
74
+ get columns() {
75
+ return this._columns;
76
+ }
77
+ get rows() {
78
+ return this._rows;
79
+ }
80
+ write(data) {
81
+ if (node_process_1.default.stdout.isTTY) {
82
+ node_process_1.default.stdout.write(data);
83
+ }
84
+ }
85
+ hideCursor() {
86
+ this.write('\x1b[?25l');
87
+ }
88
+ showCursor() {
89
+ this.write('\x1b[?25h');
90
+ }
91
+ clearScreen() {
92
+ this.write('\x1b[2J\x1b[H');
93
+ }
94
+ clearLine() {
95
+ this.write('\x1b[2K');
96
+ }
97
+ clearFromCursor() {
98
+ this.write('\x1b[0J');
99
+ }
100
+ moveBy(lines) {
101
+ if (lines > 0) {
102
+ this.write(`\x1b[${lines}B`);
103
+ }
104
+ else if (lines < 0) {
105
+ this.write(`\x1b[${-lines}A`);
106
+ }
107
+ }
108
+ enableMode(mode) {
109
+ if (!node_process_1.default.stdout.isTTY || this.enabledModes.includes(mode))
110
+ return;
111
+ this.write(MODE_ENABLE[mode]);
112
+ this.enabledModes.push(mode);
113
+ }
114
+ disableMode(mode) {
115
+ const index = this.enabledModes.lastIndexOf(mode);
116
+ if (index === -1)
117
+ return;
118
+ this.write(MODE_DISABLE[mode]);
119
+ this.enabledModes.splice(index, 1);
120
+ }
121
+ enableMouse() {
122
+ this.enableMode('sgrMouse');
123
+ this.enableMode('mouseDrag');
124
+ }
125
+ disableMouse() {
126
+ this.disableMode('pixelMouse');
127
+ this.disableMode('mouseMotion');
128
+ this.disableMode('mouseDrag');
129
+ this.disableMode('sgrMouse');
130
+ }
131
+ start(onInput, onResize) {
132
+ if (this.started || !(node_process_1.default.stdin.isTTY && node_process_1.default.stdout.isTTY)) {
133
+ return;
134
+ }
135
+ this.started = true;
136
+ this.onData = onInput;
137
+ this.onResize = onResize;
138
+ node_process_1.default.stdin.setRawMode(true);
139
+ node_process_1.default.stdin.resume();
140
+ node_process_1.default.stdin.setEncoding('utf8');
141
+ this.stdinDataHandler = (chunk) => {
142
+ this.onData?.(chunk);
143
+ };
144
+ node_process_1.default.stdin.on('data', this.stdinDataHandler);
145
+ this.stdoutResizeHandler = () => {
146
+ this._columns = node_process_1.default.stdout.columns || 80;
147
+ this._rows = node_process_1.default.stdout.rows || 24;
148
+ this.onResize?.();
149
+ };
150
+ node_process_1.default.stdout.on('resize', this.stdoutResizeHandler);
151
+ this._columns = node_process_1.default.stdout.columns || 80;
152
+ this._rows = node_process_1.default.stdout.rows || 24;
153
+ const handleSigInt = () => {
154
+ this.stop();
155
+ if (node_process_1.default.pid)
156
+ node_process_1.default.kill(node_process_1.default.pid, 'SIGINT');
157
+ };
158
+ node_process_1.default.once('SIGINT', handleSigInt);
159
+ this.cleanupHandlers.push(() => node_process_1.default.removeListener('SIGINT', handleSigInt));
160
+ const handleSigTerm = () => {
161
+ this.stop();
162
+ if (node_process_1.default.pid)
163
+ node_process_1.default.kill(node_process_1.default.pid, 'SIGTERM');
164
+ };
165
+ node_process_1.default.once('SIGTERM', handleSigTerm);
166
+ this.cleanupHandlers.push(() => node_process_1.default.removeListener('SIGTERM', handleSigTerm));
167
+ const handleSigHup = () => {
168
+ this.stop();
169
+ if (node_process_1.default.pid)
170
+ node_process_1.default.kill(node_process_1.default.pid, 'SIGHUP');
171
+ };
172
+ node_process_1.default.once('SIGHUP', handleSigHup);
173
+ this.cleanupHandlers.push(() => node_process_1.default.removeListener('SIGHUP', handleSigHup));
174
+ const handleExit = () => {
175
+ this.stopNow();
176
+ };
177
+ node_process_1.default.once('exit', handleExit);
178
+ this.cleanupHandlers.push(() => node_process_1.default.removeListener('exit', handleExit));
179
+ this.applyStartupModes();
180
+ this.hideCursor();
181
+ }
182
+ stop() {
183
+ if (!this.started)
184
+ return;
185
+ this.started = false;
186
+ this.write('\x1b[?2026l');
187
+ this.restoreModes();
188
+ this.write('\x1b[0m\x1b]8;;\x07');
189
+ this.showCursor();
190
+ if (this.stdinDataHandler) {
191
+ node_process_1.default.stdin.removeListener('data', this.stdinDataHandler);
192
+ this.stdinDataHandler = null;
193
+ }
194
+ if (this.stdoutResizeHandler) {
195
+ node_process_1.default.stdout.removeListener('resize', this.stdoutResizeHandler);
196
+ this.stdoutResizeHandler = null;
197
+ }
198
+ void this.restoreInputAfterDrain();
199
+ this.onData = null;
200
+ this.onResize = null;
201
+ for (const cleanup of this.cleanupHandlers) {
202
+ try {
203
+ cleanup();
204
+ }
205
+ catch {
206
+ }
207
+ }
208
+ this.cleanupHandlers.length = 0;
209
+ }
210
+ applyStartupModes() {
211
+ if (this.options.alternateScreen)
212
+ this.enableMode('alternateScreen');
213
+ if (this.options.bracketedPaste)
214
+ this.enableMode('bracketedPaste');
215
+ if (this.options.focusEvents)
216
+ this.enableMode('focusEvents');
217
+ if (this.options.keyboard) {
218
+ this.enableMode('kittyKeyboard');
219
+ this.enableMode('modifyOtherKeys');
220
+ }
221
+ if (this.options.mouse) {
222
+ this.enableMode('sgrMouse');
223
+ if (this.options.mouse === true || this.options.mouse.drag)
224
+ this.enableMode('mouseDrag');
225
+ if (this.options.mouse !== true && this.options.mouse.motion)
226
+ this.enableMode('mouseMotion');
227
+ if (this.options.mouse !== true && this.options.mouse.pixel)
228
+ this.enableMode('pixelMouse');
229
+ }
230
+ }
231
+ restoreModes() {
232
+ for (let i = this.enabledModes.length - 1; i >= 0; i--) {
233
+ this.write(MODE_DISABLE[this.enabledModes[i]]);
234
+ }
235
+ this.enabledModes.length = 0;
236
+ }
237
+ async restoreInputAfterDrain() {
238
+ try {
239
+ await drainStdin();
240
+ }
241
+ catch {
242
+ }
243
+ finally {
244
+ this.restoreInputNow();
245
+ }
246
+ }
247
+ stopNow() {
248
+ if (!this.started)
249
+ return;
250
+ this.started = false;
251
+ this.write('\x1b[?2026l');
252
+ this.restoreModes();
253
+ this.write('\x1b[0m\x1b]8;;\x07');
254
+ this.showCursor();
255
+ this.restoreInputNow();
256
+ }
257
+ restoreInputNow() {
258
+ node_process_1.default.stdin.pause();
259
+ node_process_1.default.stdin.setRawMode(false);
260
+ }
261
+ }
262
+ exports.ProcessTerminal = ProcessTerminal;
@@ -0,0 +1,60 @@
1
+ import type { InputEvent } from './events';
2
+ import type { GlobalKeybinding } from './keybinds';
3
+ import type { Color } from './layout/types';
4
+ import { type Command } from './components/command-palette';
5
+ import type { Component } from './surface';
6
+ import type { Terminal } from './types/terminal';
7
+ import { type ModalOptions, type ToastKind } from './views';
8
+ export interface TuiOptions {
9
+ synchronizedOutput?: boolean;
10
+ }
11
+ export interface LayerHandle {
12
+ close(): void;
13
+ }
14
+ export interface ToastHandle {
15
+ dismiss(): void;
16
+ }
17
+ export declare class TUI {
18
+ private readonly terminal;
19
+ private root;
20
+ private focused;
21
+ private entries;
22
+ private backdrop;
23
+ private layers;
24
+ private toasts;
25
+ private escapeUnsub;
26
+ private started;
27
+ private terminalFocused;
28
+ private readonly renderer;
29
+ private readonly inputRouter;
30
+ constructor(terminal: Terminal, options?: TuiOptions);
31
+ setRoot(component: Component | null): void;
32
+ setBackgroundColor(color: Color): void;
33
+ setFocus(component: Component | null): void;
34
+ getFocused(): Component | null;
35
+ pushLayer(layer: Component, opts?: {
36
+ focus?: Component;
37
+ onClose?: () => void;
38
+ }): LayerHandle;
39
+ showModal(content: Component, opts?: ModalOptions & {
40
+ onClose?: () => void;
41
+ }): LayerHandle;
42
+ showCommandPalette(commands: Command[]): LayerHandle;
43
+ toast(message: string, opts?: {
44
+ duration?: number;
45
+ kind?: ToastKind;
46
+ }): ToastHandle;
47
+ private dismissToast;
48
+ private popTopLayer;
49
+ private removeLayer;
50
+ private composedRoot;
51
+ navigateFocus(direction: 'next' | 'previous'): Component | null;
52
+ addGlobalKeybinding(binding: GlobalKeybinding): () => void;
53
+ addInputInterceptor(listener: (event: InputEvent) => boolean | undefined): () => void;
54
+ requestRender(force?: boolean): void;
55
+ renderNow(): void;
56
+ componentAt(x: number, y: number): Component | null;
57
+ start(): void;
58
+ stop(): void;
59
+ private handleResize;
60
+ }
@@ -0,0 +1,198 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TUI = void 0;
4
+ const inputRouter_1 = require("./inputRouter");
5
+ const color_1 = require("./layout/color");
6
+ const insets_1 = require("./layout/insets");
7
+ const command_palette_1 = require("./components/command-palette");
8
+ const renderer_1 = require("./renderer");
9
+ const views_1 = require("./views");
10
+ class TUI {
11
+ terminal;
12
+ root = null;
13
+ focused = null;
14
+ entries = [];
15
+ backdrop = color_1.OPAQUE_BLACK;
16
+ layers = [];
17
+ toasts = [];
18
+ escapeUnsub;
19
+ started = false;
20
+ terminalFocused = true;
21
+ renderer;
22
+ inputRouter;
23
+ constructor(terminal, options = {}) {
24
+ this.terminal = terminal;
25
+ this.renderer = new renderer_1.Renderer(terminal, {
26
+ getRoot: () => this.composedRoot(),
27
+ isFocused: (component) => component === this.focused && this.terminalFocused,
28
+ setEntries: (entries) => {
29
+ this.entries = entries;
30
+ },
31
+ getBackdropColor: () => this.backdrop,
32
+ }, options.synchronizedOutput ?? true);
33
+ this.inputRouter = new inputRouter_1.InputRouter({
34
+ getFocused: () => this.focused,
35
+ getEntries: () => this.entries,
36
+ getTerminalFocused: () => this.terminalFocused,
37
+ setTerminalFocused: (focused) => {
38
+ this.terminalFocused = focused;
39
+ },
40
+ requestRender: (force) => this.requestRender(force),
41
+ });
42
+ }
43
+ setRoot(component) {
44
+ this.root = component;
45
+ this.requestRender(true);
46
+ }
47
+ setBackgroundColor(color) {
48
+ this.backdrop = { ...(0, color_1.colorToRgba)(color), a: 1 };
49
+ this.requestRender(true);
50
+ }
51
+ setFocus(component) {
52
+ this.focused = component;
53
+ this.requestRender();
54
+ }
55
+ getFocused() {
56
+ return this.focused;
57
+ }
58
+ pushLayer(layer, opts = {}) {
59
+ const entry = { layer, prevFocus: this.focused, onClose: opts.onClose };
60
+ this.layers.push(entry);
61
+ if (opts.focus)
62
+ this.focused = opts.focus;
63
+ if (!this.escapeUnsub) {
64
+ this.escapeUnsub = this.addGlobalKeybinding({ chord: { key: 'escape' }, handler: () => this.popTopLayer() });
65
+ }
66
+ this.requestRender(true);
67
+ return { close: () => this.removeLayer(entry) };
68
+ }
69
+ showModal(content, opts = {}) {
70
+ return this.pushLayer((0, views_1.modal)(content, opts), { focus: content, onClose: opts.onClose });
71
+ }
72
+ showCommandPalette(commands) {
73
+ const ref = {};
74
+ const palette = (0, command_palette_1.commandPalette)(commands, {
75
+ onRun: (command) => {
76
+ ref.handle?.close();
77
+ command.run();
78
+ },
79
+ });
80
+ ref.handle = this.pushLayer(palette, { focus: palette });
81
+ return ref.handle;
82
+ }
83
+ toast(message, opts = {}) {
84
+ const entry = { view: (0, views_1.toast)(message, { kind: opts.kind }) };
85
+ this.toasts.push(entry);
86
+ this.requestRender();
87
+ const timer = setTimeout(() => this.dismissToast(entry), opts.duration ?? 3000);
88
+ return {
89
+ dismiss: () => {
90
+ clearTimeout(timer);
91
+ this.dismissToast(entry);
92
+ },
93
+ };
94
+ }
95
+ dismissToast(entry) {
96
+ const index = this.toasts.indexOf(entry);
97
+ if (index === -1)
98
+ return;
99
+ this.toasts.splice(index, 1);
100
+ this.requestRender();
101
+ }
102
+ popTopLayer() {
103
+ const top = this.layers[this.layers.length - 1];
104
+ if (top)
105
+ this.removeLayer(top);
106
+ }
107
+ removeLayer(entry) {
108
+ const index = this.layers.indexOf(entry);
109
+ if (index === -1)
110
+ return;
111
+ this.layers.splice(index, 1);
112
+ this.focused = entry.prevFocus;
113
+ if (this.layers.length === 0 && this.escapeUnsub) {
114
+ this.escapeUnsub();
115
+ this.escapeUnsub = undefined;
116
+ }
117
+ entry.onClose?.();
118
+ this.requestRender(true);
119
+ }
120
+ composedRoot() {
121
+ if (this.layers.length === 0 && this.toasts.length === 0)
122
+ return this.root;
123
+ const root = this.root;
124
+ const layers = this.layers;
125
+ const toasts = this.toasts;
126
+ return {
127
+ render: (s) => {
128
+ const full = { x: 0, y: 0, width: s.width, height: s.height };
129
+ if (root)
130
+ s.child(root, full);
131
+ for (const entry of layers)
132
+ s.child(entry.layer, full);
133
+ let y = 0;
134
+ for (const entry of toasts) {
135
+ const w = Math.min(40, s.width);
136
+ const h = s.measure(entry.view, w);
137
+ if (y + h > s.height)
138
+ break;
139
+ s.child(entry.view, { x: s.width - w, y, width: w, height: h });
140
+ y += h + 1;
141
+ }
142
+ },
143
+ };
144
+ }
145
+ navigateFocus(direction) {
146
+ const focusables = this.entries.filter((entry) => entry.component.handleInput).map((entry) => entry.component);
147
+ if (focusables.length === 0)
148
+ return null;
149
+ const current = this.focused ? focusables.indexOf(this.focused) : -1;
150
+ const forward = direction === 'next';
151
+ const next = forward ? (current + 1) % focusables.length : (current - 1 + focusables.length) % focusables.length;
152
+ this.setFocus(focusables[next]);
153
+ return focusables[next];
154
+ }
155
+ addGlobalKeybinding(binding) {
156
+ return this.inputRouter.addGlobalKeybinding(binding);
157
+ }
158
+ addInputInterceptor(listener) {
159
+ return this.inputRouter.addInputInterceptor(listener);
160
+ }
161
+ requestRender(force = false) {
162
+ this.renderer.requestRender(force);
163
+ }
164
+ renderNow() {
165
+ this.renderer.doRender();
166
+ }
167
+ componentAt(x, y) {
168
+ for (let i = this.entries.length - 1; i >= 0; i--) {
169
+ if ((0, insets_1.containsPoint)(this.entries[i].rect, x, y))
170
+ return this.entries[i].component;
171
+ }
172
+ return null;
173
+ }
174
+ start() {
175
+ if (this.started)
176
+ return;
177
+ this.started = true;
178
+ this.renderer.setStopped(false);
179
+ this.inputRouter.setStopped(false);
180
+ this.terminal.start?.((data) => this.inputRouter.feed(data), () => this.handleResize());
181
+ this.terminal.hideCursor();
182
+ this.requestRender(true);
183
+ }
184
+ stop() {
185
+ if (!this.started)
186
+ return;
187
+ this.started = false;
188
+ this.renderer.setStopped(true);
189
+ this.inputRouter.setStopped(true);
190
+ this.renderer.moveCursorAfterRenderedContent();
191
+ this.terminal.stop?.();
192
+ this.terminal.showCursor();
193
+ }
194
+ handleResize() {
195
+ this.requestRender(true);
196
+ }
197
+ }
198
+ exports.TUI = TUI;
@@ -0,0 +1,20 @@
1
+ import type { Capabilities } from '../capabilities';
2
+ export type TerminalMode = 'alternateScreen' | 'bracketedPaste' | 'focusEvents' | 'sgrMouse' | 'mouseDrag' | 'mouseMotion' | 'pixelMouse' | 'synchronizedOutput' | 'kittyKeyboard' | 'modifyOtherKeys';
3
+ export interface Terminal {
4
+ readonly columns: number;
5
+ readonly rows: number;
6
+ write: (data: string) => void;
7
+ hideCursor: () => void;
8
+ showCursor: () => void;
9
+ clearScreen: () => void;
10
+ clearLine: () => void;
11
+ clearFromCursor: () => void;
12
+ moveBy: (lines: number) => void;
13
+ enableMode?: (mode: TerminalMode) => void;
14
+ disableMode?: (mode: TerminalMode) => void;
15
+ enableMouse?: () => void;
16
+ disableMouse?: () => void;
17
+ start?: (onInput: (data: string) => void, onResize: () => void) => void;
18
+ stop?: () => void;
19
+ readonly capabilities?: Capabilities;
20
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ export declare function stripAnsi(s: string): string;
2
+ export declare function visibleWidth(s: string): number;
3
+ export declare function charWidth(code: number): number;
4
+ export declare function truncateToWidth(s: string, width: number, ellipsis?: string): string;
5
+ export declare function wrapText(text: string, width: number): string[];
6
+ export declare function sliceByColumn(s: string, start: number, end: number, strict?: boolean): string;