terminal-pilot 0.0.30 → 0.0.32

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 (329) hide show
  1. package/dist/cli.js +1599 -497
  2. package/dist/cli.js.map +4 -4
  3. package/dist/commands/close-session.js +489 -6
  4. package/dist/commands/close-session.js.map +4 -4
  5. package/dist/commands/create-session.js +489 -6
  6. package/dist/commands/create-session.js.map +4 -4
  7. package/dist/commands/fill.js +489 -6
  8. package/dist/commands/fill.js.map +4 -4
  9. package/dist/commands/get-session.js +489 -6
  10. package/dist/commands/get-session.js.map +4 -4
  11. package/dist/commands/index.js +630 -44
  12. package/dist/commands/index.js.map +4 -4
  13. package/dist/commands/install.js +626 -40
  14. package/dist/commands/install.js.map +4 -4
  15. package/dist/commands/installer.js +68 -17
  16. package/dist/commands/installer.js.map +4 -4
  17. package/dist/commands/list-sessions.js +489 -6
  18. package/dist/commands/list-sessions.js.map +4 -4
  19. package/dist/commands/press-key.js +489 -6
  20. package/dist/commands/press-key.js.map +4 -4
  21. package/dist/commands/read-history.js +489 -6
  22. package/dist/commands/read-history.js.map +4 -4
  23. package/dist/commands/read-screen.js +489 -6
  24. package/dist/commands/read-screen.js.map +4 -4
  25. package/dist/commands/resize.js +489 -6
  26. package/dist/commands/resize.js.map +4 -4
  27. package/dist/commands/runtime.js.map +1 -1
  28. package/dist/commands/screenshot.js +489 -6
  29. package/dist/commands/screenshot.js.map +4 -4
  30. package/dist/commands/send-signal.js +489 -6
  31. package/dist/commands/send-signal.js.map +4 -4
  32. package/dist/commands/type.js +489 -6
  33. package/dist/commands/type.js.map +4 -4
  34. package/dist/commands/uninstall.js +554 -20
  35. package/dist/commands/uninstall.js.map +4 -4
  36. package/dist/commands/wait-for-exit.js +489 -6
  37. package/dist/commands/wait-for-exit.js.map +4 -4
  38. package/dist/commands/wait-for.js +489 -6
  39. package/dist/commands/wait-for.js.map +4 -4
  40. package/dist/testing/cli-repl.js +1599 -497
  41. package/dist/testing/cli-repl.js.map +4 -4
  42. package/dist/testing/qa-cli.js +1609 -507
  43. package/dist/testing/qa-cli.js.map +4 -4
  44. package/node_modules/@poe-code/agent-defs/README.md +35 -0
  45. package/node_modules/@poe-code/agent-defs/dist/agents/claude-code.d.ts +2 -0
  46. package/node_modules/@poe-code/agent-defs/dist/agents/claude-code.js +21 -0
  47. package/node_modules/@poe-code/agent-defs/dist/agents/claude-desktop.d.ts +2 -0
  48. package/node_modules/@poe-code/agent-defs/dist/agents/claude-desktop.js +18 -0
  49. package/node_modules/@poe-code/agent-defs/dist/agents/codex.d.ts +2 -0
  50. package/node_modules/@poe-code/agent-defs/dist/agents/codex.js +25 -0
  51. package/node_modules/@poe-code/agent-defs/dist/agents/cursor.d.ts +2 -0
  52. package/node_modules/@poe-code/agent-defs/dist/agents/cursor.js +15 -0
  53. package/node_modules/@poe-code/agent-defs/dist/agents/gemini-cli.d.ts +2 -0
  54. package/node_modules/@poe-code/agent-defs/dist/agents/gemini-cli.js +16 -0
  55. package/node_modules/@poe-code/agent-defs/dist/agents/goose.d.ts +2 -0
  56. package/node_modules/@poe-code/agent-defs/dist/agents/goose.js +16 -0
  57. package/node_modules/@poe-code/agent-defs/dist/agents/index.d.ts +9 -0
  58. package/node_modules/@poe-code/agent-defs/dist/agents/index.js +9 -0
  59. package/node_modules/@poe-code/agent-defs/dist/agents/kimi.d.ts +2 -0
  60. package/node_modules/@poe-code/agent-defs/dist/agents/kimi.js +16 -0
  61. package/node_modules/@poe-code/agent-defs/dist/agents/opencode.d.ts +2 -0
  62. package/node_modules/@poe-code/agent-defs/dist/agents/opencode.js +20 -0
  63. package/node_modules/@poe-code/agent-defs/dist/agents/poe-agent.d.ts +2 -0
  64. package/node_modules/@poe-code/agent-defs/dist/agents/poe-agent.js +14 -0
  65. package/node_modules/@poe-code/agent-defs/dist/index.d.ts +5 -0
  66. package/node_modules/@poe-code/agent-defs/dist/index.js +3 -0
  67. package/node_modules/@poe-code/agent-defs/dist/registry.d.ts +3 -0
  68. package/node_modules/@poe-code/agent-defs/dist/registry.js +45 -0
  69. package/node_modules/@poe-code/agent-defs/dist/specifier.d.ts +7 -0
  70. package/node_modules/@poe-code/agent-defs/dist/specifier.js +40 -0
  71. package/node_modules/@poe-code/agent-defs/dist/types.d.ts +28 -0
  72. package/node_modules/@poe-code/agent-defs/dist/types.js +1 -0
  73. package/node_modules/@poe-code/agent-defs/package.json +20 -0
  74. package/node_modules/@poe-code/agent-skill-config/dist/apply.js +2 -1
  75. package/node_modules/@poe-code/agent-skill-config/dist/bridge-active-skills.d.ts +1 -0
  76. package/node_modules/@poe-code/agent-skill-config/dist/bridge-active-skills.js +37 -18
  77. package/node_modules/@poe-code/agent-skill-config/dist/resolve-skill-reference.js +8 -4
  78. package/node_modules/@poe-code/agent-skill-config/package.json +1 -5
  79. package/node_modules/@poe-code/config-mutations/README.md +55 -0
  80. package/node_modules/@poe-code/config-mutations/dist/error-codes.d.ts +1 -0
  81. package/node_modules/@poe-code/config-mutations/dist/error-codes.js +6 -0
  82. package/node_modules/@poe-code/config-mutations/dist/execution/apply-mutation.d.ts +6 -0
  83. package/node_modules/@poe-code/config-mutations/dist/execution/apply-mutation.js +829 -0
  84. package/node_modules/@poe-code/config-mutations/dist/execution/path-utils.d.ts +17 -0
  85. package/node_modules/@poe-code/config-mutations/dist/execution/path-utils.js +64 -0
  86. package/node_modules/@poe-code/config-mutations/dist/execution/run-mutations.d.ts +7 -0
  87. package/node_modules/@poe-code/config-mutations/dist/execution/run-mutations.js +39 -0
  88. package/node_modules/@poe-code/config-mutations/dist/formats/index.d.ts +13 -0
  89. package/node_modules/@poe-code/config-mutations/dist/formats/index.js +49 -0
  90. package/node_modules/@poe-code/config-mutations/dist/formats/json.d.ts +32 -0
  91. package/node_modules/@poe-code/config-mutations/dist/formats/json.js +171 -0
  92. package/node_modules/@poe-code/config-mutations/dist/formats/object.d.ts +4 -0
  93. package/node_modules/@poe-code/config-mutations/dist/formats/object.js +27 -0
  94. package/node_modules/@poe-code/config-mutations/dist/formats/toml.d.ts +2 -0
  95. package/node_modules/@poe-code/config-mutations/dist/formats/toml.js +75 -0
  96. package/node_modules/@poe-code/config-mutations/dist/formats/yaml.d.ts +2 -0
  97. package/node_modules/@poe-code/config-mutations/dist/formats/yaml.js +76 -0
  98. package/node_modules/@poe-code/config-mutations/dist/fs-utils.d.ts +18 -0
  99. package/node_modules/@poe-code/config-mutations/dist/fs-utils.js +43 -0
  100. package/node_modules/@poe-code/config-mutations/dist/index.d.ts +8 -0
  101. package/node_modules/@poe-code/config-mutations/dist/index.js +8 -0
  102. package/node_modules/@poe-code/config-mutations/dist/mutations/config-mutation.d.ts +47 -0
  103. package/node_modules/@poe-code/config-mutations/dist/mutations/config-mutation.js +34 -0
  104. package/node_modules/@poe-code/config-mutations/dist/mutations/file-mutation.d.ts +62 -0
  105. package/node_modules/@poe-code/config-mutations/dist/mutations/file-mutation.js +55 -0
  106. package/node_modules/@poe-code/config-mutations/dist/mutations/template-mutation.d.ts +40 -0
  107. package/node_modules/@poe-code/config-mutations/dist/mutations/template-mutation.js +32 -0
  108. package/node_modules/@poe-code/config-mutations/dist/template/render.d.ts +6 -0
  109. package/node_modules/@poe-code/config-mutations/dist/template/render.js +8 -0
  110. package/node_modules/@poe-code/config-mutations/dist/testing/format-utils.d.ts +7 -0
  111. package/node_modules/@poe-code/config-mutations/dist/testing/format-utils.js +21 -0
  112. package/node_modules/@poe-code/config-mutations/dist/testing/index.d.ts +3 -0
  113. package/node_modules/@poe-code/config-mutations/dist/testing/index.js +2 -0
  114. package/node_modules/@poe-code/config-mutations/dist/testing/mock-fs.d.ts +25 -0
  115. package/node_modules/@poe-code/config-mutations/dist/testing/mock-fs.js +194 -0
  116. package/node_modules/@poe-code/config-mutations/dist/types.d.ts +168 -0
  117. package/node_modules/@poe-code/config-mutations/dist/types.js +6 -0
  118. package/node_modules/@poe-code/config-mutations/package.json +29 -0
  119. package/node_modules/@poe-code/frontmatter/README.md +35 -0
  120. package/node_modules/@poe-code/frontmatter/dist/fences.d.ts +25 -0
  121. package/node_modules/@poe-code/frontmatter/dist/fences.js +100 -0
  122. package/node_modules/@poe-code/frontmatter/dist/index.d.ts +3 -0
  123. package/node_modules/@poe-code/frontmatter/dist/index.js +3 -0
  124. package/node_modules/@poe-code/frontmatter/dist/parse.d.ts +20 -0
  125. package/node_modules/@poe-code/frontmatter/dist/parse.js +209 -0
  126. package/node_modules/@poe-code/frontmatter/dist/stringify.d.ts +1 -0
  127. package/node_modules/@poe-code/frontmatter/dist/stringify.js +48 -0
  128. package/node_modules/@poe-code/frontmatter/package.json +25 -0
  129. package/node_modules/toolcraft-design/README.md +160 -0
  130. package/node_modules/toolcraft-design/dist/acp/components.d.ts +12 -0
  131. package/node_modules/toolcraft-design/dist/acp/components.js +137 -0
  132. package/node_modules/toolcraft-design/dist/acp/index.d.ts +3 -0
  133. package/node_modules/toolcraft-design/dist/acp/index.js +2 -0
  134. package/node_modules/toolcraft-design/dist/acp/writer.d.ts +13 -0
  135. package/node_modules/toolcraft-design/dist/acp/writer.js +21 -0
  136. package/node_modules/toolcraft-design/dist/components/browser.d.ts +15 -0
  137. package/node_modules/toolcraft-design/dist/components/browser.js +31 -0
  138. package/node_modules/toolcraft-design/dist/components/catalog.d.ts +26 -0
  139. package/node_modules/toolcraft-design/dist/components/catalog.js +95 -0
  140. package/node_modules/toolcraft-design/dist/components/color.d.ts +31 -0
  141. package/node_modules/toolcraft-design/dist/components/color.js +102 -0
  142. package/node_modules/toolcraft-design/dist/components/command-errors.d.ts +16 -0
  143. package/node_modules/toolcraft-design/dist/components/command-errors.js +23 -0
  144. package/node_modules/toolcraft-design/dist/components/detail-card.d.ts +22 -0
  145. package/node_modules/toolcraft-design/dist/components/detail-card.js +45 -0
  146. package/node_modules/toolcraft-design/dist/components/help-formatter-plain.d.ts +5 -0
  147. package/node_modules/toolcraft-design/dist/components/help-formatter-plain.js +132 -0
  148. package/node_modules/toolcraft-design/dist/components/help-formatter.d.ts +33 -0
  149. package/node_modules/toolcraft-design/dist/components/help-formatter.js +213 -0
  150. package/node_modules/toolcraft-design/dist/components/index.d.ts +16 -0
  151. package/node_modules/toolcraft-design/dist/components/index.js +10 -0
  152. package/node_modules/toolcraft-design/dist/components/logger.d.ts +11 -0
  153. package/node_modules/toolcraft-design/dist/components/logger.js +60 -0
  154. package/node_modules/toolcraft-design/dist/components/symbols.d.ts +12 -0
  155. package/node_modules/toolcraft-design/dist/components/symbols.js +71 -0
  156. package/node_modules/toolcraft-design/dist/components/table.d.ts +15 -0
  157. package/node_modules/toolcraft-design/dist/components/table.js +302 -0
  158. package/node_modules/toolcraft-design/dist/components/template.d.ts +10 -0
  159. package/node_modules/toolcraft-design/dist/components/template.js +437 -0
  160. package/node_modules/toolcraft-design/dist/components/text.d.ts +16 -0
  161. package/node_modules/toolcraft-design/dist/components/text.js +145 -0
  162. package/node_modules/toolcraft-design/dist/dashboard/ansi.d.ts +18 -0
  163. package/node_modules/toolcraft-design/dist/dashboard/ansi.js +343 -0
  164. package/node_modules/toolcraft-design/dist/dashboard/buffer.d.ts +25 -0
  165. package/node_modules/toolcraft-design/dist/dashboard/buffer.js +219 -0
  166. package/node_modules/toolcraft-design/dist/dashboard/components/border.d.ts +9 -0
  167. package/node_modules/toolcraft-design/dist/dashboard/components/border.js +123 -0
  168. package/node_modules/toolcraft-design/dist/dashboard/components/footer.d.ts +8 -0
  169. package/node_modules/toolcraft-design/dist/dashboard/components/footer.js +56 -0
  170. package/node_modules/toolcraft-design/dist/dashboard/components/output-pane.d.ts +12 -0
  171. package/node_modules/toolcraft-design/dist/dashboard/components/output-pane.js +268 -0
  172. package/node_modules/toolcraft-design/dist/dashboard/components/stats-pane.d.ts +7 -0
  173. package/node_modules/toolcraft-design/dist/dashboard/components/stats-pane.js +107 -0
  174. package/node_modules/toolcraft-design/dist/dashboard/dashboard.d.ts +20 -0
  175. package/node_modules/toolcraft-design/dist/dashboard/dashboard.js +167 -0
  176. package/node_modules/toolcraft-design/dist/dashboard/demo.d.ts +13 -0
  177. package/node_modules/toolcraft-design/dist/dashboard/demo.js +145 -0
  178. package/node_modules/toolcraft-design/dist/dashboard/index.d.ts +8 -0
  179. package/node_modules/toolcraft-design/dist/dashboard/index.js +4 -0
  180. package/node_modules/toolcraft-design/dist/dashboard/keymap.d.ts +8 -0
  181. package/node_modules/toolcraft-design/dist/dashboard/keymap.js +233 -0
  182. package/node_modules/toolcraft-design/dist/dashboard/layout.d.ts +25 -0
  183. package/node_modules/toolcraft-design/dist/dashboard/layout.js +79 -0
  184. package/node_modules/toolcraft-design/dist/dashboard/should-use-dashboard.d.ts +10 -0
  185. package/node_modules/toolcraft-design/dist/dashboard/should-use-dashboard.js +7 -0
  186. package/node_modules/toolcraft-design/dist/dashboard/snapshot.d.ts +10 -0
  187. package/node_modules/toolcraft-design/dist/dashboard/snapshot.js +68 -0
  188. package/node_modules/toolcraft-design/dist/dashboard/store.d.ts +8 -0
  189. package/node_modules/toolcraft-design/dist/dashboard/store.js +51 -0
  190. package/node_modules/toolcraft-design/dist/dashboard/terminal-width.d.ts +4 -0
  191. package/node_modules/toolcraft-design/dist/dashboard/terminal-width.js +71 -0
  192. package/node_modules/toolcraft-design/dist/dashboard/terminal.d.ts +37 -0
  193. package/node_modules/toolcraft-design/dist/dashboard/terminal.js +264 -0
  194. package/node_modules/toolcraft-design/dist/dashboard/types.d.ts +38 -0
  195. package/node_modules/toolcraft-design/dist/dashboard/types.js +1 -0
  196. package/node_modules/toolcraft-design/dist/explorer/actions.d.ts +16 -0
  197. package/node_modules/toolcraft-design/dist/explorer/actions.js +39 -0
  198. package/node_modules/toolcraft-design/dist/explorer/demo.d.ts +13 -0
  199. package/node_modules/toolcraft-design/dist/explorer/demo.js +297 -0
  200. package/node_modules/toolcraft-design/dist/explorer/events.d.ts +67 -0
  201. package/node_modules/toolcraft-design/dist/explorer/events.js +1 -0
  202. package/node_modules/toolcraft-design/dist/explorer/filter.d.ts +10 -0
  203. package/node_modules/toolcraft-design/dist/explorer/filter.js +95 -0
  204. package/node_modules/toolcraft-design/dist/explorer/index.d.ts +8 -0
  205. package/node_modules/toolcraft-design/dist/explorer/index.js +8 -0
  206. package/node_modules/toolcraft-design/dist/explorer/jobs.d.ts +7 -0
  207. package/node_modules/toolcraft-design/dist/explorer/jobs.js +59 -0
  208. package/node_modules/toolcraft-design/dist/explorer/keymap.d.ts +21 -0
  209. package/node_modules/toolcraft-design/dist/explorer/keymap.js +376 -0
  210. package/node_modules/toolcraft-design/dist/explorer/layout.d.ts +20 -0
  211. package/node_modules/toolcraft-design/dist/explorer/layout.js +73 -0
  212. package/node_modules/toolcraft-design/dist/explorer/reducer.d.ts +9 -0
  213. package/node_modules/toolcraft-design/dist/explorer/reducer.js +782 -0
  214. package/node_modules/toolcraft-design/dist/explorer/render/detail.d.ts +4 -0
  215. package/node_modules/toolcraft-design/dist/explorer/render/detail.js +97 -0
  216. package/node_modules/toolcraft-design/dist/explorer/render/footer.d.ts +4 -0
  217. package/node_modules/toolcraft-design/dist/explorer/render/footer.js +73 -0
  218. package/node_modules/toolcraft-design/dist/explorer/render/header.d.ts +4 -0
  219. package/node_modules/toolcraft-design/dist/explorer/render/header.js +49 -0
  220. package/node_modules/toolcraft-design/dist/explorer/render/index.d.ts +8 -0
  221. package/node_modules/toolcraft-design/dist/explorer/render/index.js +53 -0
  222. package/node_modules/toolcraft-design/dist/explorer/render/list.d.ts +4 -0
  223. package/node_modules/toolcraft-design/dist/explorer/render/list.js +116 -0
  224. package/node_modules/toolcraft-design/dist/explorer/render/modal.d.ts +3 -0
  225. package/node_modules/toolcraft-design/dist/explorer/render/modal.js +87 -0
  226. package/node_modules/toolcraft-design/dist/explorer/render/test-fixtures.d.ts +8 -0
  227. package/node_modules/toolcraft-design/dist/explorer/render/test-fixtures.js +156 -0
  228. package/node_modules/toolcraft-design/dist/explorer/render/text.d.ts +12 -0
  229. package/node_modules/toolcraft-design/dist/explorer/render/text.js +81 -0
  230. package/node_modules/toolcraft-design/dist/explorer/runtime.d.ts +2 -0
  231. package/node_modules/toolcraft-design/dist/explorer/runtime.js +340 -0
  232. package/node_modules/toolcraft-design/dist/explorer/runtime.test-helpers.d.ts +50 -0
  233. package/node_modules/toolcraft-design/dist/explorer/runtime.test-helpers.js +101 -0
  234. package/node_modules/toolcraft-design/dist/explorer/state.d.ts +137 -0
  235. package/node_modules/toolcraft-design/dist/explorer/state.js +86 -0
  236. package/node_modules/toolcraft-design/dist/explorer/theme.d.ts +27 -0
  237. package/node_modules/toolcraft-design/dist/explorer/theme.js +29 -0
  238. package/node_modules/toolcraft-design/dist/index.d.ts +50 -0
  239. package/node_modules/toolcraft-design/dist/index.js +43 -0
  240. package/node_modules/toolcraft-design/dist/internal/color-support.d.ts +9 -0
  241. package/node_modules/toolcraft-design/dist/internal/color-support.js +12 -0
  242. package/node_modules/toolcraft-design/dist/internal/output-format.d.ts +6 -0
  243. package/node_modules/toolcraft-design/dist/internal/output-format.js +22 -0
  244. package/node_modules/toolcraft-design/dist/internal/strip-ansi.d.ts +1 -0
  245. package/node_modules/toolcraft-design/dist/internal/strip-ansi.js +50 -0
  246. package/node_modules/toolcraft-design/dist/internal/theme-detect.d.ts +12 -0
  247. package/node_modules/toolcraft-design/dist/internal/theme-detect.js +71 -0
  248. package/node_modules/toolcraft-design/dist/internal/theme-state.d.ts +12 -0
  249. package/node_modules/toolcraft-design/dist/internal/theme-state.js +35 -0
  250. package/node_modules/toolcraft-design/dist/prompts/index.d.ts +91 -0
  251. package/node_modules/toolcraft-design/dist/prompts/index.js +137 -0
  252. package/node_modules/toolcraft-design/dist/prompts/interactive/cancel-symbol.d.ts +2 -0
  253. package/node_modules/toolcraft-design/dist/prompts/interactive/cancel-symbol.js +4 -0
  254. package/node_modules/toolcraft-design/dist/prompts/interactive/confirm.d.ts +9 -0
  255. package/node_modules/toolcraft-design/dist/prompts/interactive/confirm.js +47 -0
  256. package/node_modules/toolcraft-design/dist/prompts/interactive/core.d.ts +55 -0
  257. package/node_modules/toolcraft-design/dist/prompts/interactive/core.js +274 -0
  258. package/node_modules/toolcraft-design/dist/prompts/interactive/glyphs.d.ts +20 -0
  259. package/node_modules/toolcraft-design/dist/prompts/interactive/glyphs.js +53 -0
  260. package/node_modules/toolcraft-design/dist/prompts/interactive/index.d.ts +6 -0
  261. package/node_modules/toolcraft-design/dist/prompts/interactive/index.js +6 -0
  262. package/node_modules/toolcraft-design/dist/prompts/interactive/keys.d.ts +2 -0
  263. package/node_modules/toolcraft-design/dist/prompts/interactive/keys.js +28 -0
  264. package/node_modules/toolcraft-design/dist/prompts/interactive/multiselect.d.ts +13 -0
  265. package/node_modules/toolcraft-design/dist/prompts/interactive/multiselect.js +131 -0
  266. package/node_modules/toolcraft-design/dist/prompts/interactive/pagination.d.ts +10 -0
  267. package/node_modules/toolcraft-design/dist/prompts/interactive/pagination.js +52 -0
  268. package/node_modules/toolcraft-design/dist/prompts/interactive/password.d.ts +10 -0
  269. package/node_modules/toolcraft-design/dist/prompts/interactive/password.js +55 -0
  270. package/node_modules/toolcraft-design/dist/prompts/interactive/select.d.ts +18 -0
  271. package/node_modules/toolcraft-design/dist/prompts/interactive/select.js +89 -0
  272. package/node_modules/toolcraft-design/dist/prompts/interactive/test-helpers.d.ts +21 -0
  273. package/node_modules/toolcraft-design/dist/prompts/interactive/test-helpers.js +32 -0
  274. package/node_modules/toolcraft-design/dist/prompts/interactive/text.d.ts +12 -0
  275. package/node_modules/toolcraft-design/dist/prompts/interactive/text.js +60 -0
  276. package/node_modules/toolcraft-design/dist/prompts/interactive/wrap.d.ts +4 -0
  277. package/node_modules/toolcraft-design/dist/prompts/interactive/wrap.js +18 -0
  278. package/node_modules/toolcraft-design/dist/prompts/primitives/cancel.d.ts +2 -0
  279. package/node_modules/toolcraft-design/dist/prompts/primitives/cancel.js +9 -0
  280. package/node_modules/toolcraft-design/dist/prompts/primitives/intro.d.ts +1 -0
  281. package/node_modules/toolcraft-design/dist/prompts/primitives/intro.js +16 -0
  282. package/node_modules/toolcraft-design/dist/prompts/primitives/log.d.ts +18 -0
  283. package/node_modules/toolcraft-design/dist/prompts/primitives/log.js +104 -0
  284. package/node_modules/toolcraft-design/dist/prompts/primitives/note.d.ts +1 -0
  285. package/node_modules/toolcraft-design/dist/prompts/primitives/note.js +39 -0
  286. package/node_modules/toolcraft-design/dist/prompts/primitives/outro.d.ts +1 -0
  287. package/node_modules/toolcraft-design/dist/prompts/primitives/outro.js +16 -0
  288. package/node_modules/toolcraft-design/dist/prompts/primitives/spinner.d.ts +6 -0
  289. package/node_modules/toolcraft-design/dist/prompts/primitives/spinner.js +74 -0
  290. package/node_modules/toolcraft-design/dist/prompts/theme.d.ts +11 -0
  291. package/node_modules/toolcraft-design/dist/prompts/theme.js +15 -0
  292. package/node_modules/toolcraft-design/dist/static/index.d.ts +4 -0
  293. package/node_modules/toolcraft-design/dist/static/index.js +2 -0
  294. package/node_modules/toolcraft-design/dist/static/menu.d.ts +11 -0
  295. package/node_modules/toolcraft-design/dist/static/menu.js +42 -0
  296. package/node_modules/toolcraft-design/dist/static/spinner.d.ts +14 -0
  297. package/node_modules/toolcraft-design/dist/static/spinner.js +52 -0
  298. package/node_modules/toolcraft-design/dist/terminal-markdown/ast.d.ts +92 -0
  299. package/node_modules/toolcraft-design/dist/terminal-markdown/ast.js +1 -0
  300. package/node_modules/toolcraft-design/dist/terminal-markdown/demo-content.d.ts +2 -0
  301. package/node_modules/toolcraft-design/dist/terminal-markdown/demo-content.js +139 -0
  302. package/node_modules/toolcraft-design/dist/terminal-markdown/index.d.ts +6 -0
  303. package/node_modules/toolcraft-design/dist/terminal-markdown/index.js +8 -0
  304. package/node_modules/toolcraft-design/dist/terminal-markdown/parser/block.d.ts +7 -0
  305. package/node_modules/toolcraft-design/dist/terminal-markdown/parser/block.js +1495 -0
  306. package/node_modules/toolcraft-design/dist/terminal-markdown/parser/frontmatter.d.ts +8 -0
  307. package/node_modules/toolcraft-design/dist/terminal-markdown/parser/frontmatter.js +36 -0
  308. package/node_modules/toolcraft-design/dist/terminal-markdown/parser/inline.d.ts +10 -0
  309. package/node_modules/toolcraft-design/dist/terminal-markdown/parser/inline.js +1190 -0
  310. package/node_modules/toolcraft-design/dist/terminal-markdown/parser.d.ts +5 -0
  311. package/node_modules/toolcraft-design/dist/terminal-markdown/parser.js +42 -0
  312. package/node_modules/toolcraft-design/dist/terminal-markdown/renderer.d.ts +6 -0
  313. package/node_modules/toolcraft-design/dist/terminal-markdown/renderer.js +615 -0
  314. package/node_modules/toolcraft-design/dist/terminal-markdown/testing/theme-render-fixture.d.ts +1 -0
  315. package/node_modules/toolcraft-design/dist/terminal-markdown/testing/theme-render-fixture.js +27 -0
  316. package/node_modules/toolcraft-design/dist/tokens/brand.d.ts +5 -0
  317. package/node_modules/toolcraft-design/dist/tokens/brand.js +5 -0
  318. package/node_modules/toolcraft-design/dist/tokens/colors.d.ts +37 -0
  319. package/node_modules/toolcraft-design/dist/tokens/colors.js +85 -0
  320. package/node_modules/toolcraft-design/dist/tokens/index.d.ts +6 -0
  321. package/node_modules/toolcraft-design/dist/tokens/index.js +5 -0
  322. package/node_modules/toolcraft-design/dist/tokens/spacing.d.ts +6 -0
  323. package/node_modules/toolcraft-design/dist/tokens/spacing.js +6 -0
  324. package/node_modules/toolcraft-design/dist/tokens/typography.d.ts +7 -0
  325. package/node_modules/toolcraft-design/dist/tokens/typography.js +8 -0
  326. package/node_modules/toolcraft-design/dist/tokens/widths.d.ts +5 -0
  327. package/node_modules/toolcraft-design/dist/tokens/widths.js +5 -0
  328. package/node_modules/toolcraft-design/package.json +44 -0
  329. package/package.json +15 -5
@@ -0,0 +1,167 @@
1
+ import { createLogger } from "../components/logger.js";
2
+ import { resolveOutputFormat } from "../internal/output-format.js";
3
+ import { ScreenBuffer, diff } from "./buffer.js";
4
+ import { renderBorder } from "./components/border.js";
5
+ import { defaultHints, renderFooter } from "./components/footer.js";
6
+ import { renderOutputPane } from "./components/output-pane.js";
7
+ import { renderStatsPane } from "./components/stats-pane.js";
8
+ import { createKeymap } from "./keymap.js";
9
+ import { computeDashboardLayout } from "./layout.js";
10
+ import { createStore } from "./store.js";
11
+ import { createTerminalDriver } from "./terminal.js";
12
+ const DEFAULT_TITLE = "Output";
13
+ const DEFAULT_STATS_TITLE = "Stats";
14
+ const DEFAULT_RIGHT_PANE_WIDTH = 25;
15
+ export function createDashboard(opts = {}) {
16
+ const stdin = opts.stdin ?? process.stdin;
17
+ const stdout = opts.stdout ?? process.stdout;
18
+ const resolveCommand = createKeymap(opts.keymap);
19
+ const footerHints = opts.hints ?? defaultHints();
20
+ const title = opts.title ?? DEFAULT_TITLE;
21
+ const statsTitle = opts.statsTitle ?? DEFAULT_STATS_TITLE;
22
+ const rightPaneWidth = opts.rightPaneWidth ?? DEFAULT_RIGHT_PANE_WIDTH;
23
+ const commandHandlers = new Set();
24
+ const fallbackLogger = createLogger((message) => {
25
+ stdout.write(`${message}\n`);
26
+ });
27
+ let driver;
28
+ let store;
29
+ let previousBuffer = new ScreenBuffer(0, 0);
30
+ let unsubscribeStore;
31
+ let unsubscribeKeypress;
32
+ let unsubscribeResize;
33
+ let started = false;
34
+ let destroyed = false;
35
+ function appendOutput(item) {
36
+ if (destroyed) {
37
+ return;
38
+ }
39
+ if (!isTerminalMode()) {
40
+ writeFallbackOutput(item);
41
+ return;
42
+ }
43
+ getStore().appendOutput(item);
44
+ }
45
+ function updateStats(stats) {
46
+ if (destroyed || !isTerminalMode()) {
47
+ return;
48
+ }
49
+ getStore().updateStats(stats);
50
+ }
51
+ function start() {
52
+ if (destroyed || started || !isTerminalMode()) {
53
+ return;
54
+ }
55
+ driver = createTerminalDriver({ stdin, stdout });
56
+ started = true;
57
+ previousBuffer = new ScreenBuffer(0, 0);
58
+ driver.enterRawMode();
59
+ driver.enterAltScreen();
60
+ driver.disableLineWrap();
61
+ driver.hideCursor();
62
+ render();
63
+ const activeStore = getStore();
64
+ unsubscribeStore = activeStore.onChange(() => {
65
+ render();
66
+ });
67
+ unsubscribeKeypress = driver.onKeypress((event) => {
68
+ const command = resolveCommand(event);
69
+ if (command === undefined) {
70
+ return;
71
+ }
72
+ emitCommand(command);
73
+ });
74
+ unsubscribeResize = driver.onResize(() => {
75
+ render();
76
+ });
77
+ }
78
+ function stop() {
79
+ unsubscribeStore?.();
80
+ unsubscribeKeypress?.();
81
+ unsubscribeResize?.();
82
+ unsubscribeStore = undefined;
83
+ unsubscribeKeypress = undefined;
84
+ unsubscribeResize = undefined;
85
+ if (driver === undefined) {
86
+ started = false;
87
+ return;
88
+ }
89
+ driver.destroy();
90
+ driver = undefined;
91
+ previousBuffer = new ScreenBuffer(0, 0);
92
+ started = false;
93
+ }
94
+ function onCommand(handler) {
95
+ if (destroyed) {
96
+ return;
97
+ }
98
+ commandHandlers.add(handler);
99
+ }
100
+ function destroy() {
101
+ if (destroyed) {
102
+ return;
103
+ }
104
+ stop();
105
+ commandHandlers.clear();
106
+ store = undefined;
107
+ destroyed = true;
108
+ }
109
+ function getStore() {
110
+ store ??= createStore();
111
+ return store;
112
+ }
113
+ function render() {
114
+ if (driver === undefined) {
115
+ return;
116
+ }
117
+ const { cols, rows } = driver.getSize();
118
+ const layout = computeDashboardLayout({
119
+ totalWidth: cols,
120
+ totalHeight: rows,
121
+ rightPaneWidth
122
+ });
123
+ const nextBuffer = new ScreenBuffer(cols, rows);
124
+ const state = getStore().getState();
125
+ renderBorder(nextBuffer, layout, {
126
+ leftTitle: title,
127
+ rightTitle: statsTitle,
128
+ style: { dim: true }
129
+ });
130
+ renderOutputPane(nextBuffer, layout.leftPane, state.output);
131
+ renderStatsPane(nextBuffer, layout.rightPane, state.stats);
132
+ renderFooter(nextBuffer, layout.footer, footerHints);
133
+ driver.flush(diff(previousBuffer, nextBuffer));
134
+ previousBuffer = nextBuffer;
135
+ }
136
+ function emitCommand(command) {
137
+ for (const handler of commandHandlers) {
138
+ handler(command);
139
+ }
140
+ }
141
+ function writeFallbackOutput(item) {
142
+ if (item.kind === "success") {
143
+ fallbackLogger.success(item.text);
144
+ return;
145
+ }
146
+ if (item.kind === "error") {
147
+ fallbackLogger.error(item.text);
148
+ return;
149
+ }
150
+ if (item.kind === "tool") {
151
+ fallbackLogger.message(item.text);
152
+ return;
153
+ }
154
+ fallbackLogger.info(item.text);
155
+ }
156
+ return {
157
+ start,
158
+ stop,
159
+ appendOutput,
160
+ updateStats,
161
+ onCommand,
162
+ destroy
163
+ };
164
+ }
165
+ function isTerminalMode() {
166
+ return resolveOutputFormat() === "terminal";
167
+ }
@@ -0,0 +1,13 @@
1
+ import type { Dashboard } from "./dashboard.js";
2
+ type DemoDashboard = Pick<Dashboard, "appendOutput" | "updateStats">;
3
+ type DemoRuntime = {
4
+ setInterval: typeof globalThis.setInterval;
5
+ clearInterval: typeof globalThis.clearInterval;
6
+ setTimeout: typeof globalThis.setTimeout;
7
+ clearTimeout: typeof globalThis.clearTimeout;
8
+ now: () => number;
9
+ random: () => number;
10
+ };
11
+ export declare function startDashboardDemo(dashboard: DemoDashboard, runtime?: Partial<DemoRuntime>): () => void;
12
+ export declare function main(): Promise<void>;
13
+ export {};
@@ -0,0 +1,145 @@
1
+ import path from "node:path";
2
+ import process from "node:process";
3
+ import { fileURLToPath } from "node:url";
4
+ import { createDashboard } from "./dashboard.js";
5
+ const OUTPUT_INTERVAL_MS = 500;
6
+ const STATS_INTERVAL_MS = 1_000;
7
+ const DEMO_DURATION_MS = 30_000;
8
+ const TOKENS_IN_PER_ITERATION = 137;
9
+ const TOKENS_OUT_PER_ITERATION = 89;
10
+ const OUTPUT_KINDS = ["info", "success", "error", "tool", "status"];
11
+ const OUTPUT_MESSAGES = {
12
+ info: [
13
+ "Analyzing repository state",
14
+ "Inspecting agent configuration",
15
+ "Collecting recent command output"
16
+ ],
17
+ success: [
18
+ "Generated provider config",
19
+ "Updated dashboard layout",
20
+ "Saved session checkpoint"
21
+ ],
22
+ error: [
23
+ "Retrying transient network request",
24
+ "Tool execution returned a non-zero exit code",
25
+ "Encountered a recoverable validation error"
26
+ ],
27
+ tool: [
28
+ "Running npm test -- --runInBand",
29
+ "Executing npm run lint:types",
30
+ "Opening task plan documentation"
31
+ ],
32
+ status: [
33
+ "Waiting for follow-up task",
34
+ "Streaming model response",
35
+ "Syncing derived metrics"
36
+ ]
37
+ };
38
+ const RUNNING_ACTIONS = [
39
+ "Planning next step",
40
+ "Executing tool call",
41
+ "Reviewing tool results",
42
+ "Updating working memory",
43
+ "Preparing final response"
44
+ ];
45
+ const INITIAL_ACTION = "Connecting to provider";
46
+ const COMPLETED_ACTION = "Completed";
47
+ export function startDashboardDemo(dashboard, runtime = {}) {
48
+ const setIntervalFn = runtime.setInterval ?? globalThis.setInterval.bind(globalThis);
49
+ const clearIntervalFn = runtime.clearInterval ?? globalThis.clearInterval.bind(globalThis);
50
+ const setTimeoutFn = runtime.setTimeout ?? globalThis.setTimeout.bind(globalThis);
51
+ const clearTimeoutFn = runtime.clearTimeout ?? globalThis.clearTimeout.bind(globalThis);
52
+ const now = runtime.now ?? Date.now;
53
+ const random = runtime.random ?? Math.random;
54
+ let outputCount = 0;
55
+ let iterations = 0;
56
+ let cleanedUp = false;
57
+ dashboard.updateStats({
58
+ status: "running",
59
+ currentAction: INITIAL_ACTION
60
+ });
61
+ const outputTimer = setIntervalFn(() => {
62
+ const kind = OUTPUT_KINDS[outputCount % OUTPUT_KINDS.length] ?? "info";
63
+ dashboard.appendOutput({
64
+ kind,
65
+ text: pickOutputMessage(kind, random),
66
+ ts: now()
67
+ });
68
+ outputCount += 1;
69
+ }, OUTPUT_INTERVAL_MS);
70
+ const statsTimer = setIntervalFn(() => {
71
+ iterations += 1;
72
+ dashboard.updateStats({
73
+ status: "running",
74
+ iterations,
75
+ tokensIn: iterations * TOKENS_IN_PER_ITERATION,
76
+ tokensOut: iterations * TOKENS_OUT_PER_ITERATION,
77
+ elapsedMs: iterations * STATS_INTERVAL_MS,
78
+ currentAction: RUNNING_ACTIONS[(iterations - 1) % RUNNING_ACTIONS.length] ?? INITIAL_ACTION
79
+ });
80
+ }, STATS_INTERVAL_MS);
81
+ const finishTimeout = setTimeoutFn(() => {
82
+ cleanup();
83
+ dashboard.updateStats({
84
+ status: "done",
85
+ iterations,
86
+ tokensIn: iterations * TOKENS_IN_PER_ITERATION,
87
+ tokensOut: iterations * TOKENS_OUT_PER_ITERATION,
88
+ elapsedMs: DEMO_DURATION_MS,
89
+ currentAction: COMPLETED_ACTION
90
+ });
91
+ }, DEMO_DURATION_MS);
92
+ function cleanup() {
93
+ if (cleanedUp) {
94
+ return;
95
+ }
96
+ cleanedUp = true;
97
+ clearTimeoutFn(finishTimeout);
98
+ clearIntervalFn(outputTimer);
99
+ clearIntervalFn(statsTimer);
100
+ }
101
+ return cleanup;
102
+ }
103
+ function pickOutputMessage(kind, random) {
104
+ const options = OUTPUT_MESSAGES[kind];
105
+ const cappedRandom = Math.max(0, Math.min(0.999_999, random()));
106
+ const index = Math.floor(cappedRandom * options.length);
107
+ return options[index] ?? options[0] ?? kind;
108
+ }
109
+ export async function main() {
110
+ const dashboard = createDashboard({ title: "Agent Output", statsTitle: "Stats" });
111
+ const stopDemo = startDashboardDemo(dashboard);
112
+ let shutDown = false;
113
+ const shutdown = (exitCode) => {
114
+ if (shutDown) {
115
+ return;
116
+ }
117
+ shutDown = true;
118
+ stopDemo();
119
+ dashboard.destroy();
120
+ if (exitCode !== undefined) {
121
+ process.exit(exitCode);
122
+ }
123
+ };
124
+ dashboard.onCommand((command) => {
125
+ if (command === "quit") {
126
+ shutdown(0);
127
+ }
128
+ });
129
+ process.once("SIGINT", () => {
130
+ shutdown(0);
131
+ });
132
+ process.once("SIGTERM", () => {
133
+ shutdown(0);
134
+ });
135
+ dashboard.start();
136
+ }
137
+ const entry = process.argv[1];
138
+ const isMain = typeof entry === "string" && path.resolve(entry) === fileURLToPath(import.meta.url);
139
+ if (isMain) {
140
+ main().catch((error) => {
141
+ const message = error instanceof Error ? error.message : String(error);
142
+ process.stderr.write(`${message}\n`);
143
+ process.exitCode = 1;
144
+ });
145
+ }
@@ -0,0 +1,8 @@
1
+ export { createDashboard } from "./dashboard.js";
2
+ export { shouldUseInteractiveDashboard } from "./should-use-dashboard.js";
3
+ export type { Dashboard, DashboardOptions } from "./dashboard.js";
4
+ export { renderDashboardSnapshot } from "./snapshot.js";
5
+ export type { SnapshotOptions } from "./snapshot.js";
6
+ export type { OutputItem, OutputItemKind, DashboardStats, Command, DashboardState } from "./types.js";
7
+ export { defaultHints } from "./components/footer.js";
8
+ export type { FooterHint } from "./components/footer.js";
@@ -0,0 +1,4 @@
1
+ export { createDashboard } from "./dashboard.js";
2
+ export { shouldUseInteractiveDashboard } from "./should-use-dashboard.js";
3
+ export { renderDashboardSnapshot } from "./snapshot.js";
4
+ export { defaultHints } from "./components/footer.js";
@@ -0,0 +1,8 @@
1
+ import type { KeypressEvent } from "./terminal.js";
2
+ import type { Command } from "./types.js";
3
+ export declare function createKeymap(overrides?: Partial<Record<Command, string[]>>): (event: KeypressEvent) => Command | undefined;
4
+ export declare function createKeymap<TCommand extends string>(overrides: Partial<Record<TCommand, string[]>> | undefined, options: {
5
+ commands: readonly TCommand[];
6
+ defaultBindings: Record<TCommand, readonly string[]>;
7
+ }): (event: KeypressEvent) => TCommand | undefined;
8
+ export declare function canonicalizeBinding(binding: string): string | undefined;
@@ -0,0 +1,233 @@
1
+ const commands = ["forceQuit", "quit", "edit", "pause", "retry", "view-log"];
2
+ const defaultBindings = {
3
+ forceQuit: ["Ctrl+C"],
4
+ quit: ["q"],
5
+ edit: ["e"],
6
+ pause: ["p"],
7
+ retry: ["r"],
8
+ "view-log": ["l"]
9
+ };
10
+ export function createKeymap(overrides, options) {
11
+ const resolvedCommands = options?.commands ?? commands;
12
+ const resolvedDefaults = options?.defaultBindings ?? defaultBindings;
13
+ const bindings = new Map();
14
+ const sequences = new Set();
15
+ let pendingSequence = "";
16
+ for (const command of resolvedCommands) {
17
+ const keys = overrides?.[command] ?? resolvedDefaults[command];
18
+ const commandBindings = keys
19
+ .map(parseBinding)
20
+ .filter((binding) => binding !== undefined);
21
+ for (const binding of commandBindings) {
22
+ if (binding.sequence !== undefined) {
23
+ sequences.add(binding.sequence);
24
+ }
25
+ }
26
+ bindings.set(command, commandBindings);
27
+ }
28
+ return (event) => {
29
+ for (const command of resolvedCommands) {
30
+ const commandBindings = bindings.get(command);
31
+ if (commandBindings?.some((binding) => matchesSingleKey(binding, event))) {
32
+ pendingSequence = "";
33
+ return command;
34
+ }
35
+ }
36
+ const sequenceCommand = resolveSequence(event);
37
+ if (sequenceCommand !== undefined) {
38
+ return sequenceCommand;
39
+ }
40
+ return undefined;
41
+ };
42
+ function resolveSequence(event) {
43
+ const token = eventToSequenceToken(event);
44
+ if (token === undefined) {
45
+ pendingSequence = "";
46
+ return undefined;
47
+ }
48
+ pendingSequence = `${pendingSequence}${token}`;
49
+ for (const command of resolvedCommands) {
50
+ const commandBindings = bindings.get(command);
51
+ if (commandBindings?.some((binding) => binding.sequence === pendingSequence)) {
52
+ pendingSequence = "";
53
+ return command;
54
+ }
55
+ }
56
+ if (hasSequencePrefix(sequences, pendingSequence)) {
57
+ return undefined;
58
+ }
59
+ pendingSequence = token;
60
+ if (hasSequencePrefix(sequences, pendingSequence)) {
61
+ return undefined;
62
+ }
63
+ pendingSequence = "";
64
+ return undefined;
65
+ }
66
+ }
67
+ export function canonicalizeBinding(binding) {
68
+ const parsed = parseBinding(binding);
69
+ if (parsed === undefined) {
70
+ return undefined;
71
+ }
72
+ const modifiers = [
73
+ parsed.ctrl ? "ctrl" : undefined,
74
+ parsed.meta ? "meta" : undefined,
75
+ parsed.shift ? "shift" : undefined
76
+ ].filter((modifier) => modifier !== undefined);
77
+ const key = parsed.name ?? parsed.ch;
78
+ if (parsed.sequence !== undefined) {
79
+ return parsed.sequence.toLowerCase();
80
+ }
81
+ return key === undefined ? undefined : [...modifiers, key.toLowerCase()].join("+");
82
+ }
83
+ function parseBinding(binding) {
84
+ const value = binding.trim();
85
+ if (value.length === 0) {
86
+ return undefined;
87
+ }
88
+ const parts = value.split("+").map((part) => part.trim()).filter(Boolean);
89
+ if (parts.length === 0) {
90
+ return undefined;
91
+ }
92
+ let ctrl = false;
93
+ let meta = false;
94
+ let shift = false;
95
+ const key = parts.at(-1);
96
+ if (key === undefined) {
97
+ return undefined;
98
+ }
99
+ for (const modifier of parts.slice(0, -1)) {
100
+ const normalized = modifier.toLowerCase();
101
+ if (normalized === "ctrl" || normalized === "control") {
102
+ ctrl = true;
103
+ continue;
104
+ }
105
+ if (normalized === "meta" || normalized === "alt") {
106
+ meta = true;
107
+ continue;
108
+ }
109
+ if (normalized === "shift") {
110
+ shift = true;
111
+ continue;
112
+ }
113
+ }
114
+ const normalizedKey = normalizeKeyName(key);
115
+ if (parts.length === 1 && isShiftedCharacter(normalizedKey)) {
116
+ shift = true;
117
+ }
118
+ if (normalizedKey.length === 1) {
119
+ return {
120
+ ch: normalizeBindingCharacter(normalizedKey, shift),
121
+ ctrl,
122
+ meta,
123
+ shift
124
+ };
125
+ }
126
+ if (!ctrl &&
127
+ !meta &&
128
+ !shift &&
129
+ !isNamedKey(normalizedKey) &&
130
+ isPrintableSequence(normalizedKey)) {
131
+ return {
132
+ sequence: normalizedKey,
133
+ ctrl,
134
+ meta,
135
+ shift
136
+ };
137
+ }
138
+ return {
139
+ name: normalizedKey.toLowerCase(),
140
+ ctrl,
141
+ meta,
142
+ shift
143
+ };
144
+ }
145
+ function matchesSingleKey(binding, event) {
146
+ if (binding.sequence !== undefined) {
147
+ return false;
148
+ }
149
+ if (binding.ctrl !== event.ctrl ||
150
+ binding.meta !== event.meta ||
151
+ binding.shift !== event.shift) {
152
+ return false;
153
+ }
154
+ if (binding.ch !== undefined) {
155
+ return event.ch === binding.ch || event.name === binding.ch.toLowerCase();
156
+ }
157
+ if (binding.name !== undefined) {
158
+ return event.name === binding.name;
159
+ }
160
+ return false;
161
+ }
162
+ function eventToSequenceToken(event) {
163
+ if (event.ctrl || event.meta || event.ch === undefined) {
164
+ return undefined;
165
+ }
166
+ return event.ch;
167
+ }
168
+ function hasSequencePrefix(sequences, prefix) {
169
+ for (const sequence of sequences) {
170
+ if (sequence.startsWith(prefix)) {
171
+ return true;
172
+ }
173
+ }
174
+ return false;
175
+ }
176
+ function isShiftedCharacter(value) {
177
+ return value.length === 1 && value.toLowerCase() !== value && value.toUpperCase() === value;
178
+ }
179
+ function normalizeBindingCharacter(value, shift) {
180
+ if (!shift || value.toLowerCase() === value.toUpperCase()) {
181
+ return value;
182
+ }
183
+ return value.toUpperCase();
184
+ }
185
+ function normalizeKeyName(value) {
186
+ if (value.toLowerCase() === "space") {
187
+ return " ";
188
+ }
189
+ if (value === "↑") {
190
+ return "up";
191
+ }
192
+ if (value === "↓") {
193
+ return "down";
194
+ }
195
+ if (value === "←") {
196
+ return "left";
197
+ }
198
+ if (value === "→") {
199
+ return "right";
200
+ }
201
+ return value;
202
+ }
203
+ function isNamedKey(value) {
204
+ return namedKeys.has(value.toLowerCase());
205
+ }
206
+ function isPrintableSequence(value) {
207
+ if (Array.from(value).length <= 1) {
208
+ return false;
209
+ }
210
+ for (const char of value) {
211
+ const codePoint = char.codePointAt(0);
212
+ if (codePoint === undefined || codePoint < 0x20 || codePoint === 0x7f) {
213
+ return false;
214
+ }
215
+ }
216
+ return true;
217
+ }
218
+ const namedKeys = new Set([
219
+ "backspace",
220
+ "delete",
221
+ "down",
222
+ "end",
223
+ "enter",
224
+ "escape",
225
+ "home",
226
+ "left",
227
+ "pagedown",
228
+ "pageup",
229
+ "return",
230
+ "right",
231
+ "tab",
232
+ "up"
233
+ ]);
@@ -0,0 +1,25 @@
1
+ import type { Rect } from "./types.js";
2
+ export type LayoutOptions = {
3
+ totalWidth: number;
4
+ totalHeight: number;
5
+ rightPaneWidth?: number;
6
+ footerHeight?: number;
7
+ borderWidth?: number;
8
+ };
9
+ export type DashboardLayout = {
10
+ outerBorder: Rect;
11
+ leftPane: Rect;
12
+ rightPane: Rect;
13
+ divider: {
14
+ x: number;
15
+ top: number;
16
+ bottom: number;
17
+ };
18
+ footer: Rect;
19
+ footerDivider: {
20
+ y: number;
21
+ left: number;
22
+ right: number;
23
+ };
24
+ };
25
+ export declare function computeDashboardLayout(opts: LayoutOptions): DashboardLayout;
@@ -0,0 +1,79 @@
1
+ const DEFAULT_RIGHT_PANE_WIDTH = 25;
2
+ const DEFAULT_FOOTER_HEIGHT = 1;
3
+ const DEFAULT_BORDER_WIDTH = 1;
4
+ const MIN_LEFT_PANE_WIDTH = 20;
5
+ export function computeDashboardLayout(opts) {
6
+ const totalWidth = normalizeSize(opts.totalWidth);
7
+ const totalHeight = normalizeSize(opts.totalHeight);
8
+ const borderWidth = normalizeSize(opts.borderWidth ?? DEFAULT_BORDER_WIDTH);
9
+ const footerHeight = normalizeSize(opts.footerHeight ?? DEFAULT_FOOTER_HEIGHT);
10
+ const requestedRightPaneWidth = normalizeSize(opts.rightPaneWidth ?? DEFAULT_RIGHT_PANE_WIDTH);
11
+ const maxX = Math.max(0, totalWidth - 1);
12
+ const maxY = Math.max(0, totalHeight - 1);
13
+ const outerBorder = { x: 0, y: 0, width: totalWidth, height: totalHeight };
14
+ const innerWidth = Math.max(0, totalWidth - (borderWidth * 2));
15
+ const innerHeight = Math.max(0, totalHeight - (borderWidth * 2));
16
+ const innerX = clampCoordinate(borderWidth, maxX);
17
+ const innerY = clampCoordinate(borderWidth, maxY);
18
+ const dividerWidth = innerWidth > 0 ? 1 : 0;
19
+ const availablePaneWidth = Math.max(0, innerWidth - dividerWidth);
20
+ const leftPaneWidth = computeLeftPaneWidth(availablePaneWidth, requestedRightPaneWidth);
21
+ const rightPaneWidth = Math.max(0, availablePaneWidth - leftPaneWidth);
22
+ const actualFooterHeight = Math.min(footerHeight, innerHeight);
23
+ const footerDividerHeight = innerHeight > actualFooterHeight ? 1 : 0;
24
+ const contentHeight = Math.max(0, innerHeight - actualFooterHeight - footerDividerHeight);
25
+ const leftPane = {
26
+ x: innerX,
27
+ y: innerY,
28
+ width: leftPaneWidth,
29
+ height: contentHeight
30
+ };
31
+ const dividerX = clampCoordinate(leftPane.x + leftPane.width, maxX);
32
+ const rightPane = {
33
+ x: clampCoordinate(dividerX + dividerWidth, maxX),
34
+ y: innerY,
35
+ width: rightPaneWidth,
36
+ height: contentHeight
37
+ };
38
+ const dividerTop = innerY;
39
+ const dividerBottom = clampCoordinate(dividerTop + Math.max(contentHeight - 1, 0), maxY);
40
+ const footerDividerY = clampCoordinate(innerY + contentHeight, maxY);
41
+ const footerY = clampCoordinate(footerDividerY + footerDividerHeight, maxY);
42
+ const footerDividerLeft = innerX;
43
+ const footerDividerRight = clampCoordinate(Math.max(innerX, totalWidth - borderWidth - 1), maxX);
44
+ return {
45
+ outerBorder,
46
+ leftPane,
47
+ rightPane,
48
+ divider: {
49
+ x: dividerX,
50
+ top: dividerTop,
51
+ bottom: dividerBottom
52
+ },
53
+ footer: {
54
+ x: innerX,
55
+ y: footerY,
56
+ width: innerWidth,
57
+ height: actualFooterHeight
58
+ },
59
+ footerDivider: {
60
+ y: footerDividerY,
61
+ left: footerDividerLeft,
62
+ right: footerDividerRight
63
+ }
64
+ };
65
+ }
66
+ function computeLeftPaneWidth(availablePaneWidth, requestedRightPaneWidth) {
67
+ if (availablePaneWidth <= 0) {
68
+ return 0;
69
+ }
70
+ const maxRightPaneWidth = Math.max(0, availablePaneWidth - MIN_LEFT_PANE_WIDTH);
71
+ const rightPaneWidth = Math.min(requestedRightPaneWidth, maxRightPaneWidth);
72
+ return Math.max(0, availablePaneWidth - rightPaneWidth);
73
+ }
74
+ function normalizeSize(value) {
75
+ return Math.max(0, Math.floor(value));
76
+ }
77
+ function clampCoordinate(value, max) {
78
+ return Math.max(0, Math.min(value, max));
79
+ }
@@ -0,0 +1,10 @@
1
+ type DashboardIo = {
2
+ stdin: {
3
+ isTTY?: boolean | undefined;
4
+ };
5
+ stdout: {
6
+ isTTY?: boolean | undefined;
7
+ };
8
+ };
9
+ export declare function shouldUseInteractiveDashboard(enabled: boolean | undefined, io?: DashboardIo): boolean;
10
+ export {};