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,140 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TerminalInputParser = void 0;
4
+ const keyboard_1 = require("./keyboard");
5
+ const ESC = '\x1b';
6
+ const PASTE_START = '\x1b[200~';
7
+ const PASTE_END = '\x1b[201~';
8
+ class TerminalInputParser {
9
+ options;
10
+ buffer = '';
11
+ paste = '';
12
+ inPaste = false;
13
+ pasteOverflowed = false;
14
+ constructor(options = {}) {
15
+ this.options = options;
16
+ }
17
+ feed(data) {
18
+ this.buffer += data;
19
+ const events = [];
20
+ while (this.buffer.length > 0) {
21
+ if (this.inPaste) {
22
+ const end = this.buffer.indexOf(PASTE_END);
23
+ if (end === -1) {
24
+ if (!this.pasteOverflowed) {
25
+ this.paste += this.buffer;
26
+ if (this.paste.length > this.maxPasteBytes) {
27
+ this.paste = this.paste.slice(0, this.maxPasteBytes);
28
+ this.pasteOverflowed = true;
29
+ }
30
+ }
31
+ this.buffer = '';
32
+ break;
33
+ }
34
+ if (!this.pasteOverflowed) {
35
+ this.paste += this.buffer.slice(0, end);
36
+ if (this.paste.length > this.maxPasteBytes) {
37
+ this.paste = this.paste.slice(0, this.maxPasteBytes);
38
+ }
39
+ }
40
+ this.buffer = this.buffer.slice(end + PASTE_END.length);
41
+ events.push({ type: 'paste', text: this.paste, raw: `${PASTE_START}${this.paste}${PASTE_END}` });
42
+ this.paste = '';
43
+ this.inPaste = false;
44
+ this.pasteOverflowed = false;
45
+ continue;
46
+ }
47
+ if (this.buffer.startsWith(PASTE_START)) {
48
+ this.buffer = this.buffer.slice(PASTE_START.length);
49
+ this.inPaste = true;
50
+ continue;
51
+ }
52
+ const token = takeToken(this.buffer);
53
+ if (token === null) {
54
+ if (this.buffer.length > this.maxBufferBytes) {
55
+ events.push({
56
+ type: 'terminalResponse',
57
+ raw: this.buffer.slice(0, this.maxBufferBytes),
58
+ sequence: 'unknown',
59
+ });
60
+ this.buffer = '';
61
+ continue;
62
+ }
63
+ break;
64
+ }
65
+ this.buffer = this.buffer.slice(token.length);
66
+ const event = (0, keyboard_1.parseInput)(token);
67
+ if (event)
68
+ events.push(event);
69
+ }
70
+ return events;
71
+ }
72
+ flushPending() {
73
+ if (this.buffer.length === 0)
74
+ return [];
75
+ const raw = this.buffer;
76
+ this.buffer = '';
77
+ const event = (0, keyboard_1.parseInput)(raw);
78
+ return event ? [event] : [{ type: 'terminalResponse', raw, sequence: 'unknown' }];
79
+ }
80
+ hasPending() {
81
+ return this.buffer.length > 0;
82
+ }
83
+ get maxBufferBytes() {
84
+ return this.options.maxBufferBytes ?? 64 * 1024;
85
+ }
86
+ get maxPasteBytes() {
87
+ return this.options.maxPasteBytes ?? 1024 * 1024;
88
+ }
89
+ }
90
+ exports.TerminalInputParser = TerminalInputParser;
91
+ function takeToken(input) {
92
+ if (input.length === 0)
93
+ return null;
94
+ if (!input.startsWith(ESC))
95
+ return takeTextOrControl(input);
96
+ if (input.length === 1)
97
+ return null;
98
+ const prefix = input.slice(0, 2);
99
+ if (prefix === '\x1b[')
100
+ return takeCsi(input);
101
+ if (prefix === '\x1b]')
102
+ return takeString(input, true);
103
+ if (prefix === '\x1bP' || prefix === '\x1b_' || prefix === '\x1b^' || prefix === '\x1bX') {
104
+ return takeString(input, false);
105
+ }
106
+ if (prefix === '\x1bO')
107
+ return input.length >= 3 ? input.slice(0, 3) : null;
108
+ return Array.from(input).length >= 2 ? ESC + Array.from(input.slice(1))[0] : null;
109
+ }
110
+ function takeTextOrControl(input) {
111
+ const first = input.codePointAt(0) ?? 0;
112
+ if (first < 0x20 || first === 0x7f)
113
+ return input.slice(0, 1);
114
+ let end = 0;
115
+ for (const ch of input) {
116
+ const code = ch.codePointAt(0) ?? 0;
117
+ if (ch === ESC || code < 0x20 || code === 0x7f)
118
+ break;
119
+ end += ch.length;
120
+ }
121
+ return input.slice(0, end);
122
+ }
123
+ function takeCsi(input) {
124
+ for (let i = 2; i < input.length; i++) {
125
+ const code = input.charCodeAt(i);
126
+ if (code >= 0x40 && code <= 0x7e) {
127
+ return input.slice(0, i + 1);
128
+ }
129
+ }
130
+ return null;
131
+ }
132
+ function takeString(input, allowBel) {
133
+ for (let i = 2; i < input.length; i++) {
134
+ if (allowBel && input.charCodeAt(i) === 0x07)
135
+ return input.slice(0, i + 1);
136
+ if (input[i] === ESC && input[i + 1] === '\\')
137
+ return input.slice(0, i + 2);
138
+ }
139
+ return null;
140
+ }
@@ -0,0 +1,32 @@
1
+ import type { Rgba } from './layout/color';
2
+ import { type Component, type SurfaceEntry } from './surface';
3
+ import type { Terminal } from './types/terminal';
4
+ export interface RendererHost {
5
+ getRoot(): Component | null;
6
+ isFocused(component: Component): boolean;
7
+ setEntries(entries: SurfaceEntry[]): void;
8
+ getBackdropColor(): Rgba;
9
+ }
10
+ export declare class Renderer {
11
+ private readonly terminal;
12
+ private readonly host;
13
+ private readonly useSynchronizedOutput;
14
+ private previousBuffer;
15
+ private previousUsedHeight;
16
+ private renderRequested;
17
+ private renderTimer;
18
+ private lastRenderAt;
19
+ private stopped;
20
+ private static readonly MIN_RENDER_INTERVAL_MS;
21
+ constructor(terminal: Terminal, host: RendererHost, useSynchronizedOutput: boolean);
22
+ setStopped(stopped: boolean): void;
23
+ requestRender(force?: boolean): void;
24
+ private scheduleRender;
25
+ private renderFrame;
26
+ doRender(): void;
27
+ private fullRender;
28
+ private cellDiffRender;
29
+ moveCursorAfterRenderedContent(): void;
30
+ private frameStart;
31
+ private frameEnd;
32
+ }
@@ -0,0 +1,175 @@
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.Renderer = void 0;
7
+ const node_perf_hooks_1 = require("node:perf_hooks");
8
+ const node_process_1 = __importDefault(require("node:process"));
9
+ const ansi_1 = require("./layout/ansi");
10
+ const cellbuffer_1 = require("./layout/cellbuffer");
11
+ const surface_1 = require("./surface");
12
+ class Renderer {
13
+ terminal;
14
+ host;
15
+ useSynchronizedOutput;
16
+ previousBuffer = null;
17
+ previousUsedHeight = 0;
18
+ renderRequested = false;
19
+ renderTimer;
20
+ lastRenderAt = 0;
21
+ stopped = false;
22
+ static MIN_RENDER_INTERVAL_MS = 16;
23
+ constructor(terminal, host, useSynchronizedOutput) {
24
+ this.terminal = terminal;
25
+ this.host = host;
26
+ this.useSynchronizedOutput = useSynchronizedOutput;
27
+ }
28
+ setStopped(stopped) {
29
+ this.stopped = stopped;
30
+ if (stopped && this.renderTimer) {
31
+ clearTimeout(this.renderTimer);
32
+ this.renderTimer = undefined;
33
+ }
34
+ }
35
+ requestRender(force = false) {
36
+ if (force) {
37
+ this.previousBuffer = null;
38
+ this.previousUsedHeight = 0;
39
+ if (this.renderTimer) {
40
+ clearTimeout(this.renderTimer);
41
+ this.renderTimer = undefined;
42
+ }
43
+ this.renderRequested = true;
44
+ node_process_1.default.nextTick(() => {
45
+ if (this.stopped || !this.renderRequested)
46
+ return;
47
+ this.renderRequested = false;
48
+ this.lastRenderAt = node_perf_hooks_1.performance.now();
49
+ this.doRender();
50
+ });
51
+ return;
52
+ }
53
+ if (this.renderRequested)
54
+ return;
55
+ this.renderRequested = true;
56
+ node_process_1.default.nextTick(() => this.scheduleRender());
57
+ }
58
+ scheduleRender() {
59
+ if (this.stopped || this.renderTimer || !this.renderRequested)
60
+ return;
61
+ const elapsed = node_perf_hooks_1.performance.now() - this.lastRenderAt;
62
+ const delay = Math.max(0, Renderer.MIN_RENDER_INTERVAL_MS - elapsed);
63
+ this.renderTimer = setTimeout(() => {
64
+ this.renderTimer = undefined;
65
+ if (this.stopped || !this.renderRequested)
66
+ return;
67
+ this.renderRequested = false;
68
+ this.lastRenderAt = node_perf_hooks_1.performance.now();
69
+ this.doRender();
70
+ if (this.renderRequested) {
71
+ this.scheduleRender();
72
+ }
73
+ }, delay);
74
+ }
75
+ renderFrame(width, height) {
76
+ const backdrop = this.host.getBackdropColor();
77
+ const buffer = (0, cellbuffer_1.createCellBuffer)(width, height, backdrop);
78
+ (0, cellbuffer_1.setBackdropColor)(buffer, backdrop);
79
+ const root = this.host.getRoot();
80
+ if (root) {
81
+ this.host.setEntries((0, surface_1.renderToBuffer)(root, buffer, (component) => this.host.isFocused(component)));
82
+ }
83
+ else {
84
+ this.host.setEntries([]);
85
+ }
86
+ return buffer;
87
+ }
88
+ doRender() {
89
+ if (this.stopped)
90
+ return;
91
+ const width = this.terminal.columns;
92
+ const height = this.terminal.rows;
93
+ const buffer = this.renderFrame(width, height);
94
+ const usedHeight = (0, cellbuffer_1.bufferUsedHeight)(buffer);
95
+ const prev = this.previousBuffer;
96
+ const sizeChanged = prev !== null && (prev.width !== width || prev.height !== height);
97
+ if (prev === null || sizeChanged || usedHeight > this.previousUsedHeight) {
98
+ this.fullRender(buffer, usedHeight, sizeChanged);
99
+ }
100
+ else {
101
+ this.cellDiffRender(prev, buffer, usedHeight);
102
+ }
103
+ this.previousBuffer = buffer;
104
+ this.previousUsedHeight = usedHeight;
105
+ }
106
+ fullRender(buffer, usedHeight, clear) {
107
+ const lines = (0, cellbuffer_1.cellBufferToLines)(buffer).slice(0, usedHeight);
108
+ const reset = '\x1b[0m\x1b]8;;\x07';
109
+ for (let i = 0; i < lines.length; i++)
110
+ lines[i] += reset;
111
+ let out = this.frameStart();
112
+ if (clear) {
113
+ out += '\x1b[2J\x1b[H\x1b[3J';
114
+ }
115
+ else if (this.previousBuffer !== null) {
116
+ out += '\x1b8';
117
+ }
118
+ for (let i = 0; i < lines.length; i++) {
119
+ if (i > 0)
120
+ out += '\r\n';
121
+ out += lines[i];
122
+ }
123
+ if (lines.length > 1) {
124
+ out += `\r\x1b[${lines.length - 1}A`;
125
+ }
126
+ else {
127
+ out += '\r';
128
+ }
129
+ out += '\x1b7';
130
+ out += this.frameEnd();
131
+ this.terminal.write(out);
132
+ }
133
+ cellDiffRender(prev, next, usedHeight) {
134
+ const maxRow = Math.max(usedHeight, this.previousUsedHeight);
135
+ const runs = (0, cellbuffer_1.diffBuffer)(prev, next, maxRow);
136
+ if (runs.length === 0)
137
+ return;
138
+ let out = this.frameStart();
139
+ let curRow = -1;
140
+ for (const run of runs) {
141
+ if (run.y !== curRow) {
142
+ out += '\x1b8';
143
+ if (run.y > 0)
144
+ out += `\x1b[${run.y}B`;
145
+ curRow = run.y;
146
+ }
147
+ if (run.clear) {
148
+ out += '\x1b[0m\x1b[2K';
149
+ }
150
+ else {
151
+ out += `\x1b[${run.x + 1}G`;
152
+ out += (0, ansi_1.cellsToAnsi)(run.cells);
153
+ }
154
+ }
155
+ out += '\x1b8';
156
+ out += this.frameEnd();
157
+ this.terminal.write(out);
158
+ }
159
+ moveCursorAfterRenderedContent() {
160
+ if (this.previousBuffer === null)
161
+ return;
162
+ let out = '';
163
+ if (this.previousUsedHeight > 0)
164
+ out += `\x1b[${this.previousUsedHeight}B`;
165
+ out += '\r\n';
166
+ this.terminal.write(out);
167
+ }
168
+ frameStart() {
169
+ return this.useSynchronizedOutput ? '\x1b[?2026h' : '';
170
+ }
171
+ frameEnd() {
172
+ return this.useSynchronizedOutput ? '\x1b[?2026l' : '';
173
+ }
174
+ }
175
+ exports.Renderer = Renderer;
@@ -0,0 +1,27 @@
1
+ import type { InputEvent } from './events';
2
+ import { type CellBuffer } from './layout/cellbuffer';
3
+ import type { Color, Rect } from './layout/types';
4
+ export interface Component {
5
+ render(surface: Surface): void;
6
+ handleInput?(event: InputEvent): void;
7
+ wantsKeyRelease?: boolean;
8
+ }
9
+ export interface Surface {
10
+ readonly width: number;
11
+ readonly height: number;
12
+ readonly focused: boolean;
13
+ text(x: number, y: number, value: string): void;
14
+ fill(rect: Rect, color: Color, opacity?: number): void;
15
+ measure(child: Component, width: number): number;
16
+ child(child: Component, rect: Rect, opts?: {
17
+ opacity?: number;
18
+ focused?: boolean;
19
+ }): void;
20
+ }
21
+ export interface SurfaceEntry {
22
+ component: Component;
23
+ rect: Rect;
24
+ }
25
+ export declare function measure(component: Component, width: number): number;
26
+ export declare function measureWidth(component: Component, maxWidth: number): number;
27
+ export declare function renderToBuffer(component: Component, buffer: CellBuffer, isFocused?: (component: Component) => boolean): SurfaceEntry[];
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.measure = measure;
4
+ exports.measureWidth = measureWidth;
5
+ exports.renderToBuffer = renderToBuffer;
6
+ const ansi_1 = require("./layout/ansi");
7
+ const cellbuffer_1 = require("./layout/cellbuffer");
8
+ const color_1 = require("./layout/color");
9
+ const insets_1 = require("./layout/insets");
10
+ const utils_1 = require("./utils");
11
+ class BufferSurface {
12
+ env;
13
+ ox;
14
+ oy;
15
+ width;
16
+ height;
17
+ clip;
18
+ focused;
19
+ constructor(env, ox, oy, width, height, clip, focused) {
20
+ this.env = env;
21
+ this.ox = ox;
22
+ this.oy = oy;
23
+ this.width = width;
24
+ this.height = height;
25
+ this.clip = clip;
26
+ this.focused = focused;
27
+ }
28
+ text(x, y, value) {
29
+ if (y < 0 || y >= this.height)
30
+ return;
31
+ (0, cellbuffer_1.writeCells)(this.env.buffer, this.ox + x, this.oy + y, (0, ansi_1.parseLine)(value), this.clip);
32
+ }
33
+ fill(rect, color, opacity = 1) {
34
+ const abs = { x: this.ox + rect.x, y: this.oy + rect.y, width: rect.width, height: rect.height };
35
+ (0, cellbuffer_1.fillBackground)(this.env.buffer, abs, (0, color_1.colorToRgba)(color, opacity), this.clip);
36
+ }
37
+ measure(child, width) {
38
+ return measure(child, width);
39
+ }
40
+ child(child, rect, opts) {
41
+ const ox = this.ox + rect.x;
42
+ const oy = this.oy + rect.y;
43
+ const abs = { x: ox, y: oy, width: rect.width, height: rect.height };
44
+ const clip = (0, insets_1.intersectRect)(this.clip, abs);
45
+ const focused = opts?.focused ?? this.env.isFocused(child);
46
+ const sub = new BufferSurface(this.env, ox, oy, rect.width, rect.height, clip, focused);
47
+ this.env.entries.push({ component: child, rect: abs });
48
+ const dim = opts?.opacity !== undefined && opts.opacity < 1;
49
+ if (dim)
50
+ (0, cellbuffer_1.pushOpacity)(this.env.buffer, opts.opacity);
51
+ child.render(sub);
52
+ if (dim)
53
+ (0, cellbuffer_1.popOpacity)(this.env.buffer);
54
+ }
55
+ }
56
+ class ProbeSurface {
57
+ width;
58
+ maxRow = 0;
59
+ maxCol = 0;
60
+ height = Number.POSITIVE_INFINITY;
61
+ focused = false;
62
+ constructor(width) {
63
+ this.width = width;
64
+ }
65
+ bumpRow(row) {
66
+ if (row > this.maxRow)
67
+ this.maxRow = row;
68
+ }
69
+ bumpCol(col) {
70
+ if (col > this.maxCol)
71
+ this.maxCol = col;
72
+ }
73
+ text(x, y, value) {
74
+ this.bumpRow(y + value.split('\n').length);
75
+ let width = 0;
76
+ for (const line of value.split('\n')) {
77
+ const lineWidth = (0, utils_1.visibleWidth)(line);
78
+ if (lineWidth > width)
79
+ width = lineWidth;
80
+ }
81
+ this.bumpCol(x + width);
82
+ }
83
+ fill(rect) {
84
+ if (Number.isFinite(rect.height))
85
+ this.bumpRow(rect.y + rect.height);
86
+ if (Number.isFinite(rect.width))
87
+ this.bumpCol(rect.x + rect.width);
88
+ }
89
+ measure(child, width) {
90
+ return measure(child, width);
91
+ }
92
+ child(_child, rect) {
93
+ if (Number.isFinite(rect.height))
94
+ this.bumpRow(rect.y + rect.height);
95
+ if (Number.isFinite(rect.width))
96
+ this.bumpCol(rect.x + rect.width);
97
+ }
98
+ }
99
+ function measure(component, width) {
100
+ const probe = new ProbeSurface(Math.max(0, width));
101
+ component.render(probe);
102
+ return probe.maxRow;
103
+ }
104
+ function measureWidth(component, maxWidth) {
105
+ const probe = new ProbeSurface(Math.max(0, maxWidth));
106
+ component.render(probe);
107
+ return probe.maxCol;
108
+ }
109
+ function renderToBuffer(component, buffer, isFocused = () => false) {
110
+ const entries = [];
111
+ const env = { buffer, isFocused, entries };
112
+ const clip = { x: 0, y: 0, width: buffer.width, height: buffer.height };
113
+ component.render(new BufferSurface(env, 0, 0, buffer.width, buffer.height, clip, false));
114
+ return entries;
115
+ }
@@ -0,0 +1,48 @@
1
+ import { type Capabilities, type PartialCapabilities } from './capabilities';
2
+ import type { Terminal, TerminalMode } from './types/terminal';
3
+ export interface ProcessTerminalOptions {
4
+ capabilities?: PartialCapabilities;
5
+ alternateScreen?: boolean;
6
+ bracketedPaste?: boolean;
7
+ focusEvents?: boolean;
8
+ keyboard?: boolean;
9
+ mouse?: boolean | {
10
+ drag?: boolean;
11
+ motion?: boolean;
12
+ pixel?: boolean;
13
+ };
14
+ }
15
+ export declare class ProcessTerminal implements Terminal {
16
+ private readonly options;
17
+ private _columns;
18
+ private _rows;
19
+ private onData;
20
+ private onResize;
21
+ private cleanupHandlers;
22
+ private stdinDataHandler;
23
+ private stdoutResizeHandler;
24
+ private started;
25
+ private readonly enabledModes;
26
+ readonly capabilities: Capabilities;
27
+ constructor(options?: ProcessTerminalOptions);
28
+ get columns(): number;
29
+ get rows(): number;
30
+ write(data: string): void;
31
+ hideCursor(): void;
32
+ showCursor(): void;
33
+ clearScreen(): void;
34
+ clearLine(): void;
35
+ clearFromCursor(): void;
36
+ moveBy(lines: number): void;
37
+ enableMode(mode: TerminalMode): void;
38
+ disableMode(mode: TerminalMode): void;
39
+ enableMouse(): void;
40
+ disableMouse(): void;
41
+ start(onInput: (data: string) => void, onResize: () => void): void;
42
+ stop(): void;
43
+ private applyStartupModes;
44
+ private restoreModes;
45
+ private restoreInputAfterDrain;
46
+ private stopNow;
47
+ private restoreInputNow;
48
+ }