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,306 @@
1
+ import { cellsToAnsi } from './ansi';
2
+ import { cellEqual, continuationCell, defaultStyle, emptyCell } from './cell';
3
+ import { blendOver, OPAQUE_BLACK, withOpacity } from './color';
4
+ import { intersectRect, isEmptyRect } from './insets';
5
+ import { DEFAULT_BORDER_CHARS } from './types';
6
+ export function createCellBuffer(width, height, backdropColor) {
7
+ const w = Math.max(0, width);
8
+ const h = Math.max(0, height);
9
+ const cells = new Array(w * h);
10
+ for (let i = 0; i < cells.length; i++)
11
+ cells[i] = emptyCell();
12
+ return {
13
+ width: w,
14
+ height: h,
15
+ cells,
16
+ backdropColor: backdropColor ?? OPAQUE_BLACK,
17
+ opacityStack: [],
18
+ };
19
+ }
20
+ export function setBackdropColor(buf, color) {
21
+ buf.backdropColor = { ...color, a: 1 };
22
+ }
23
+ export function pushOpacity(buf, opacity) {
24
+ buf.opacityStack.push(Math.max(0, Math.min(1, opacity)));
25
+ }
26
+ export function popOpacity(buf) {
27
+ buf.opacityStack.pop();
28
+ }
29
+ export function effectiveOpacity(buf) {
30
+ let o = 1;
31
+ for (const v of buf.opacityStack)
32
+ o *= v;
33
+ return o;
34
+ }
35
+ function bufferRect(buf) {
36
+ return { x: 0, y: 0, width: buf.width, height: buf.height };
37
+ }
38
+ function hasDecoration(style) {
39
+ return style.reverse || style.underline || style.bold || style.italic || style.dim ||
40
+ style.strikethrough || style.blink || style.link !== undefined;
41
+ }
42
+ function getIndex(buf, x, y) {
43
+ return y * buf.width + x;
44
+ }
45
+ export function getCell(buf, x, y) {
46
+ return buf.cells[getIndex(buf, x, y)];
47
+ }
48
+ export function compositeCell(buf, x, y, incoming, opacity = 1) {
49
+ if (x < 0 || x >= buf.width || y < 0 || y >= buf.height)
50
+ return;
51
+ if (incoming.width === 0)
52
+ return;
53
+ const existing = buf.cells[getIndex(buf, x, y)];
54
+ const incomingBg = opacity < 1 ? withOpacity(incoming.style.bg, opacity) : incoming.style.bg;
55
+ const incomingFg = opacity < 1 ? withOpacity(incoming.style.fg, opacity) : incoming.style.fg;
56
+ let newBg;
57
+ if (incomingBg.a <= 0) {
58
+ newBg = existing.style.bg;
59
+ }
60
+ else if (incomingBg.a >= 1) {
61
+ newBg = incomingBg;
62
+ }
63
+ else {
64
+ const baseBg = existing.style.bg.a <= 0 ? buf.backdropColor : existing.style.bg;
65
+ newBg = blendOver(incomingBg, baseBg);
66
+ }
67
+ const isTransparentSpace = incoming.grapheme === ' ' && incomingBg.a < 1 && !hasDecoration(incoming.style);
68
+ if (isTransparentSpace) {
69
+ existing.style = { ...existing.style, bg: newBg };
70
+ return;
71
+ }
72
+ const newStyle = {
73
+ ...incoming.style,
74
+ fg: incomingFg,
75
+ bg: newBg,
76
+ };
77
+ buf.cells[getIndex(buf, x, y)] = {
78
+ grapheme: incoming.grapheme,
79
+ width: incoming.width,
80
+ style: newStyle,
81
+ };
82
+ if (incoming.width === 2 && x + 1 < buf.width) {
83
+ const cont = continuationCell();
84
+ cont.style = newStyle;
85
+ buf.cells[getIndex(buf, x + 1, y)] = cont;
86
+ }
87
+ }
88
+ export function fillBackground(buf, rect, color, clip) {
89
+ if (color.a <= 0)
90
+ return;
91
+ const opacity = effectiveOpacity(buf);
92
+ const tinted = opacity < 1 ? withOpacity(color, opacity) : color;
93
+ if (tinted.a <= 0)
94
+ return;
95
+ const safe = intersectRect(intersectRect(rect, clip), bufferRect(buf));
96
+ if (isEmptyRect(safe))
97
+ return;
98
+ for (let y = safe.y; y < safe.y + safe.height; y++) {
99
+ for (let x = safe.x; x < safe.x + safe.width; x++) {
100
+ const cell = buf.cells[getIndex(buf, x, y)];
101
+ const baseBg = cell.style.bg.a <= 0 ? buf.backdropColor : cell.style.bg;
102
+ cell.style = { ...cell.style, bg: blendOver(tinted, baseBg) };
103
+ }
104
+ }
105
+ }
106
+ export function writeCells(buf, x, y, cells, clip) {
107
+ if (cells.length === 0)
108
+ return;
109
+ const safe = intersectRect(clip, bufferRect(buf));
110
+ if (isEmptyRect(safe))
111
+ return;
112
+ if (y < safe.y || y >= safe.y + safe.height)
113
+ return;
114
+ const opacity = effectiveOpacity(buf);
115
+ let col = x;
116
+ for (let i = 0; i < cells.length; i++) {
117
+ const cell = cells[i];
118
+ if (cell.width === 0)
119
+ continue;
120
+ if (col >= safe.x + safe.width)
121
+ break;
122
+ if (cell.width === 2) {
123
+ if (col + 1 >= safe.x + safe.width || col < safe.x) {
124
+ if (col >= safe.x && col < safe.x + safe.width) {
125
+ const sub = {
126
+ grapheme: ' ',
127
+ width: 1,
128
+ style: cell.style,
129
+ };
130
+ compositeCell(buf, col, y, sub, opacity);
131
+ }
132
+ col += cell.width;
133
+ continue;
134
+ }
135
+ }
136
+ if (col >= safe.x) {
137
+ compositeCell(buf, col, y, cell, opacity);
138
+ }
139
+ col += cell.width;
140
+ }
141
+ }
142
+ export function drawBorderCells(buf, rect, style, clip) {
143
+ if (rect.width <= 0 || rect.height <= 0)
144
+ return;
145
+ const safe = intersectRect(clip, bufferRect(buf));
146
+ if (isEmptyRect(safe))
147
+ return;
148
+ const resolved = resolveBorder(style);
149
+ const chars = resolved.chars;
150
+ const top = rect.y;
151
+ const bottom = rect.y + rect.height - 1;
152
+ const left = rect.x;
153
+ const right = rect.x + rect.width - 1;
154
+ const drawAt = (x, y, grapheme) => {
155
+ if (x < safe.x || x >= safe.x + safe.width)
156
+ return;
157
+ if (y < safe.y || y >= safe.y + safe.height)
158
+ return;
159
+ const cell = { grapheme, width: 1, style: defaultStyle() };
160
+ compositeCell(buf, x, y, cell);
161
+ };
162
+ if (resolved.top && rect.height >= 1) {
163
+ for (let x = left; x <= right; x++) {
164
+ let ch = chars.horizontal;
165
+ if (x === left && resolved.left)
166
+ ch = chars.topLeft;
167
+ else if (x === right && resolved.right)
168
+ ch = chars.topRight;
169
+ drawAt(x, top, ch);
170
+ }
171
+ }
172
+ if (resolved.bottom && rect.height >= 2) {
173
+ for (let x = left; x <= right; x++) {
174
+ let ch = chars.horizontal;
175
+ if (x === left && resolved.left)
176
+ ch = chars.bottomLeft;
177
+ else if (x === right && resolved.right)
178
+ ch = chars.bottomRight;
179
+ drawAt(x, bottom, ch);
180
+ }
181
+ }
182
+ if (resolved.left && rect.width >= 1) {
183
+ const startY = resolved.top ? top + 1 : top;
184
+ const endY = resolved.bottom ? bottom - 1 : bottom;
185
+ for (let y = startY; y <= endY; y++)
186
+ drawAt(left, y, chars.vertical);
187
+ }
188
+ if (resolved.right && rect.width >= 2) {
189
+ const startY = resolved.top ? top + 1 : top;
190
+ const endY = resolved.bottom ? bottom - 1 : bottom;
191
+ for (let y = startY; y <= endY; y++)
192
+ drawAt(right, y, chars.vertical);
193
+ }
194
+ }
195
+ export function cellBufferToLines(buf) {
196
+ const lines = new Array(buf.height);
197
+ for (let y = 0; y < buf.height; y++) {
198
+ const row = new Array(buf.width);
199
+ for (let x = 0; x < buf.width; x++) {
200
+ row[x] = finalizeCell(buf, buf.cells[getIndex(buf, x, y)]);
201
+ }
202
+ lines[y] = cellsToAnsi(row);
203
+ }
204
+ return lines;
205
+ }
206
+ function finalizeCell(buf, cell) {
207
+ const bg = cell.style.bg;
208
+ if (bg.a >= 1)
209
+ return cell;
210
+ if (bg.a <= 0)
211
+ return cell;
212
+ return {
213
+ grapheme: cell.grapheme,
214
+ width: cell.width,
215
+ style: { ...cell.style, bg: blendOver(bg, buf.backdropColor) },
216
+ };
217
+ }
218
+ function resolveBorder(style) {
219
+ if (style === true) {
220
+ return { top: true, right: true, bottom: true, left: true, chars: DEFAULT_BORDER_CHARS };
221
+ }
222
+ return {
223
+ top: style.top !== false,
224
+ right: style.right !== false,
225
+ bottom: style.bottom !== false,
226
+ left: style.left !== false,
227
+ chars: style.chars ?? DEFAULT_BORDER_CHARS,
228
+ };
229
+ }
230
+ function cellIsBlank(cell) {
231
+ if (cell.grapheme !== ' ' && cell.grapheme !== '')
232
+ return false;
233
+ const s = cell.style;
234
+ if (s.bold || s.dim || s.italic || s.underline || s.strikethrough || s.reverse || s.blink || s.link !== undefined) {
235
+ return false;
236
+ }
237
+ if (s.fg.intent !== 'default')
238
+ return false;
239
+ if (s.bg.intent !== 'default' && s.bg.a > 0)
240
+ return false;
241
+ return true;
242
+ }
243
+ function isBlankRow(buf, y) {
244
+ const base = y * buf.width;
245
+ for (let x = 0; x < buf.width; x++) {
246
+ if (!cellIsBlank(buf.cells[base + x]))
247
+ return false;
248
+ }
249
+ return true;
250
+ }
251
+ export function bufferUsedHeight(buf) {
252
+ for (let y = buf.height - 1; y >= 0; y--) {
253
+ if (!isBlankRow(buf, y))
254
+ return y + 1;
255
+ }
256
+ return 0;
257
+ }
258
+ export function diffBuffer(prev, next, maxRow, mergeGap = 4) {
259
+ const runs = [];
260
+ const width = next.width;
261
+ const rows = Math.min(maxRow, next.height);
262
+ for (let y = 0; y < rows; y++) {
263
+ const base = y * width;
264
+ if (isBlankRow(next, y)) {
265
+ if (!isBlankRow(prev, y))
266
+ runs.push({ y, x: 0, cells: [], clear: true });
267
+ continue;
268
+ }
269
+ let x = 0;
270
+ let prevEnd = 0;
271
+ while (x < width) {
272
+ if (cellEqual(prev.cells[base + x], next.cells[base + x])) {
273
+ x++;
274
+ continue;
275
+ }
276
+ let start = x;
277
+ while (start > prevEnd && next.cells[base + start].width === 0)
278
+ start--;
279
+ let lastChange = x;
280
+ let gap = 0;
281
+ let xi = x + 1;
282
+ while (xi < width) {
283
+ if (!cellEqual(prev.cells[base + xi], next.cells[base + xi])) {
284
+ lastChange = xi;
285
+ gap = 0;
286
+ }
287
+ else {
288
+ gap++;
289
+ if (gap > mergeGap)
290
+ break;
291
+ }
292
+ xi++;
293
+ }
294
+ let end = lastChange + 1;
295
+ if (end < width && next.cells[base + end].width === 0)
296
+ end++;
297
+ const cells = [];
298
+ for (let i = start; i < end; i++)
299
+ cells.push(finalizeCell(next, next.cells[base + i]));
300
+ runs.push({ y, x: start, cells });
301
+ prevEnd = end;
302
+ x = end;
303
+ }
304
+ }
305
+ return runs;
306
+ }
@@ -0,0 +1,22 @@
1
+ import type { Color } from './types';
2
+ export type ColorIntent = 'rgb' | 'indexed' | 'default';
3
+ export interface Rgba {
4
+ r: number;
5
+ g: number;
6
+ b: number;
7
+ a: number;
8
+ intent: ColorIntent;
9
+ index?: number;
10
+ }
11
+ export declare const DEFAULT_FG: Rgba;
12
+ export declare const DEFAULT_BG: Rgba;
13
+ export declare const TRANSPARENT: Rgba;
14
+ export declare const OPAQUE_BLACK: Rgba;
15
+ export declare function colorToRgba(color: Color, alpha?: number): Rgba;
16
+ export declare function indexedColor(index: number, alpha?: number): Rgba;
17
+ export declare function rgbColor(r: number, g: number, b: number, alpha?: number): Rgba;
18
+ export declare function blendOver(front: Rgba, back: Rgba): Rgba;
19
+ export declare function withOpacity(color: Rgba, opacity: number): Rgba;
20
+ export declare function rgbaEqual(a: Rgba, b: Rgba): boolean;
21
+ export declare function rgbaToSgr(color: Rgba, layer: 'fg' | 'bg'): string;
22
+ export declare function palette256(index: number): [number, number, number];
@@ -0,0 +1,163 @@
1
+ export const DEFAULT_FG = { r: 200, g: 200, b: 200, a: 1, intent: 'default' };
2
+ export const DEFAULT_BG = { r: 0, g: 0, b: 0, a: 0, intent: 'default' };
3
+ export const TRANSPARENT = { r: 0, g: 0, b: 0, a: 0, intent: 'rgb' };
4
+ export const OPAQUE_BLACK = { r: 0, g: 0, b: 0, a: 1, intent: 'rgb' };
5
+ const NAMED_COLOR_INDEX = {
6
+ black: 0,
7
+ red: 1,
8
+ green: 2,
9
+ yellow: 3,
10
+ blue: 4,
11
+ magenta: 5,
12
+ cyan: 6,
13
+ white: 7,
14
+ brightBlack: 8,
15
+ brightRed: 9,
16
+ brightGreen: 10,
17
+ brightYellow: 11,
18
+ brightBlue: 12,
19
+ brightMagenta: 13,
20
+ brightCyan: 14,
21
+ brightWhite: 15,
22
+ };
23
+ const ANSI_16_RGB = [
24
+ [0, 0, 0],
25
+ [170, 0, 0],
26
+ [0, 170, 0],
27
+ [170, 85, 0],
28
+ [0, 0, 170],
29
+ [170, 0, 170],
30
+ [0, 170, 170],
31
+ [170, 170, 170],
32
+ [85, 85, 85],
33
+ [255, 85, 85],
34
+ [85, 255, 85],
35
+ [255, 255, 85],
36
+ [85, 85, 255],
37
+ [255, 85, 255],
38
+ [85, 255, 255],
39
+ [255, 255, 255],
40
+ ];
41
+ export function colorToRgba(color, alpha = 1) {
42
+ if (color === 'default') {
43
+ return { ...DEFAULT_FG, a: alpha };
44
+ }
45
+ if (typeof color === 'string' && color.startsWith('#')) {
46
+ const parsed = parseHex(color);
47
+ if (parsed)
48
+ return { ...parsed, a: alpha * parsed.a };
49
+ }
50
+ const index = NAMED_COLOR_INDEX[color];
51
+ if (index !== undefined) {
52
+ const [r, g, b] = ANSI_16_RGB[index];
53
+ return { r, g, b, a: alpha, intent: 'indexed', index };
54
+ }
55
+ return { ...TRANSPARENT };
56
+ }
57
+ export function indexedColor(index, alpha = 1) {
58
+ const [r, g, b] = palette256(index);
59
+ return { r, g, b, a: alpha, intent: 'indexed', index };
60
+ }
61
+ export function rgbColor(r, g, b, alpha = 1) {
62
+ return { r, g, b, a: alpha, intent: 'rgb' };
63
+ }
64
+ export function blendOver(front, back) {
65
+ if (front.a <= 0)
66
+ return back;
67
+ if (front.a >= 1)
68
+ return front;
69
+ const fa = front.a;
70
+ const ba = back.a;
71
+ const outA = fa + ba * (1 - fa);
72
+ if (outA <= 0)
73
+ return { ...TRANSPARENT };
74
+ const r = (front.r * fa + back.r * ba * (1 - fa)) / outA;
75
+ const g = (front.g * fa + back.g * ba * (1 - fa)) / outA;
76
+ const b = (front.b * fa + back.b * ba * (1 - fa)) / outA;
77
+ const intent = front.intent === back.intent ? front.intent : 'rgb';
78
+ return {
79
+ r: Math.round(r),
80
+ g: Math.round(g),
81
+ b: Math.round(b),
82
+ a: outA,
83
+ intent,
84
+ index: intent === 'indexed' ? (front.index ?? back.index) : undefined,
85
+ };
86
+ }
87
+ export function withOpacity(color, opacity) {
88
+ if (opacity >= 1)
89
+ return color;
90
+ if (opacity <= 0)
91
+ return { ...color, a: 0 };
92
+ return { ...color, a: color.a * opacity };
93
+ }
94
+ export function rgbaEqual(a, b) {
95
+ return (a.r === b.r &&
96
+ a.g === b.g &&
97
+ a.b === b.b &&
98
+ a.a === b.a &&
99
+ a.intent === b.intent &&
100
+ a.index === b.index);
101
+ }
102
+ export function rgbaToSgr(color, layer) {
103
+ if (color.intent === 'default') {
104
+ return layer === 'fg' ? '39' : '49';
105
+ }
106
+ if (color.intent === 'indexed' && color.index !== undefined && color.a >= 1) {
107
+ if (color.index < 16) {
108
+ const base = layer === 'fg' ? 30 : 40;
109
+ return color.index < 8 ? `${base + color.index}` : `${base + 60 + (color.index - 8)}`;
110
+ }
111
+ return `${layer === 'fg' ? 38 : 48};5;${color.index}`;
112
+ }
113
+ return `${layer === 'fg' ? 38 : 48};2;${color.r};${color.g};${color.b}`;
114
+ }
115
+ function parseHex(hex) {
116
+ const body = hex.slice(1);
117
+ if (/^[0-9a-fA-F]{3}$/.test(body)) {
118
+ return {
119
+ r: Number.parseInt(body[0] + body[0], 16),
120
+ g: Number.parseInt(body[1] + body[1], 16),
121
+ b: Number.parseInt(body[2] + body[2], 16),
122
+ a: 1,
123
+ intent: 'rgb',
124
+ };
125
+ }
126
+ if (/^[0-9a-fA-F]{6}$/.test(body)) {
127
+ return {
128
+ r: Number.parseInt(body.slice(0, 2), 16),
129
+ g: Number.parseInt(body.slice(2, 4), 16),
130
+ b: Number.parseInt(body.slice(4, 6), 16),
131
+ a: 1,
132
+ intent: 'rgb',
133
+ };
134
+ }
135
+ if (/^[0-9a-fA-F]{8}$/.test(body)) {
136
+ return {
137
+ r: Number.parseInt(body.slice(0, 2), 16),
138
+ g: Number.parseInt(body.slice(2, 4), 16),
139
+ b: Number.parseInt(body.slice(4, 6), 16),
140
+ a: Number.parseInt(body.slice(6, 8), 16) / 255,
141
+ intent: 'rgb',
142
+ };
143
+ }
144
+ return undefined;
145
+ }
146
+ export function palette256(index) {
147
+ if (index < 0 || index > 255)
148
+ return [0, 0, 0];
149
+ if (index < 16)
150
+ return ANSI_16_RGB[index];
151
+ if (index < 232) {
152
+ const i = index - 16;
153
+ const r = Math.floor(i / 36);
154
+ const g = Math.floor((i % 36) / 6);
155
+ const b = i % 6;
156
+ return [step6(r), step6(g), step6(b)];
157
+ }
158
+ const v = 8 + (index - 232) * 10;
159
+ return [v, v, v];
160
+ }
161
+ function step6(v) {
162
+ return v === 0 ? 0 : 55 + v * 40;
163
+ }
@@ -0,0 +1,8 @@
1
+ import type { BorderStyle, Insets, Rect } from './types';
2
+ export declare function normalizeInsets(input?: number | Partial<Insets>): Insets;
3
+ export declare function borderInsets(border?: boolean | BorderStyle): Insets;
4
+ export declare function shrinkRect(rect: Rect, insets: Insets): Rect;
5
+ export declare function intersectRect(a: Rect, b: Rect): Rect;
6
+ export declare function containsPoint(rect: Rect, x: number, y: number): boolean;
7
+ export declare function isEmptyRect(rect: Rect): boolean;
8
+ export declare function insetsForAxis(insets: Insets, axis: 'width' | 'height'): number;
@@ -0,0 +1,55 @@
1
+ const ZERO_INSETS = { top: 0, right: 0, bottom: 0, left: 0 };
2
+ export function normalizeInsets(input) {
3
+ if (input === undefined)
4
+ return { ...ZERO_INSETS };
5
+ if (typeof input === 'number') {
6
+ return { top: input, right: input, bottom: input, left: input };
7
+ }
8
+ return {
9
+ top: input.top ?? 0,
10
+ right: input.right ?? 0,
11
+ bottom: input.bottom ?? 0,
12
+ left: input.left ?? 0,
13
+ };
14
+ }
15
+ export function borderInsets(border) {
16
+ if (!border)
17
+ return { ...ZERO_INSETS };
18
+ if (border === true) {
19
+ return { top: 1, right: 1, bottom: 1, left: 1 };
20
+ }
21
+ return {
22
+ top: border.top === false ? 0 : 1,
23
+ right: border.right === false ? 0 : 1,
24
+ bottom: border.bottom === false ? 0 : 1,
25
+ left: border.left === false ? 0 : 1,
26
+ };
27
+ }
28
+ export function shrinkRect(rect, insets) {
29
+ const x = rect.x + insets.left;
30
+ const y = rect.y + insets.top;
31
+ const width = Math.max(0, rect.width - insets.left - insets.right);
32
+ const height = Math.max(0, rect.height - insets.top - insets.bottom);
33
+ return { x, y, width, height };
34
+ }
35
+ export function intersectRect(a, b) {
36
+ const x = Math.max(a.x, b.x);
37
+ const y = Math.max(a.y, b.y);
38
+ const right = Math.min(a.x + a.width, b.x + b.width);
39
+ const bottom = Math.min(a.y + a.height, b.y + b.height);
40
+ return {
41
+ x,
42
+ y,
43
+ width: Math.max(0, right - x),
44
+ height: Math.max(0, bottom - y),
45
+ };
46
+ }
47
+ export function containsPoint(rect, x, y) {
48
+ return x >= rect.x && x < rect.x + rect.width && y >= rect.y && y < rect.y + rect.height;
49
+ }
50
+ export function isEmptyRect(rect) {
51
+ return rect.width <= 0 || rect.height <= 0;
52
+ }
53
+ export function insetsForAxis(insets, axis) {
54
+ return axis === 'width' ? insets.left + insets.right : insets.top + insets.bottom;
55
+ }
@@ -0,0 +1,33 @@
1
+ export interface Rect {
2
+ readonly x: number;
3
+ readonly y: number;
4
+ readonly width: number;
5
+ readonly height: number;
6
+ }
7
+ export interface Insets {
8
+ readonly top: number;
9
+ readonly right: number;
10
+ readonly bottom: number;
11
+ readonly left: number;
12
+ }
13
+ export interface Size {
14
+ readonly width: number;
15
+ readonly height: number;
16
+ }
17
+ export type Color = `#${string}` | 'default' | 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'brightBlack' | 'brightRed' | 'brightGreen' | 'brightYellow' | 'brightBlue' | 'brightMagenta' | 'brightCyan' | 'brightWhite';
18
+ export interface BorderChars {
19
+ horizontal: string;
20
+ vertical: string;
21
+ topLeft: string;
22
+ topRight: string;
23
+ bottomLeft: string;
24
+ bottomRight: string;
25
+ }
26
+ export interface BorderStyle {
27
+ top?: boolean;
28
+ right?: boolean;
29
+ bottom?: boolean;
30
+ left?: boolean;
31
+ chars?: BorderChars;
32
+ }
33
+ export declare const DEFAULT_BORDER_CHARS: BorderChars;
@@ -0,0 +1,8 @@
1
+ export const DEFAULT_BORDER_CHARS = {
2
+ horizontal: '─',
3
+ vertical: '│',
4
+ topLeft: '┌',
5
+ topRight: '┐',
6
+ bottomLeft: '└',
7
+ bottomRight: '┘',
8
+ };
@@ -0,0 +1,18 @@
1
+ import type { InputEvent } from './events';
2
+ export interface TerminalInputParserOptions {
3
+ maxBufferBytes?: number;
4
+ maxPasteBytes?: number;
5
+ }
6
+ export declare class TerminalInputParser {
7
+ private readonly options;
8
+ private buffer;
9
+ private paste;
10
+ private inPaste;
11
+ private pasteOverflowed;
12
+ constructor(options?: TerminalInputParserOptions);
13
+ feed(data: string): InputEvent[];
14
+ flushPending(): InputEvent[];
15
+ hasPending(): boolean;
16
+ private get maxBufferBytes();
17
+ private get maxPasteBytes();
18
+ }