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