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,292 @@
1
+ // deno-lint-ignore no-control-regex
2
+ const ANSI_RE = /\u001B\[[0-?]*[ -/]*[@-~]|\u001B\][^\u0007]*(?:\u0007|\u001B\\)/g;
3
+ // deno-lint-ignore no-control-regex
4
+ const ANSI_TOKEN_RE = /\u001B\[[0-?]*[ -/]*[@-~]|\u001B\][^\u0007]*(?:\u0007|\u001B\\)/gy;
5
+ export function stripAnsi(s) {
6
+ return s.replace(ANSI_RE, '');
7
+ }
8
+ export function visibleWidth(s) {
9
+ const stripped = stripAnsi(s);
10
+ let w = 0;
11
+ for (let i = 0; i < stripped.length;) {
12
+ const code = stripped.codePointAt(i) ?? 0;
13
+ w += charWidth(code);
14
+ i += code > 0xffff ? 2 : 1;
15
+ }
16
+ return w;
17
+ }
18
+ export function charWidth(code) {
19
+ if (code === 0 || code < 0x20 || code === 0x7f)
20
+ return 0;
21
+ if ((code >= 0x1100 && code <= 0x115f) ||
22
+ (code >= 0x231a && code <= 0x231b) ||
23
+ (code >= 0x2329 && code <= 0x232a) ||
24
+ (code >= 0x23e9 && code <= 0x23f3) ||
25
+ (code >= 0x23f8 && code <= 0x23fa) ||
26
+ (code >= 0x25fd && code <= 0x25fe) ||
27
+ (code >= 0x2614 && code <= 0x2615) ||
28
+ (code >= 0x2648 && code <= 0x2653) ||
29
+ code === 0x267f ||
30
+ code === 0x2693 ||
31
+ code === 0x26a1 ||
32
+ (code >= 0x26aa && code <= 0x26ab) ||
33
+ (code >= 0x26bd && code <= 0x26be) ||
34
+ (code >= 0x26c4 && code <= 0x26c5) ||
35
+ code === 0x26ce ||
36
+ code === 0x26d4 ||
37
+ code === 0x26ea ||
38
+ (code >= 0x26f2 && code <= 0x26f3) ||
39
+ code === 0x26f5 ||
40
+ code === 0x26fa ||
41
+ code === 0x26fd ||
42
+ code === 0x2702 ||
43
+ code === 0x2705 ||
44
+ (code >= 0x2708 && code <= 0x270d) ||
45
+ code === 0x270f ||
46
+ code === 0x2712 ||
47
+ code === 0x2714 ||
48
+ code === 0x2716 ||
49
+ code === 0x271d ||
50
+ code === 0x2721 ||
51
+ code === 0x2728 ||
52
+ (code >= 0x2733 && code <= 0x2734) ||
53
+ code === 0x2744 ||
54
+ code === 0x2747 ||
55
+ code === 0x274c ||
56
+ code === 0x274e ||
57
+ (code >= 0x2753 && code <= 0x2755) ||
58
+ code === 0x2757 ||
59
+ (code >= 0x2795 && code <= 0x2797) ||
60
+ code === 0x27a1 ||
61
+ code === 0x27b0 ||
62
+ code === 0x27bf ||
63
+ (code >= 0x2934 && code <= 0x2935) ||
64
+ (code >= 0x2b05 && code <= 0x2b07) ||
65
+ (code >= 0x2b1b && code <= 0x2b1c) ||
66
+ code === 0x2b50 ||
67
+ code === 0x2b55 ||
68
+ (code >= 0x2e80 && code <= 0x303e) ||
69
+ (code >= 0x3041 && code <= 0x33ff) ||
70
+ (code >= 0x3400 && code <= 0x4dbf) ||
71
+ (code >= 0x4e00 && code <= 0x9fff) ||
72
+ (code >= 0xa000 && code <= 0xa4cf) ||
73
+ (code >= 0xac00 && code <= 0xd7a3) ||
74
+ (code >= 0xf900 && code <= 0xfaff) ||
75
+ (code >= 0xfe30 && code <= 0xfe4f) ||
76
+ (code >= 0xff00 && code <= 0xff60) ||
77
+ (code >= 0xffe0 && code <= 0xffe6) ||
78
+ (code >= 0x1f004 && code <= 0x1f004) ||
79
+ (code >= 0x1f0cf && code <= 0x1f0cf) ||
80
+ (code >= 0x1f170 && code <= 0x1f171) ||
81
+ code === 0x1f17e ||
82
+ code === 0x1f17f ||
83
+ code === 0x1f18e ||
84
+ (code >= 0x1f191 && code <= 0x1f19a) ||
85
+ (code >= 0x1f1e0 && code <= 0x1f1ff) ||
86
+ (code >= 0x1f200 && code <= 0x1f202) ||
87
+ code === 0x1f21a ||
88
+ code === 0x1f22f ||
89
+ (code >= 0x1f232 && code <= 0x1f23a) ||
90
+ (code >= 0x1f250 && code <= 0x1f251) ||
91
+ (code >= 0x1f300 && code <= 0x1f321) ||
92
+ (code >= 0x1f324 && code <= 0x1f393) ||
93
+ (code >= 0x1f396 && code <= 0x1f397) ||
94
+ (code >= 0x1f399 && code <= 0x1f39b) ||
95
+ (code >= 0x1f39e && code <= 0x1f3f0) ||
96
+ (code >= 0x1f3f3 && code <= 0x1f3f5) ||
97
+ (code >= 0x1f3f7 && code <= 0x1f4fd) ||
98
+ (code >= 0x1f4ff && code <= 0x1f53d) ||
99
+ (code >= 0x1f549 && code <= 0x1f54e) ||
100
+ (code >= 0x1f550 && code <= 0x1f567) ||
101
+ (code >= 0x1f56f && code <= 0x1f570) ||
102
+ (code >= 0x1f573 && code <= 0x1f57a) ||
103
+ code === 0x1f587 ||
104
+ (code >= 0x1f58a && code <= 0x1f58d) ||
105
+ code === 0x1f590 ||
106
+ (code >= 0x1f595 && code <= 0x1f596) ||
107
+ code === 0x1f5a4 ||
108
+ (code >= 0x1f5a5 && code <= 0x1f5a8) ||
109
+ (code >= 0x1f5b1 && code <= 0x1f5b2) ||
110
+ code === 0x1f5bc ||
111
+ (code >= 0x1f5c2 && code <= 0x1f5c4) ||
112
+ (code >= 0x1f5d1 && code <= 0x1f5d3) ||
113
+ (code >= 0x1f5dc && code <= 0x1f5de) ||
114
+ code === 0x1f5e1 ||
115
+ code === 0x1f5e3 ||
116
+ code === 0x1f5e8 ||
117
+ code === 0x1f5ef ||
118
+ code === 0x1f5f3 ||
119
+ (code >= 0x1f5fa && code <= 0x1f64f) ||
120
+ (code >= 0x1f680 && code <= 0x1f6c5) ||
121
+ (code >= 0x1f6cb && code <= 0x1f6d2) ||
122
+ (code >= 0x1f6d5 && code <= 0x1f6d7) ||
123
+ (code >= 0x1f6e0 && code <= 0x1f6e5) ||
124
+ code === 0x1f6e9 ||
125
+ (code >= 0x1f6eb && code <= 0x1f6ec) ||
126
+ code === 0x1f6f0 ||
127
+ (code >= 0x1f6f3 && code <= 0x1f6fc) ||
128
+ (code >= 0x1f7e0 && code <= 0x1f7eb) ||
129
+ (code >= 0x1f90c && code <= 0x1f93a) ||
130
+ (code >= 0x1f93c && code <= 0x1f945) ||
131
+ (code >= 0x1f947 && code <= 0x1f9ff) ||
132
+ (code >= 0x1fa00 && code <= 0x1fa53) ||
133
+ (code >= 0x1fa60 && code <= 0x1fa6d) ||
134
+ (code >= 0x1fa70 && code <= 0x1fa7c) ||
135
+ (code >= 0x1fa80 && code <= 0x1fa88) ||
136
+ (code >= 0x1fa90 && code <= 0x1fabd) ||
137
+ (code >= 0x1fabf && code <= 0x1fac5) ||
138
+ (code >= 0x1face && code <= 0x1fadb) ||
139
+ (code >= 0x1fae0 && code <= 0x1fae8) ||
140
+ (code >= 0x1faf0 && code <= 0x1faf8)) {
141
+ return 2;
142
+ }
143
+ return 1;
144
+ }
145
+ export function truncateToWidth(s, width, ellipsis = '\u2026') {
146
+ if (visibleWidth(s) <= width)
147
+ return s;
148
+ const ellipsisWidth = visibleWidth(ellipsis);
149
+ let result = '';
150
+ let currentWidth = 0;
151
+ const targetWidth = Math.max(0, width - ellipsisWidth);
152
+ for (const token of tokenizeAnsi(s)) {
153
+ if (token.ansi) {
154
+ result += token.value;
155
+ continue;
156
+ }
157
+ for (const ch of token.value) {
158
+ const code = ch.codePointAt(0) ?? 0;
159
+ const chWidth = charWidth(code);
160
+ if (currentWidth + chWidth > targetWidth) {
161
+ return result + ellipsis + extractTrailingAnsi(s);
162
+ }
163
+ result += ch;
164
+ currentWidth += chWidth;
165
+ }
166
+ }
167
+ return result + ellipsis + extractTrailingAnsi(s);
168
+ }
169
+ export function wrapText(text, width) {
170
+ if (width <= 0 || !text)
171
+ return [''];
172
+ const out = [];
173
+ for (const segment of text.split('\n')) {
174
+ const wrapped = wrapSegment(segment, width);
175
+ out.push(...wrapped);
176
+ }
177
+ return out.length === 0 ? [''] : out;
178
+ }
179
+ function pushLine(state) {
180
+ state.lines.push(state.current);
181
+ state.current = '';
182
+ state.col = 0;
183
+ }
184
+ function wrapSegment(segment, width) {
185
+ if (segment.length === 0)
186
+ return [''];
187
+ const tokens = segment.split(/(\s+)/);
188
+ const state = { lines: [], current: '', col: 0 };
189
+ for (const tok of tokens) {
190
+ if (tok.length === 0)
191
+ continue;
192
+ const w = visibleWidth(tok);
193
+ if (w === 0)
194
+ continue;
195
+ if (/^\s+$/.test(tok)) {
196
+ if (state.col === 0) {
197
+ state.current += tok;
198
+ state.col += w;
199
+ }
200
+ else if (state.col + w <= width) {
201
+ state.current += tok;
202
+ state.col += w;
203
+ }
204
+ else {
205
+ pushLine(state);
206
+ }
207
+ }
208
+ else if (w > width) {
209
+ if (state.col > 0)
210
+ pushLine(state);
211
+ let j = 0;
212
+ let buf = '';
213
+ let bufW = 0;
214
+ while (j < tok.length) {
215
+ const code = tok.codePointAt(j) ?? 0;
216
+ const chW = charWidth(code);
217
+ const chStr = code > 0xffff ? tok.slice(j, j + 2) : tok.slice(j, j + 1);
218
+ if (bufW + chW > width) {
219
+ state.lines.push(buf);
220
+ buf = chStr;
221
+ bufW = chW;
222
+ }
223
+ else {
224
+ buf += chStr;
225
+ bufW += chW;
226
+ }
227
+ j += code > 0xffff ? 2 : 1;
228
+ }
229
+ state.current = buf;
230
+ state.col = bufW;
231
+ }
232
+ else if (state.col + w > width) {
233
+ pushLine(state);
234
+ state.current = tok;
235
+ state.col = w;
236
+ }
237
+ else {
238
+ state.current += tok;
239
+ state.col += w;
240
+ }
241
+ }
242
+ state.lines.push(state.current);
243
+ return state.lines;
244
+ }
245
+ export function sliceByColumn(s, start, end, strict = false) {
246
+ let col = 0;
247
+ let result = '';
248
+ for (const token of tokenizeAnsi(s)) {
249
+ if (token.ansi) {
250
+ result += token.value;
251
+ continue;
252
+ }
253
+ for (const ch of token.value) {
254
+ const code = ch.codePointAt(0) ?? 0;
255
+ const chWidth = charWidth(code);
256
+ const nextCol = col + chWidth;
257
+ if (nextCol > start) {
258
+ if (col >= end)
259
+ return result + extractTrailingAnsi(s);
260
+ if (col >= start) {
261
+ if (!strict || nextCol <= end)
262
+ result += ch;
263
+ }
264
+ }
265
+ col = nextCol;
266
+ }
267
+ }
268
+ return result + extractTrailingAnsi(s);
269
+ }
270
+ function tokenizeAnsi(s) {
271
+ const tokens = [];
272
+ let index = 0;
273
+ while (index < s.length) {
274
+ ANSI_TOKEN_RE.lastIndex = index;
275
+ const match = ANSI_TOKEN_RE.exec(s);
276
+ if (match) {
277
+ tokens.push({ value: match[0], ansi: true });
278
+ index = ANSI_TOKEN_RE.lastIndex;
279
+ continue;
280
+ }
281
+ const nextEsc = s.indexOf('\x1b', index + 1);
282
+ const end = nextEsc === -1 ? s.length : nextEsc;
283
+ tokens.push({ value: s.slice(index, end), ansi: false });
284
+ index = end;
285
+ }
286
+ return tokens;
287
+ }
288
+ function extractTrailingAnsi(s) {
289
+ // deno-lint-ignore no-control-regex
290
+ const match = s.match(/(\u001B\[[0-?]*[ -/]*[@-~])$/);
291
+ return match ? match[1] : '';
292
+ }
@@ -0,0 +1,35 @@
1
+ import { type Color } from './layout/types';
2
+ import { type Component } from './surface';
3
+ export declare const text: (value: string) => Component;
4
+ export interface FlexItem {
5
+ readonly flex: number;
6
+ readonly component: Component;
7
+ }
8
+ export declare const flex: (component: Component, weight?: number) => FlexItem;
9
+ export declare const column: (children: (Component | FlexItem)[]) => Component;
10
+ export declare const row: (children: (Component | FlexItem)[]) => Component;
11
+ export interface BoxOptions {
12
+ border?: boolean;
13
+ background?: Color;
14
+ backgroundOpacity?: number;
15
+ padding?: number;
16
+ }
17
+ export declare const box: (child: Component, opts?: BoxOptions) => Component;
18
+ export interface OverlayOptions {
19
+ width?: number;
20
+ opacity?: number;
21
+ }
22
+ export declare const overlay: (background: Component, panel: Component, opts?: OverlayOptions) => Component;
23
+ export interface ModalOptions {
24
+ title?: string;
25
+ width?: number;
26
+ opacity?: number;
27
+ border?: boolean;
28
+ background?: Color;
29
+ }
30
+ export type ToastKind = 'info' | 'success' | 'error';
31
+ export interface ToastOptions {
32
+ kind?: ToastKind;
33
+ }
34
+ export declare const toast: (message: string, opts?: ToastOptions) => Component;
35
+ export declare const modal: (content: Component, opts?: ModalOptions) => Component;
@@ -0,0 +1,112 @@
1
+ import { DEFAULT_BORDER_CHARS } from './layout/types';
2
+ import { measureWidth } from './surface';
3
+ import { wrapText } from './utils';
4
+ export const text = (value) => ({
5
+ render: (s) => {
6
+ const lines = wrapText(value, s.width);
7
+ for (let i = 0; i < lines.length && i < s.height; i++)
8
+ s.text(0, i, lines[i]);
9
+ },
10
+ });
11
+ export const flex = (component, weight = 1) => ({ flex: weight, component });
12
+ const isFlex = (item) => 'flex' in item;
13
+ const distributeFlex = (children, sizes, remaining) => {
14
+ const totalFlex = children.reduce((sum, item) => (isFlex(item) ? sum + item.flex : sum), 0);
15
+ if (totalFlex === 0)
16
+ return;
17
+ const flexIndices = children.flatMap((item, i) => (isFlex(item) ? [i] : []));
18
+ let used = 0;
19
+ flexIndices.forEach((index, k) => {
20
+ const item = children[index];
21
+ const last = k === flexIndices.length - 1;
22
+ sizes[index] = Math.max(0, last ? remaining - used : Math.floor((remaining * item.flex) / totalFlex));
23
+ used += sizes[index];
24
+ });
25
+ };
26
+ export const column = (children) => ({
27
+ render: (s) => {
28
+ const sizes = children.map((item) => (isFlex(item) ? -1 : s.measure(item, s.width)));
29
+ const usedAuto = sizes.reduce((sum, h) => (h >= 0 ? sum + h : sum), 0);
30
+ distributeFlex(children, sizes, Math.max(0, s.height - usedAuto));
31
+ let y = 0;
32
+ for (let i = 0; i < children.length; i++) {
33
+ const item = children[i];
34
+ const component = isFlex(item) ? item.component : item;
35
+ if (sizes[i] > 0)
36
+ s.child(component, { x: 0, y, width: s.width, height: sizes[i] });
37
+ y += sizes[i];
38
+ }
39
+ },
40
+ });
41
+ export const row = (children) => ({
42
+ render: (s) => {
43
+ const sizes = children.map((item) => (isFlex(item) ? -1 : measureWidth(item, s.width)));
44
+ const usedAuto = sizes.reduce((sum, w) => (w >= 0 ? sum + w : sum), 0);
45
+ distributeFlex(children, sizes, Math.max(0, s.width - usedAuto));
46
+ let x = 0;
47
+ for (let i = 0; i < children.length; i++) {
48
+ const item = children[i];
49
+ const component = isFlex(item) ? item.component : item;
50
+ if (sizes[i] > 0)
51
+ s.child(component, { x, y: 0, width: sizes[i], height: s.height });
52
+ x += sizes[i];
53
+ }
54
+ },
55
+ });
56
+ const drawBorder = (s, height) => {
57
+ const w = s.width;
58
+ if (w < 2 || height < 2)
59
+ return;
60
+ const c = DEFAULT_BORDER_CHARS;
61
+ s.text(0, 0, c.topLeft + c.horizontal.repeat(w - 2) + c.topRight);
62
+ for (let y = 1; y < height - 1; y++) {
63
+ s.text(0, y, c.vertical);
64
+ s.text(w - 1, y, c.vertical);
65
+ }
66
+ s.text(0, height - 1, c.bottomLeft + c.horizontal.repeat(w - 2) + c.bottomRight);
67
+ };
68
+ export const box = (child, opts = {}) => ({
69
+ render: (s) => {
70
+ const inset = (opts.border ? 1 : 0) + (opts.padding ?? 0);
71
+ const innerW = Math.max(0, s.width - 2 * inset);
72
+ const contentH = s.measure(child, innerW);
73
+ const selfH = Math.min(contentH + 2 * inset, s.height);
74
+ if (opts.background) {
75
+ s.fill({ x: 0, y: 0, width: s.width, height: selfH }, opts.background, opts.backgroundOpacity);
76
+ }
77
+ if (opts.border)
78
+ drawBorder(s, selfH);
79
+ const innerH = Math.max(0, selfH - 2 * inset);
80
+ if (innerW > 0 && innerH > 0)
81
+ s.child(child, { x: inset, y: inset, width: innerW, height: innerH });
82
+ },
83
+ });
84
+ export const overlay = (background, panel, opts = {}) => ({
85
+ render: (s) => {
86
+ s.child(background, { x: 0, y: 0, width: s.width, height: s.height });
87
+ s.fill({ x: 0, y: 0, width: s.width, height: s.height }, '#000000', opts.opacity ?? 0.6);
88
+ const w = Math.min(opts.width ?? 60, s.width);
89
+ const h = Math.min(s.measure(panel, w), s.height);
90
+ const x = Math.max(0, Math.floor((s.width - w) / 2));
91
+ const y = Math.max(0, Math.floor((s.height - h) / 2));
92
+ s.child(panel, { x, y, width: w, height: h });
93
+ },
94
+ });
95
+ const TOAST_BACKGROUND = {
96
+ info: '#1e3a5f',
97
+ success: '#1e4620',
98
+ error: '#5f1e1e',
99
+ };
100
+ export const toast = (message, opts = {}) => box(text(message), { border: true, background: TOAST_BACKGROUND[opts.kind ?? 'info'], padding: 0 });
101
+ export const modal = (content, opts = {}) => ({
102
+ render: (s) => {
103
+ s.fill({ x: 0, y: 0, width: s.width, height: s.height }, '#000000', opts.opacity ?? 0.6);
104
+ const inner = opts.title ? column([text(opts.title), content]) : content;
105
+ const panel = box(inner, { border: opts.border ?? true, background: opts.background ?? '#1c1c1c' });
106
+ const w = Math.min(opts.width ?? 60, Math.max(0, s.width - 2));
107
+ const h = Math.min(s.measure(panel, w), Math.max(0, s.height - 2));
108
+ const x = Math.max(0, Math.floor((s.width - w) / 2));
109
+ const y = Math.max(0, Math.floor((s.height - h) / 2));
110
+ s.child(panel, { x, y, width: w, height: h });
111
+ },
112
+ });
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "mu-harness",
3
+ "version": "0.16.3",
4
+ "description": "Agent harness: createHarness wires mu-core into a host — XDG paths, model registry, plugins, disk-loaded agents & skills, sub-agents, sessions (JSONL + SQLite catalog), slash commands, permission/approval hooks, an optional scheduler, and a composable TUI chat app",
5
+ "license": "MIT",
6
+ "main": "./script/index.js",
7
+ "module": "./esm/index.js",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./esm/index.js",
11
+ "require": "./script/index.js"
12
+ }
13
+ },
14
+ "scripts": {},
15
+ "type": "module",
16
+ "dependencies": {
17
+ "@swc/wasm-typescript": "^1.15.0",
18
+ "croner": "^9.0.0",
19
+ "mu-core": "^0.16.3",
20
+ "mu-tui": "^0.16.3"
21
+ },
22
+ "_generatedBy": "dnt@dev"
23
+ }
@@ -0,0 +1,39 @@
1
+ import type { ContentPart, Message, Provider, Tool, Usage } from './types';
2
+ export type LoopEvent = ContentPart | {
3
+ type: 'usage';
4
+ usage: Usage;
5
+ } | {
6
+ type: 'reasoning';
7
+ text: string;
8
+ } | {
9
+ type: 'message';
10
+ message: Message;
11
+ } | {
12
+ type: 'done';
13
+ messages: Message[];
14
+ };
15
+ export interface RunOptions {
16
+ provider: Provider;
17
+ model: string;
18
+ messages: Message[];
19
+ tools?: Tool[];
20
+ signal?: AbortSignal;
21
+ }
22
+ export declare function run(opts: RunOptions): AsyncIterable<LoopEvent>;
23
+ export interface AgentConfig {
24
+ provider: Provider;
25
+ model: string;
26
+ tools?: Tool[];
27
+ system?: string;
28
+ signal?: AbortSignal;
29
+ }
30
+ export type Input = string | ContentPart[] | Message[];
31
+ export interface AgentResult {
32
+ message: Message;
33
+ messages: Message[];
34
+ }
35
+ export interface Agent {
36
+ stream(input: Input): AsyncIterable<LoopEvent>;
37
+ run(input: Input): Promise<AgentResult>;
38
+ }
39
+ export declare const createAgent: (config: AgentConfig) => Agent;
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createAgent = void 0;
4
+ exports.run = run;
5
+ const append = (parts, part) => {
6
+ const last = parts[parts.length - 1];
7
+ if (part.type === 'text' && last?.type === 'text') {
8
+ last.text += part.text;
9
+ }
10
+ else if (part.type === 'audio' && last?.type === 'audio' && last.mime === part.mime) {
11
+ const merged = new Uint8Array(last.data.length + part.data.length);
12
+ merged.set(last.data);
13
+ merged.set(part.data, last.data.length);
14
+ last.data = merged;
15
+ }
16
+ else if (part.type === 'text') {
17
+ parts.push({ type: 'text', text: part.text });
18
+ }
19
+ else if (part.type === 'audio') {
20
+ parts.push({ type: 'audio', mime: part.mime, data: part.data });
21
+ }
22
+ else {
23
+ parts.push(part);
24
+ }
25
+ };
26
+ const execute = async (tools, call, signal) => {
27
+ const tool = tools.get(call.name);
28
+ if (!tool)
29
+ return [{ type: 'text', text: `Unknown tool: ${call.name}` }];
30
+ try {
31
+ return await tool.run(call.input, { signal });
32
+ }
33
+ catch (err) {
34
+ return [{ type: 'text', text: err instanceof Error ? err.message : String(err) }];
35
+ }
36
+ };
37
+ async function* run(opts) {
38
+ const { provider, model, signal } = opts;
39
+ const tools = opts.tools ?? [];
40
+ const registry = new Map(tools.map((t) => [t.name, t]));
41
+ const messages = [...opts.messages];
42
+ while (true) {
43
+ const content = [];
44
+ const calls = [];
45
+ for await (const event of provider.stream({ model, messages, tools, signal })) {
46
+ if (event.type === 'usage' || event.type === 'reasoning') {
47
+ yield event;
48
+ continue;
49
+ }
50
+ yield event;
51
+ append(content, event);
52
+ if (event.type === 'tool_call')
53
+ calls.push(event);
54
+ }
55
+ const message = { role: 'assistant', content };
56
+ messages.push(message);
57
+ yield { type: 'message', message };
58
+ if (calls.length === 0)
59
+ break;
60
+ const results = await Promise.all(calls.map(async (call) => ({
61
+ type: 'tool_result',
62
+ id: call.id,
63
+ content: await execute(registry, call, signal),
64
+ })));
65
+ const toolMessage = { role: 'user', content: results };
66
+ messages.push(toolMessage);
67
+ yield { type: 'message', message: toolMessage };
68
+ }
69
+ yield { type: 'done', messages };
70
+ }
71
+ const isMessages = (input) => input.length > 0 && 'role' in input[0];
72
+ const toMessages = (input) => {
73
+ if (typeof input === 'string')
74
+ return [{ role: 'user', content: [{ type: 'text', text: input }] }];
75
+ if (isMessages(input))
76
+ return input;
77
+ return [{ role: 'user', content: input }];
78
+ };
79
+ const createAgent = (config) => {
80
+ const tools = config.tools ?? [];
81
+ const build = (input) => {
82
+ const messages = toMessages(input);
83
+ if (!config.system)
84
+ return messages;
85
+ return [{ role: 'system', content: [{ type: 'text', text: config.system }] }, ...messages];
86
+ };
87
+ const stream = (input) => run({ provider: config.provider, model: config.model, tools, messages: build(input), signal: config.signal });
88
+ const runToEnd = async (input) => {
89
+ let message = { role: 'assistant', content: [] };
90
+ let messages = [];
91
+ for await (const event of stream(input)) {
92
+ if (event.type === 'message' && event.message.role === 'assistant')
93
+ message = event.message;
94
+ else if (event.type === 'done')
95
+ messages = event.messages;
96
+ }
97
+ return { message, messages };
98
+ };
99
+ return { stream, run: runToEnd };
100
+ };
101
+ exports.createAgent = createAgent;
@@ -0,0 +1,4 @@
1
+ export type { ContentPart, Message, Provider, Role, StreamEvent, Tool, Usage } from './types';
2
+ export { audio, image, text } from './types';
3
+ export type { Agent, AgentConfig, AgentResult, Input, LoopEvent, RunOptions } from './agent';
4
+ export { createAgent, run } from './agent';
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.run = exports.createAgent = exports.text = exports.image = exports.audio = void 0;
4
+ var types_1 = require("./types");
5
+ Object.defineProperty(exports, "audio", { enumerable: true, get: function () { return types_1.audio; } });
6
+ Object.defineProperty(exports, "image", { enumerable: true, get: function () { return types_1.image; } });
7
+ Object.defineProperty(exports, "text", { enumerable: true, get: function () { return types_1.text; } });
8
+ var agent_1 = require("./agent");
9
+ Object.defineProperty(exports, "createAgent", { enumerable: true, get: function () { return agent_1.createAgent; } });
10
+ Object.defineProperty(exports, "run", { enumerable: true, get: function () { return agent_1.run; } });
@@ -0,0 +1,59 @@
1
+ export type ContentPart = {
2
+ type: 'text';
3
+ text: string;
4
+ } | {
5
+ type: 'image';
6
+ mime: string;
7
+ data: Uint8Array;
8
+ } | {
9
+ type: 'audio';
10
+ mime: string;
11
+ data: Uint8Array;
12
+ } | {
13
+ type: 'tool_call';
14
+ id: string;
15
+ name: string;
16
+ input: unknown;
17
+ } | {
18
+ type: 'tool_result';
19
+ id: string;
20
+ content: ContentPart[];
21
+ };
22
+ export type Role = 'system' | 'user' | 'assistant';
23
+ export type Message = {
24
+ role: Role;
25
+ content: ContentPart[];
26
+ };
27
+ export declare const text: (value: string) => ContentPart;
28
+ export declare const image: (mime: string, data: Uint8Array) => ContentPart;
29
+ export declare const audio: (mime: string, data: Uint8Array) => ContentPart;
30
+ export interface Tool {
31
+ name: string;
32
+ description: string;
33
+ parameters: Record<string, unknown>;
34
+ prompt?: string;
35
+ run(input: unknown, ctx: {
36
+ signal?: AbortSignal;
37
+ }): Promise<ContentPart[]>;
38
+ }
39
+ export interface Usage {
40
+ input?: number;
41
+ output?: number;
42
+ total?: number;
43
+ contextWindow?: number;
44
+ }
45
+ export type StreamEvent = ContentPart | {
46
+ type: 'usage';
47
+ usage: Usage;
48
+ } | {
49
+ type: 'reasoning';
50
+ text: string;
51
+ };
52
+ export interface Provider {
53
+ stream(req: {
54
+ model: string;
55
+ messages: Message[];
56
+ tools: Tool[];
57
+ signal?: AbortSignal;
58
+ }): AsyncIterable<StreamEvent>;
59
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.audio = exports.image = exports.text = void 0;
4
+ const text = (value) => ({ type: 'text', text: value });
5
+ exports.text = text;
6
+ const image = (mime, data) => ({ type: 'image', mime, data });
7
+ exports.image = image;
8
+ const audio = (mime, data) => ({ type: 'audio', mime, data });
9
+ exports.audio = audio;