@dirgha/code 1.2.0

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 (360) hide show
  1. package/LICENSE +101 -0
  2. package/README.md +674 -0
  3. package/dist/dirgha.mjs +2185 -0
  4. package/dist_v2/acp/index.d.ts +1 -0
  5. package/dist_v2/acp/index.js +2 -0
  6. package/dist_v2/acp/server.d.ts +31 -0
  7. package/dist_v2/acp/server.js +137 -0
  8. package/dist_v2/cli/auth-cmd.d.ts +10 -0
  9. package/dist_v2/cli/auth-cmd.js +69 -0
  10. package/dist_v2/cli/config.d.ts +46 -0
  11. package/dist_v2/cli/config.js +70 -0
  12. package/dist_v2/cli/flags.d.ts +10 -0
  13. package/dist_v2/cli/flags.js +49 -0
  14. package/dist_v2/cli/flows/full-cycle.d.ts +30 -0
  15. package/dist_v2/cli/flows/full-cycle.js +39 -0
  16. package/dist_v2/cli/flows/index.d.ts +2 -0
  17. package/dist_v2/cli/flows/index.js +3 -0
  18. package/dist_v2/cli/flows/tarball.d.ts +10 -0
  19. package/dist_v2/cli/flows/tarball.js +47 -0
  20. package/dist_v2/cli/index.d.ts +4 -0
  21. package/dist_v2/cli/index.js +5 -0
  22. package/dist_v2/cli/interactive.d.ts +21 -0
  23. package/dist_v2/cli/interactive.js +207 -0
  24. package/dist_v2/cli/main.d.ts +10 -0
  25. package/dist_v2/cli/main.js +173 -0
  26. package/dist_v2/cli/models-cmd.d.ts +6 -0
  27. package/dist_v2/cli/models-cmd.js +50 -0
  28. package/dist_v2/cli/setup.d.ts +13 -0
  29. package/dist_v2/cli/setup.js +128 -0
  30. package/dist_v2/cli/slash/account.d.ts +10 -0
  31. package/dist_v2/cli/slash/account.js +59 -0
  32. package/dist_v2/cli/slash/clear.d.ts +8 -0
  33. package/dist_v2/cli/slash/clear.js +15 -0
  34. package/dist_v2/cli/slash/compact.d.ts +7 -0
  35. package/dist_v2/cli/slash/compact.js +13 -0
  36. package/dist_v2/cli/slash/config.d.ts +8 -0
  37. package/dist_v2/cli/slash/config.js +49 -0
  38. package/dist_v2/cli/slash/exit.d.ts +7 -0
  39. package/dist_v2/cli/slash/exit.js +16 -0
  40. package/dist_v2/cli/slash/fleet.d.ts +7 -0
  41. package/dist_v2/cli/slash/fleet.js +22 -0
  42. package/dist_v2/cli/slash/help.d.ts +9 -0
  43. package/dist_v2/cli/slash/help.js +31 -0
  44. package/dist_v2/cli/slash/history.d.ts +7 -0
  45. package/dist_v2/cli/slash/history.js +42 -0
  46. package/dist_v2/cli/slash/index.d.ts +30 -0
  47. package/dist_v2/cli/slash/index.js +52 -0
  48. package/dist_v2/cli/slash/init.d.ts +8 -0
  49. package/dist_v2/cli/slash/init.js +57 -0
  50. package/dist_v2/cli/slash/keys.d.ts +8 -0
  51. package/dist_v2/cli/slash/keys.js +101 -0
  52. package/dist_v2/cli/slash/login.d.ts +10 -0
  53. package/dist_v2/cli/slash/login.js +47 -0
  54. package/dist_v2/cli/slash/memory.d.ts +8 -0
  55. package/dist_v2/cli/slash/memory.js +101 -0
  56. package/dist_v2/cli/slash/mode.d.ts +8 -0
  57. package/dist_v2/cli/slash/mode.js +30 -0
  58. package/dist_v2/cli/slash/models.d.ts +8 -0
  59. package/dist_v2/cli/slash/models.js +73 -0
  60. package/dist_v2/cli/slash/resume.d.ts +8 -0
  61. package/dist_v2/cli/slash/resume.js +24 -0
  62. package/dist_v2/cli/slash/session.d.ts +8 -0
  63. package/dist_v2/cli/slash/session.js +74 -0
  64. package/dist_v2/cli/slash/setup.d.ts +8 -0
  65. package/dist_v2/cli/slash/setup.js +50 -0
  66. package/dist_v2/cli/slash/status.d.ts +7 -0
  67. package/dist_v2/cli/slash/status.js +37 -0
  68. package/dist_v2/cli/slash/theme.d.ts +9 -0
  69. package/dist_v2/cli/slash/theme.js +53 -0
  70. package/dist_v2/cli/slash/types.d.ts +14 -0
  71. package/dist_v2/cli/slash/types.js +9 -0
  72. package/dist_v2/cli/slash/upgrade.d.ts +9 -0
  73. package/dist_v2/cli/slash/upgrade.js +66 -0
  74. package/dist_v2/cli/slash.d.ts +72 -0
  75. package/dist_v2/cli/slash.js +77 -0
  76. package/dist_v2/cli/subcommands/ask.d.ts +17 -0
  77. package/dist_v2/cli/subcommands/ask.js +76 -0
  78. package/dist_v2/cli/subcommands/audit.d.ts +15 -0
  79. package/dist_v2/cli/subcommands/audit.js +128 -0
  80. package/dist_v2/cli/subcommands/chat.d.ts +13 -0
  81. package/dist_v2/cli/subcommands/chat.js +72 -0
  82. package/dist_v2/cli/subcommands/compact.d.ts +14 -0
  83. package/dist_v2/cli/subcommands/compact.js +114 -0
  84. package/dist_v2/cli/subcommands/doctor.d.ts +11 -0
  85. package/dist_v2/cli/subcommands/doctor.js +103 -0
  86. package/dist_v2/cli/subcommands/export-session.d.ts +10 -0
  87. package/dist_v2/cli/subcommands/export-session.js +60 -0
  88. package/dist_v2/cli/subcommands/import-session.d.ts +11 -0
  89. package/dist_v2/cli/subcommands/import-session.js +77 -0
  90. package/dist_v2/cli/subcommands/index.d.ts +40 -0
  91. package/dist_v2/cli/subcommands/index.js +38 -0
  92. package/dist_v2/cli/subcommands/init.d.ts +10 -0
  93. package/dist_v2/cli/subcommands/init.js +74 -0
  94. package/dist_v2/cli/subcommands/keys.d.ts +12 -0
  95. package/dist_v2/cli/subcommands/keys.js +136 -0
  96. package/dist_v2/cli/subcommands/login.d.ts +10 -0
  97. package/dist_v2/cli/subcommands/login.js +60 -0
  98. package/dist_v2/cli/subcommands/logout.d.ts +10 -0
  99. package/dist_v2/cli/subcommands/logout.js +21 -0
  100. package/dist_v2/cli/subcommands/models.d.ts +14 -0
  101. package/dist_v2/cli/subcommands/models.js +144 -0
  102. package/dist_v2/cli/subcommands/setup.d.ts +11 -0
  103. package/dist_v2/cli/subcommands/setup.js +107 -0
  104. package/dist_v2/cli/subcommands/stats.d.ts +13 -0
  105. package/dist_v2/cli/subcommands/stats.js +148 -0
  106. package/dist_v2/cli/subcommands/status.d.ts +14 -0
  107. package/dist_v2/cli/subcommands/status.js +91 -0
  108. package/dist_v2/cli/submit-paper.d.ts +15 -0
  109. package/dist_v2/cli/submit-paper.js +68 -0
  110. package/dist_v2/context/_fts.d.ts +62 -0
  111. package/dist_v2/context/_fts.js +195 -0
  112. package/dist_v2/context/branch.d.ts +18 -0
  113. package/dist_v2/context/branch.js +66 -0
  114. package/dist_v2/context/compaction.d.ts +26 -0
  115. package/dist_v2/context/compaction.js +120 -0
  116. package/dist_v2/context/index.d.ts +5 -0
  117. package/dist_v2/context/index.js +6 -0
  118. package/dist_v2/context/knowledge.d.ts +38 -0
  119. package/dist_v2/context/knowledge.js +146 -0
  120. package/dist_v2/context/memory.d.ts +80 -0
  121. package/dist_v2/context/memory.js +276 -0
  122. package/dist_v2/context/mode.d.ts +25 -0
  123. package/dist_v2/context/mode.js +81 -0
  124. package/dist_v2/context/session.d.ts +56 -0
  125. package/dist_v2/context/session.js +108 -0
  126. package/dist_v2/daemon/index.d.ts +2 -0
  127. package/dist_v2/daemon/index.js +3 -0
  128. package/dist_v2/daemon/protocol.d.ts +73 -0
  129. package/dist_v2/daemon/protocol.js +6 -0
  130. package/dist_v2/daemon/server.d.ts +35 -0
  131. package/dist_v2/daemon/server.js +191 -0
  132. package/dist_v2/eval/index.d.ts +5 -0
  133. package/dist_v2/eval/index.js +6 -0
  134. package/dist_v2/eval/regression.d.ts +14 -0
  135. package/dist_v2/eval/regression.js +106 -0
  136. package/dist_v2/eval/reporter.d.ts +7 -0
  137. package/dist_v2/eval/reporter.js +34 -0
  138. package/dist_v2/eval/swe-bench.d.ts +18 -0
  139. package/dist_v2/eval/swe-bench.js +23 -0
  140. package/dist_v2/eval/terminal-bench.d.ts +13 -0
  141. package/dist_v2/eval/terminal-bench.js +19 -0
  142. package/dist_v2/eval/types.d.ts +36 -0
  143. package/dist_v2/eval/types.js +5 -0
  144. package/dist_v2/fleet/apply-back.d.ts +27 -0
  145. package/dist_v2/fleet/apply-back.js +191 -0
  146. package/dist_v2/fleet/cli-command.d.ts +61 -0
  147. package/dist_v2/fleet/cli-command.js +329 -0
  148. package/dist_v2/fleet/index.d.ts +21 -0
  149. package/dist_v2/fleet/index.js +21 -0
  150. package/dist_v2/fleet/runner.d.ts +28 -0
  151. package/dist_v2/fleet/runner.js +347 -0
  152. package/dist_v2/fleet/tripleshot.d.ts +21 -0
  153. package/dist_v2/fleet/tripleshot.js +222 -0
  154. package/dist_v2/fleet/types.d.ts +193 -0
  155. package/dist_v2/fleet/types.js +24 -0
  156. package/dist_v2/fleet/worktree.d.ts +51 -0
  157. package/dist_v2/fleet/worktree.js +176 -0
  158. package/dist_v2/hooks/index.d.ts +1 -0
  159. package/dist_v2/hooks/index.js +2 -0
  160. package/dist_v2/hooks/registry.d.ts +21 -0
  161. package/dist_v2/hooks/registry.js +40 -0
  162. package/dist_v2/index.d.ts +12 -0
  163. package/dist_v2/index.js +11 -0
  164. package/dist_v2/integrations/arniko-client.d.ts +42 -0
  165. package/dist_v2/integrations/arniko-client.js +86 -0
  166. package/dist_v2/integrations/auth.d.ts +45 -0
  167. package/dist_v2/integrations/auth.js +54 -0
  168. package/dist_v2/integrations/billing.d.ts +71 -0
  169. package/dist_v2/integrations/billing.js +107 -0
  170. package/dist_v2/integrations/bucky-client.d.ts +105 -0
  171. package/dist_v2/integrations/bucky-client.js +76 -0
  172. package/dist_v2/integrations/deploy-client.d.ts +60 -0
  173. package/dist_v2/integrations/deploy-client.js +87 -0
  174. package/dist_v2/integrations/device-auth.d.ts +48 -0
  175. package/dist_v2/integrations/device-auth.js +192 -0
  176. package/dist_v2/integrations/entitlements.d.ts +34 -0
  177. package/dist_v2/integrations/entitlements.js +43 -0
  178. package/dist_v2/integrations/http.d.ts +22 -0
  179. package/dist_v2/integrations/http.js +114 -0
  180. package/dist_v2/integrations/index.d.ts +8 -0
  181. package/dist_v2/integrations/index.js +15 -0
  182. package/dist_v2/intelligence/cost.d.ts +28 -0
  183. package/dist_v2/intelligence/cost.js +58 -0
  184. package/dist_v2/intelligence/error-classifier.d.ts +8 -0
  185. package/dist_v2/intelligence/error-classifier.js +71 -0
  186. package/dist_v2/intelligence/index.d.ts +5 -0
  187. package/dist_v2/intelligence/index.js +6 -0
  188. package/dist_v2/intelligence/prices.d.ts +13 -0
  189. package/dist_v2/intelligence/prices.js +26 -0
  190. package/dist_v2/intelligence/smart-router.d.ts +21 -0
  191. package/dist_v2/intelligence/smart-router.js +59 -0
  192. package/dist_v2/intelligence/telemetry.d.ts +22 -0
  193. package/dist_v2/intelligence/telemetry.js +31 -0
  194. package/dist_v2/kernel/agent-loop.d.ts +32 -0
  195. package/dist_v2/kernel/agent-loop.js +151 -0
  196. package/dist_v2/kernel/event-stream.d.ts +18 -0
  197. package/dist_v2/kernel/event-stream.js +102 -0
  198. package/dist_v2/kernel/index.d.ts +4 -0
  199. package/dist_v2/kernel/index.js +5 -0
  200. package/dist_v2/kernel/message.d.ts +29 -0
  201. package/dist_v2/kernel/message.js +118 -0
  202. package/dist_v2/kernel/types.d.ts +206 -0
  203. package/dist_v2/kernel/types.js +9 -0
  204. package/dist_v2/mcp/client.d.ts +44 -0
  205. package/dist_v2/mcp/client.js +63 -0
  206. package/dist_v2/mcp/index.d.ts +3 -0
  207. package/dist_v2/mcp/index.js +4 -0
  208. package/dist_v2/mcp/tool-bridge.d.ts +11 -0
  209. package/dist_v2/mcp/tool-bridge.js +33 -0
  210. package/dist_v2/mcp/transport.d.ts +29 -0
  211. package/dist_v2/mcp/transport.js +73 -0
  212. package/dist_v2/parity/index.d.ts +3 -0
  213. package/dist_v2/parity/index.js +4 -0
  214. package/dist_v2/parity/mock-openai-compat.d.ts +15 -0
  215. package/dist_v2/parity/mock-openai-compat.js +35 -0
  216. package/dist_v2/parity/runner.d.ts +21 -0
  217. package/dist_v2/parity/runner.js +76 -0
  218. package/dist_v2/parity/scenarios.d.ts +20 -0
  219. package/dist_v2/parity/scenarios.js +70 -0
  220. package/dist_v2/providers/anthropic.d.ts +21 -0
  221. package/dist_v2/providers/anthropic.js +191 -0
  222. package/dist_v2/providers/dispatch.d.ts +11 -0
  223. package/dist_v2/providers/dispatch.js +45 -0
  224. package/dist_v2/providers/fireworks.d.ts +18 -0
  225. package/dist_v2/providers/fireworks.js +44 -0
  226. package/dist_v2/providers/gemini.d.ts +19 -0
  227. package/dist_v2/providers/gemini.js +188 -0
  228. package/dist_v2/providers/http.d.ts +41 -0
  229. package/dist_v2/providers/http.js +188 -0
  230. package/dist_v2/providers/iface.d.ts +18 -0
  231. package/dist_v2/providers/iface.js +18 -0
  232. package/dist_v2/providers/index.d.ts +39 -0
  233. package/dist_v2/providers/index.js +51 -0
  234. package/dist_v2/providers/nvidia.d.ts +27 -0
  235. package/dist_v2/providers/nvidia.js +142 -0
  236. package/dist_v2/providers/ollama.d.ts +15 -0
  237. package/dist_v2/providers/ollama.js +37 -0
  238. package/dist_v2/providers/openai-compat.d.ts +29 -0
  239. package/dist_v2/providers/openai-compat.js +239 -0
  240. package/dist_v2/providers/openai.d.ts +20 -0
  241. package/dist_v2/providers/openai.js +107 -0
  242. package/dist_v2/providers/openrouter.d.ts +24 -0
  243. package/dist_v2/providers/openrouter.js +69 -0
  244. package/dist_v2/safety/approval-bus.d.ts +26 -0
  245. package/dist_v2/safety/approval-bus.js +48 -0
  246. package/dist_v2/safety/audit-log.d.ts +27 -0
  247. package/dist_v2/safety/audit-log.js +71 -0
  248. package/dist_v2/safety/index.d.ts +4 -0
  249. package/dist_v2/safety/index.js +5 -0
  250. package/dist_v2/safety/policy.d.ts +32 -0
  251. package/dist_v2/safety/policy.js +131 -0
  252. package/dist_v2/safety/sandbox/bwrap.d.ts +11 -0
  253. package/dist_v2/safety/sandbox/bwrap.js +52 -0
  254. package/dist_v2/safety/sandbox/iface.d.ts +29 -0
  255. package/dist_v2/safety/sandbox/iface.js +8 -0
  256. package/dist_v2/safety/sandbox/index.d.ts +7 -0
  257. package/dist_v2/safety/sandbox/index.js +8 -0
  258. package/dist_v2/safety/sandbox/landlock.d.ts +17 -0
  259. package/dist_v2/safety/sandbox/landlock.js +26 -0
  260. package/dist_v2/safety/sandbox/noop.d.ts +12 -0
  261. package/dist_v2/safety/sandbox/noop.js +52 -0
  262. package/dist_v2/safety/sandbox/seatbelt.d.ts +11 -0
  263. package/dist_v2/safety/sandbox/seatbelt.js +49 -0
  264. package/dist_v2/safety/sandbox/select.d.ts +6 -0
  265. package/dist_v2/safety/sandbox/select.js +42 -0
  266. package/dist_v2/safety/sandbox/windows.d.ts +13 -0
  267. package/dist_v2/safety/sandbox/windows.js +22 -0
  268. package/dist_v2/skills/index.d.ts +3 -0
  269. package/dist_v2/skills/index.js +4 -0
  270. package/dist_v2/skills/loader.d.ts +38 -0
  271. package/dist_v2/skills/loader.js +102 -0
  272. package/dist_v2/skills/matcher.d.ts +14 -0
  273. package/dist_v2/skills/matcher.js +72 -0
  274. package/dist_v2/skills/runtime.d.ts +13 -0
  275. package/dist_v2/skills/runtime.js +40 -0
  276. package/dist_v2/subagents/delegator.d.ts +36 -0
  277. package/dist_v2/subagents/delegator.js +82 -0
  278. package/dist_v2/subagents/index.d.ts +2 -0
  279. package/dist_v2/subagents/index.js +3 -0
  280. package/dist_v2/subagents/pool.d.ts +18 -0
  281. package/dist_v2/subagents/pool.js +31 -0
  282. package/dist_v2/tools/browser.d.ts +27 -0
  283. package/dist_v2/tools/browser.js +179 -0
  284. package/dist_v2/tools/checkpoint.d.ts +25 -0
  285. package/dist_v2/tools/checkpoint.js +222 -0
  286. package/dist_v2/tools/cron.d.ts +32 -0
  287. package/dist_v2/tools/cron.js +160 -0
  288. package/dist_v2/tools/diff.d.ts +18 -0
  289. package/dist_v2/tools/diff.js +117 -0
  290. package/dist_v2/tools/exec.d.ts +19 -0
  291. package/dist_v2/tools/exec.js +49 -0
  292. package/dist_v2/tools/fs-edit.d.ts +11 -0
  293. package/dist_v2/tools/fs-edit.js +81 -0
  294. package/dist_v2/tools/fs-ls.d.ts +7 -0
  295. package/dist_v2/tools/fs-ls.js +57 -0
  296. package/dist_v2/tools/fs-read.d.ts +7 -0
  297. package/dist_v2/tools/fs-read.js +60 -0
  298. package/dist_v2/tools/fs-write.d.ts +8 -0
  299. package/dist_v2/tools/fs-write.js +46 -0
  300. package/dist_v2/tools/git.d.ts +8 -0
  301. package/dist_v2/tools/git.js +57 -0
  302. package/dist_v2/tools/index.d.ts +25 -0
  303. package/dist_v2/tools/index.js +39 -0
  304. package/dist_v2/tools/multimodal.d.ts +41 -0
  305. package/dist_v2/tools/multimodal.js +381 -0
  306. package/dist_v2/tools/permission.d.ts +27 -0
  307. package/dist_v2/tools/permission.js +43 -0
  308. package/dist_v2/tools/registry.d.ts +44 -0
  309. package/dist_v2/tools/registry.js +62 -0
  310. package/dist_v2/tools/search-glob.d.ts +7 -0
  311. package/dist_v2/tools/search-glob.js +98 -0
  312. package/dist_v2/tools/search-grep.d.ts +7 -0
  313. package/dist_v2/tools/search-grep.js +109 -0
  314. package/dist_v2/tools/shell.d.ts +10 -0
  315. package/dist_v2/tools/shell.js +76 -0
  316. package/dist_v2/tools/task.d.ts +8 -0
  317. package/dist_v2/tools/task.js +37 -0
  318. package/dist_v2/tui/approval.d.ts +7 -0
  319. package/dist_v2/tui/approval.js +55 -0
  320. package/dist_v2/tui/index.d.ts +4 -0
  321. package/dist_v2/tui/index.js +5 -0
  322. package/dist_v2/tui/ink/App.d.ts +39 -0
  323. package/dist_v2/tui/ink/App.js +206 -0
  324. package/dist_v2/tui/ink/components/AtFileComplete.d.ts +25 -0
  325. package/dist_v2/tui/ink/components/AtFileComplete.js +158 -0
  326. package/dist_v2/tui/ink/components/HelpOverlay.d.ts +24 -0
  327. package/dist_v2/tui/ink/components/HelpOverlay.js +130 -0
  328. package/dist_v2/tui/ink/components/InputBox.d.ts +35 -0
  329. package/dist_v2/tui/ink/components/InputBox.js +153 -0
  330. package/dist_v2/tui/ink/components/Logo.d.ts +12 -0
  331. package/dist_v2/tui/ink/components/Logo.js +27 -0
  332. package/dist_v2/tui/ink/components/ModelPicker.d.ts +26 -0
  333. package/dist_v2/tui/ink/components/ModelPicker.js +80 -0
  334. package/dist_v2/tui/ink/components/PasteCollapse.d.ts +36 -0
  335. package/dist_v2/tui/ink/components/PasteCollapse.js +59 -0
  336. package/dist_v2/tui/ink/components/StatusBar.d.ts +18 -0
  337. package/dist_v2/tui/ink/components/StatusBar.js +41 -0
  338. package/dist_v2/tui/ink/components/StreamingText.d.ts +14 -0
  339. package/dist_v2/tui/ink/components/StreamingText.js +11 -0
  340. package/dist_v2/tui/ink/components/ThinkingBlock.d.ts +13 -0
  341. package/dist_v2/tui/ink/components/ThinkingBlock.js +13 -0
  342. package/dist_v2/tui/ink/components/ToolBox.d.ts +20 -0
  343. package/dist_v2/tui/ink/components/ToolBox.js +63 -0
  344. package/dist_v2/tui/ink/components/vim-bindings.d.ts +43 -0
  345. package/dist_v2/tui/ink/components/vim-bindings.js +135 -0
  346. package/dist_v2/tui/ink/index.d.ts +39 -0
  347. package/dist_v2/tui/ink/index.js +47 -0
  348. package/dist_v2/tui/ink/use-event-projection.d.ts +51 -0
  349. package/dist_v2/tui/ink/use-event-projection.js +126 -0
  350. package/dist_v2/tui/ink/use-overlays.d.ts +24 -0
  351. package/dist_v2/tui/ink/use-overlays.js +50 -0
  352. package/dist_v2/tui/renderer.d.ts +19 -0
  353. package/dist_v2/tui/renderer.js +64 -0
  354. package/dist_v2/tui/status-bar.d.ts +12 -0
  355. package/dist_v2/tui/status-bar.js +16 -0
  356. package/dist_v2/tui/theme.d.ts +27 -0
  357. package/dist_v2/tui/theme.js +56 -0
  358. package/dist_v2/utils/json-repair.d.ts +7 -0
  359. package/dist_v2/utils/json-repair.js +45 -0
  360. package/package.json +113 -0
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Paste-collapse helpers for InputBox.
3
+ *
4
+ * When a single keystroke tick grows the buffer by a large margin, the
5
+ * pasted block is hidden behind a `[N lines pasted, X chars]` placeholder
6
+ * so the prompt stays legible. Ctrl+E toggles expansion.
7
+ *
8
+ * The real content lives in the backing buffer passed to `onSubmit`, so
9
+ * Enter still submits the full text — only the rendering is collapsed.
10
+ */
11
+ import * as React from 'react';
12
+ export declare const PASTE_LINE_THRESHOLD = 4;
13
+ export declare const PASTE_CHAR_THRESHOLD = 200;
14
+ export interface PasteSegment {
15
+ start: number;
16
+ end: number;
17
+ lines: number;
18
+ chars: number;
19
+ }
20
+ /**
21
+ * Returns a segment describing a just-pasted block when the delta between
22
+ * two consecutive buffer values looks like a paste. Returns null when the
23
+ * change looks like ordinary typing.
24
+ */
25
+ export declare function detectPaste(prev: string, next: string): PasteSegment | null;
26
+ export interface PasteCollapseViewProps {
27
+ value: string;
28
+ segment: PasteSegment;
29
+ expanded: boolean;
30
+ }
31
+ /**
32
+ * Renders the buffer with the pasted region collapsed behind a
33
+ * placeholder when `expanded` is false. Always renders a small
34
+ * hint so the user knows Ctrl+E toggles it.
35
+ */
36
+ export declare function PasteCollapseView(props: PasteCollapseViewProps): React.JSX.Element;
@@ -0,0 +1,59 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Text } from 'ink';
3
+ export const PASTE_LINE_THRESHOLD = 4;
4
+ export const PASTE_CHAR_THRESHOLD = 200;
5
+ /**
6
+ * Returns a segment describing a just-pasted block when the delta between
7
+ * two consecutive buffer values looks like a paste. Returns null when the
8
+ * change looks like ordinary typing.
9
+ */
10
+ export function detectPaste(prev, next) {
11
+ if (next.length - prev.length < PASTE_CHAR_THRESHOLD &&
12
+ countLines(next) - countLines(prev) < PASTE_LINE_THRESHOLD) {
13
+ return null;
14
+ }
15
+ // Locate the insertion point by finding the longest common prefix + suffix.
16
+ let prefix = 0;
17
+ while (prefix < prev.length && prefix < next.length && prev[prefix] === next[prefix])
18
+ prefix += 1;
19
+ let suffix = 0;
20
+ while (suffix < (prev.length - prefix) &&
21
+ suffix < (next.length - prefix) &&
22
+ prev[prev.length - 1 - suffix] === next[next.length - 1 - suffix])
23
+ suffix += 1;
24
+ const start = prefix;
25
+ const end = next.length - suffix;
26
+ if (end <= start)
27
+ return null;
28
+ const inserted = next.slice(start, end);
29
+ return {
30
+ start,
31
+ end,
32
+ lines: countLines(inserted),
33
+ chars: inserted.length,
34
+ };
35
+ }
36
+ function countLines(s) {
37
+ if (s === '')
38
+ return 0;
39
+ let n = 1;
40
+ for (let i = 0; i < s.length; i += 1)
41
+ if (s[i] === '\n')
42
+ n += 1;
43
+ return n;
44
+ }
45
+ /**
46
+ * Renders the buffer with the pasted region collapsed behind a
47
+ * placeholder when `expanded` is false. Always renders a small
48
+ * hint so the user knows Ctrl+E toggles it.
49
+ */
50
+ export function PasteCollapseView(props) {
51
+ const { value, segment, expanded } = props;
52
+ if (expanded) {
53
+ return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: value }), _jsxs(Text, { color: "gray", dimColor: true, children: ["[", segment.lines, " line", segment.lines === 1 ? '' : 's', ", ", segment.chars, " chars expanded \u00B7 Ctrl+E to collapse]"] })] }));
54
+ }
55
+ const before = value.slice(0, segment.start);
56
+ const after = value.slice(segment.end);
57
+ return (_jsxs(Box, { flexDirection: "row", flexWrap: "wrap", children: [_jsx(Text, { children: before }), _jsxs(Text, { color: "yellow", children: ["[", segment.lines, " line", segment.lines === 1 ? '' : 's', " pasted, ", segment.chars, " chars]"] }), _jsx(Text, { children: after }), _jsx(Text, { color: "gray", dimColor: true, children: " \u00B7 Ctrl+E expand" })] }));
58
+ }
59
+ //# sourceMappingURL=PasteCollapse.js.map
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Status bar rendered below the input box.
3
+ *
4
+ * Left cluster: cwd basename + provider id.
5
+ * Right cluster: model label + cumulative tokens + cost.
6
+ * When busy, a subtle spinner frame appears on the right.
7
+ */
8
+ import * as React from 'react';
9
+ export interface StatusBarProps {
10
+ model: string;
11
+ provider: string;
12
+ inputTokens: number;
13
+ outputTokens: number;
14
+ costUsd: number;
15
+ cwd: string;
16
+ busy: boolean;
17
+ }
18
+ export declare function StatusBar(props: StatusBarProps): React.JSX.Element;
@@ -0,0 +1,41 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Status bar rendered below the input box.
4
+ *
5
+ * Left cluster: cwd basename + provider id.
6
+ * Right cluster: model label + cumulative tokens + cost.
7
+ * When busy, a subtle spinner frame appears on the right.
8
+ */
9
+ import * as React from 'react';
10
+ import { Box, Text, useStdout } from 'ink';
11
+ const SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
12
+ function formatTokens(n) {
13
+ if (n < 1000)
14
+ return String(n);
15
+ if (n < 1_000_000)
16
+ return `${(n / 1000).toFixed(1)}k`;
17
+ return `${(n / 1_000_000).toFixed(2)}M`;
18
+ }
19
+ function cwdLabel(cwd) {
20
+ const parts = cwd.split('/').filter(Boolean);
21
+ return parts[parts.length - 1] ?? '~';
22
+ }
23
+ export function StatusBar(props) {
24
+ const { stdout } = useStdout();
25
+ const cols = stdout?.columns ?? 80;
26
+ const [frame, setFrame] = React.useState(0);
27
+ React.useEffect(() => {
28
+ if (!props.busy)
29
+ return;
30
+ const t = setInterval(() => {
31
+ setFrame(f => (f + 1) % SPINNER_FRAMES.length);
32
+ }, 80);
33
+ return () => clearInterval(t);
34
+ }, [props.busy]);
35
+ const totalTokens = props.inputTokens + props.outputTokens;
36
+ const tokenLabel = totalTokens > 0 ? formatTokens(totalTokens) : '';
37
+ const costLabel = props.costUsd > 0 ? `$${props.costUsd.toFixed(3)}` : '';
38
+ const modelShort = props.model.length > 28 ? `${props.model.slice(0, 27)}…` : props.model;
39
+ return (_jsxs(Box, { width: cols, paddingX: 1, justifyContent: "space-between", children: [_jsxs(Box, { gap: 1, children: [_jsx(Text, { color: "gray", dimColor: true, children: "\u25CF" }), _jsx(Text, { color: "gray", children: cwdLabel(props.cwd) }), _jsx(Text, { color: "magenta", dimColor: true, children: props.provider })] }), _jsxs(Box, { gap: 1, children: [props.busy && _jsx(Text, { color: "cyan", children: SPINNER_FRAMES[frame] }), _jsx(Text, { color: "cyan", children: modelShort }), tokenLabel !== '' && _jsx(Text, { color: "gray", dimColor: true, children: tokenLabel }), costLabel !== '' && _jsx(Text, { color: "gray", dimColor: true, children: costLabel }), !props.busy && _jsx(Text, { color: "gray", dimColor: true, children: "/help" })] })] }));
40
+ }
41
+ //# sourceMappingURL=StatusBar.js.map
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Streaming assistant text block.
3
+ *
4
+ * Renders a chunk of already-accumulated text_delta content. Ink
5
+ * handles wrapping; we only decorate with the brand glyph and
6
+ * allocate width from the TTY. Use one instance per text span
7
+ * (a text span is a contiguous run of text_delta between either
8
+ * thinking or tool events).
9
+ */
10
+ import * as React from 'react';
11
+ export interface StreamingTextProps {
12
+ content: string;
13
+ }
14
+ export declare function StreamingText({ content }: StreamingTextProps): React.JSX.Element | null;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Text, useStdout } from 'ink';
3
+ const BRAND = '#A78BFA';
4
+ export function StreamingText({ content }) {
5
+ const { stdout } = useStdout();
6
+ const width = Math.max(20, (stdout?.columns ?? 80) - 6);
7
+ if (content.length === 0)
8
+ return null;
9
+ return (_jsxs(Box, { gap: 2, width: width, marginBottom: 1, children: [_jsx(Text, { color: BRAND, children: "\u2726" }), _jsx(Text, { wrap: "wrap", children: content })] }));
10
+ }
11
+ //# sourceMappingURL=StreamingText.js.map
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Thinking block: dim italic render of reasoning tokens.
3
+ *
4
+ * Collapsed by default to a char-count summary (`thinking… (N chars)`)
5
+ * to stop reasoning-heavy models from flooding the screen. Pass
6
+ * `expanded` to dump the full content instead.
7
+ */
8
+ import * as React from 'react';
9
+ export interface ThinkingBlockProps {
10
+ content: string;
11
+ expanded?: boolean;
12
+ }
13
+ export declare function ThinkingBlock({ content, expanded }: ThinkingBlockProps): React.JSX.Element | null;
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Text, useStdout } from 'ink';
3
+ export function ThinkingBlock({ content, expanded = false }) {
4
+ const { stdout } = useStdout();
5
+ const width = Math.max(20, (stdout?.columns ?? 80) - 6);
6
+ if (content.length === 0)
7
+ return null;
8
+ if (!expanded) {
9
+ return (_jsxs(Box, { gap: 1, marginBottom: 1, children: [_jsx(Text, { color: "gray", dimColor: true, children: "\u280B" }), _jsxs(Text, { color: "gray", dimColor: true, italic: true, children: ["thinking\u2026 (", content.length, " chars)"] })] }));
10
+ }
11
+ return (_jsxs(Box, { gap: 2, width: width, marginBottom: 1, children: [_jsx(Text, { color: "gray", dimColor: true, children: "\u280B" }), _jsx(Text, { color: "gray", dimColor: true, italic: true, wrap: "wrap", children: content })] }));
12
+ }
13
+ //# sourceMappingURL=ThinkingBlock.js.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Tool invocation block.
3
+ *
4
+ * Consumes the state that App derives from tool_exec_start and
5
+ * tool_exec_end events. While a tool is in flight we render a spinner;
6
+ * on completion we show ✓ or ✗ plus the elapsed time and a short
7
+ * output preview. No state is owned here — App is the source of truth
8
+ * so history stays immutable after scroll-off.
9
+ */
10
+ import * as React from 'react';
11
+ export type ToolStatus = 'running' | 'done' | 'error';
12
+ export interface ToolBoxProps {
13
+ name: string;
14
+ status: ToolStatus;
15
+ argSummary?: string;
16
+ outputPreview?: string;
17
+ durationMs?: number;
18
+ startedAt: number;
19
+ }
20
+ export declare function ToolBox(props: ToolBoxProps): React.JSX.Element;
@@ -0,0 +1,63 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Tool invocation block.
4
+ *
5
+ * Consumes the state that App derives from tool_exec_start and
6
+ * tool_exec_end events. While a tool is in flight we render a spinner;
7
+ * on completion we show ✓ or ✗ plus the elapsed time and a short
8
+ * output preview. No state is owned here — App is the source of truth
9
+ * so history stays immutable after scroll-off.
10
+ */
11
+ import * as React from 'react';
12
+ import { Box, Text } from 'ink';
13
+ const SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
14
+ const TOOL_LABEL = {
15
+ fs_read: 'Read',
16
+ fs_write: 'Write',
17
+ fs_edit: 'Edit',
18
+ fs_ls: 'List',
19
+ search_grep: 'Grep',
20
+ search_glob: 'Glob',
21
+ shell: 'Shell',
22
+ git: 'Git',
23
+ task: 'Task',
24
+ };
25
+ function prettyName(name) {
26
+ return TOOL_LABEL[name] ?? name.replace(/_/g, ' ');
27
+ }
28
+ function formatElapsed(ms) {
29
+ if (ms < 1000)
30
+ return `${ms}ms`;
31
+ const s = Math.floor(ms / 1000);
32
+ if (s < 60)
33
+ return `${s}s`;
34
+ return `${Math.floor(s / 60)}m ${s % 60}s`;
35
+ }
36
+ export function ToolBox(props) {
37
+ const [frame, setFrame] = React.useState(0);
38
+ const [tick, setTick] = React.useState(0);
39
+ React.useEffect(() => {
40
+ if (props.status !== 'running')
41
+ return;
42
+ const t = setInterval(() => {
43
+ setFrame(f => (f + 1) % SPINNER_FRAMES.length);
44
+ setTick(n => n + 1);
45
+ }, 80);
46
+ return () => clearInterval(t);
47
+ }, [props.status]);
48
+ const icon = props.status === 'error' ? '✗' : props.status === 'done' ? '✓' : SPINNER_FRAMES[frame];
49
+ const iconColour = props.status === 'error' ? 'red' : props.status === 'done' ? 'green' : 'cyan';
50
+ const borderColour = props.status === 'error' ? 'red' : props.status === 'done' ? 'gray' : 'cyan';
51
+ const elapsedLabel = props.status === 'running'
52
+ ? formatElapsed(Date.now() - props.startedAt)
53
+ : props.durationMs !== undefined
54
+ ? formatElapsed(props.durationMs)
55
+ : '';
56
+ // tick is read so React treats it as a live dep; silences unused var lints.
57
+ void tick;
58
+ const preview = props.outputPreview
59
+ ? props.outputPreview.replace(/\s+/g, ' ').slice(0, 80)
60
+ : '';
61
+ return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: borderColour, paddingX: 1, marginBottom: 1, children: [_jsxs(Box, { gap: 1, children: [_jsx(Text, { color: iconColour, children: icon }), _jsx(Text, { color: props.status === 'done' ? 'gray' : 'white', bold: true, children: prettyName(props.name) }), props.argSummary !== undefined && props.argSummary.length > 0 && (_jsxs(Text, { color: "gray", dimColor: true, children: ["(", props.argSummary, ")"] })), elapsedLabel !== '' && _jsx(Text, { color: "gray", dimColor: true, children: elapsedLabel })] }), preview !== '' && (_jsx(Box, { children: _jsx(Text, { color: "gray", dimColor: true, children: preview }) }))] }));
62
+ }
63
+ //# sourceMappingURL=ToolBox.js.map
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Pure reducer for vim-style motions applied to a single-line text buffer.
3
+ *
4
+ * Keeping the state machine side-effect-free lets InputBox call it from
5
+ * its `useInput` handler with no React hooks or I/O. The buffer itself
6
+ * is a simple string; cursor is a character offset in `[0, value.length]`.
7
+ *
8
+ * Supported keys (subset):
9
+ * h / l move cursor one char left / right
10
+ * j / k move cursor one line up / down (single-line fallback = 0 / $)
11
+ * 0 / $ jump to line start / end
12
+ * w / b word jump (whitespace-delimited)
13
+ * x delete char under cursor
14
+ * dd delete entire line (clear buffer)
15
+ * dw delete to next word boundary
16
+ * yy yank (copy) whole line into register
17
+ * p paste register after cursor
18
+ * i return to INSERT mode (handled by caller)
19
+ * /, :q stubs — left to the caller
20
+ *
21
+ * The reducer keeps a pending prefix so multi-key motions like `dd`,
22
+ * `dw`, and `yy` work across two keystrokes.
23
+ */
24
+ export type VimMode = 'INSERT' | 'NORMAL';
25
+ export interface VimState {
26
+ mode: VimMode;
27
+ cursor: number;
28
+ pending: string;
29
+ register: string;
30
+ }
31
+ export declare function createVimState(): VimState;
32
+ export interface VimApplyResult {
33
+ value: string;
34
+ state: VimState;
35
+ handled: boolean;
36
+ exitRequested?: boolean;
37
+ }
38
+ /**
39
+ * Apply a single NORMAL-mode keystroke. Returns the new value + state.
40
+ * If the key didn't do anything NORMAL-mode understands, `handled=false`
41
+ * so the caller can decide whether to fall through.
42
+ */
43
+ export declare function applyVimKey(value: string, state: VimState, ch: string): VimApplyResult;
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Pure reducer for vim-style motions applied to a single-line text buffer.
3
+ *
4
+ * Keeping the state machine side-effect-free lets InputBox call it from
5
+ * its `useInput` handler with no React hooks or I/O. The buffer itself
6
+ * is a simple string; cursor is a character offset in `[0, value.length]`.
7
+ *
8
+ * Supported keys (subset):
9
+ * h / l move cursor one char left / right
10
+ * j / k move cursor one line up / down (single-line fallback = 0 / $)
11
+ * 0 / $ jump to line start / end
12
+ * w / b word jump (whitespace-delimited)
13
+ * x delete char under cursor
14
+ * dd delete entire line (clear buffer)
15
+ * dw delete to next word boundary
16
+ * yy yank (copy) whole line into register
17
+ * p paste register after cursor
18
+ * i return to INSERT mode (handled by caller)
19
+ * /, :q stubs — left to the caller
20
+ *
21
+ * The reducer keeps a pending prefix so multi-key motions like `dd`,
22
+ * `dw`, and `yy` work across two keystrokes.
23
+ */
24
+ export function createVimState() {
25
+ return { mode: 'INSERT', cursor: 0, pending: '', register: '' };
26
+ }
27
+ function nextWord(value, from) {
28
+ let i = from;
29
+ // Skip the current word.
30
+ while (i < value.length && /\S/.test(value[i] ?? ''))
31
+ i += 1;
32
+ // Skip whitespace to the next word.
33
+ while (i < value.length && /\s/.test(value[i] ?? ''))
34
+ i += 1;
35
+ return i;
36
+ }
37
+ function prevWord(value, from) {
38
+ let i = Math.max(0, from - 1);
39
+ while (i > 0 && /\s/.test(value[i] ?? ''))
40
+ i -= 1;
41
+ while (i > 0 && /\S/.test(value[i - 1] ?? ''))
42
+ i -= 1;
43
+ return i;
44
+ }
45
+ /**
46
+ * Apply a single NORMAL-mode keystroke. Returns the new value + state.
47
+ * If the key didn't do anything NORMAL-mode understands, `handled=false`
48
+ * so the caller can decide whether to fall through.
49
+ */
50
+ export function applyVimKey(value, state, ch) {
51
+ const pending = state.pending;
52
+ const clearPending = { ...state, pending: '' };
53
+ // Multi-key prefixes resolve first.
54
+ if (pending === 'd') {
55
+ if (ch === 'd') {
56
+ return {
57
+ value: '',
58
+ state: { ...clearPending, cursor: 0, register: value },
59
+ handled: true,
60
+ };
61
+ }
62
+ if (ch === 'w') {
63
+ const to = nextWord(value, state.cursor);
64
+ return {
65
+ value: value.slice(0, state.cursor) + value.slice(to),
66
+ state: { ...clearPending, register: value.slice(state.cursor, to) },
67
+ handled: true,
68
+ };
69
+ }
70
+ // Unknown d-prefix → abort.
71
+ return { value, state: clearPending, handled: true };
72
+ }
73
+ if (pending === 'y') {
74
+ if (ch === 'y') {
75
+ return { value, state: { ...clearPending, register: value }, handled: true };
76
+ }
77
+ return { value, state: clearPending, handled: true };
78
+ }
79
+ if (pending === ':') {
80
+ if (ch === 'q') {
81
+ return { value, state: clearPending, handled: true, exitRequested: true };
82
+ }
83
+ return { value, state: clearPending, handled: true };
84
+ }
85
+ switch (ch) {
86
+ case 'h':
87
+ return { value, state: { ...clearPending, cursor: Math.max(0, state.cursor - 1) }, handled: true };
88
+ case 'l':
89
+ return { value, state: { ...clearPending, cursor: Math.min(value.length, state.cursor + 1) }, handled: true };
90
+ case 'j':
91
+ case 'k':
92
+ // Single-line buffer: treat as no-op but still consume.
93
+ return { value, state: clearPending, handled: true };
94
+ case '0':
95
+ return { value, state: { ...clearPending, cursor: 0 }, handled: true };
96
+ case '$':
97
+ return { value, state: { ...clearPending, cursor: value.length }, handled: true };
98
+ case 'w':
99
+ return { value, state: { ...clearPending, cursor: nextWord(value, state.cursor) }, handled: true };
100
+ case 'b':
101
+ return { value, state: { ...clearPending, cursor: prevWord(value, state.cursor) }, handled: true };
102
+ case 'x': {
103
+ if (state.cursor >= value.length)
104
+ return { value, state: clearPending, handled: true };
105
+ const nv = value.slice(0, state.cursor) + value.slice(state.cursor + 1);
106
+ return {
107
+ value: nv,
108
+ state: { ...clearPending, cursor: Math.min(state.cursor, nv.length) },
109
+ handled: true,
110
+ };
111
+ }
112
+ case 'p': {
113
+ if (state.register === '')
114
+ return { value, state: clearPending, handled: true };
115
+ const nv = value.slice(0, state.cursor) + state.register + value.slice(state.cursor);
116
+ return {
117
+ value: nv,
118
+ state: { ...clearPending, cursor: state.cursor + state.register.length },
119
+ handled: true,
120
+ };
121
+ }
122
+ case 'd':
123
+ case 'y':
124
+ case ':':
125
+ return { value, state: { ...state, pending: ch }, handled: true };
126
+ case 'i':
127
+ return { value, state: { ...clearPending, mode: 'INSERT' }, handled: true };
128
+ case '/':
129
+ // Search stub — consume so it doesn't fall through to text input.
130
+ return { value, state: clearPending, handled: true };
131
+ default:
132
+ return { value, state: clearPending, handled: false };
133
+ }
134
+ }
135
+ //# sourceMappingURL=vim-bindings.js.map
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Public entry point for the Ink TUI.
3
+ *
4
+ * `runInkTUI(config)` mounts the Ink root and returns a promise that
5
+ * resolves when the user exits. Shape mirrors `runInteractive()` in
6
+ * ../../cli/interactive.ts so the CLI can swap renderers by flag.
7
+ */
8
+ import type { Message } from '../../kernel/types.js';
9
+ import type { ProviderRegistry } from '../../providers/index.js';
10
+ import type { ToolRegistry } from '../../tools/registry.js';
11
+ import type { SessionStore } from '../../context/session.js';
12
+ import type { DirghaConfig } from '../../cli/config.js';
13
+ export { App } from './App.js';
14
+ export { Logo } from './components/Logo.js';
15
+ export { StatusBar } from './components/StatusBar.js';
16
+ export { StreamingText } from './components/StreamingText.js';
17
+ export { ToolBox } from './components/ToolBox.js';
18
+ export { ThinkingBlock } from './components/ThinkingBlock.js';
19
+ export { InputBox } from './components/InputBox.js';
20
+ export { ModelPicker, type ModelEntry } from './components/ModelPicker.js';
21
+ export { HelpOverlay, type HelpSlashCommand } from './components/HelpOverlay.js';
22
+ export { AtFileComplete } from './components/AtFileComplete.js';
23
+ export { PasteCollapseView, detectPaste } from './components/PasteCollapse.js';
24
+ export { applyVimKey, createVimState, type VimMode, type VimState } from './components/vim-bindings.js';
25
+ import type { HelpSlashCommand, ModelEntry } from './index.js';
26
+ export interface RunInkTUIOptions {
27
+ registry: ToolRegistry;
28
+ providers: ProviderRegistry;
29
+ sessions: SessionStore;
30
+ config: DirghaConfig;
31
+ cwd: string;
32
+ systemPrompt?: string;
33
+ initialMessages?: Message[];
34
+ /** Slash command list forwarded to the help overlay. */
35
+ slashCommands?: HelpSlashCommand[];
36
+ /** Model catalogue forwarded to the model picker. */
37
+ models?: ModelEntry[];
38
+ }
39
+ export declare function runInkTUI(opts: RunInkTUIOptions): Promise<void>;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Public entry point for the Ink TUI.
3
+ *
4
+ * `runInkTUI(config)` mounts the Ink root and returns a promise that
5
+ * resolves when the user exits. Shape mirrors `runInteractive()` in
6
+ * ../../cli/interactive.ts so the CLI can swap renderers by flag.
7
+ */
8
+ import * as React from 'react';
9
+ import { render } from 'ink';
10
+ import { createEventStream } from '../../kernel/event-stream.js';
11
+ import { App } from './App.js';
12
+ export { App } from './App.js';
13
+ export { Logo } from './components/Logo.js';
14
+ export { StatusBar } from './components/StatusBar.js';
15
+ export { StreamingText } from './components/StreamingText.js';
16
+ export { ToolBox } from './components/ToolBox.js';
17
+ export { ThinkingBlock } from './components/ThinkingBlock.js';
18
+ export { InputBox } from './components/InputBox.js';
19
+ export { ModelPicker } from './components/ModelPicker.js';
20
+ export { HelpOverlay } from './components/HelpOverlay.js';
21
+ export { AtFileComplete } from './components/AtFileComplete.js';
22
+ export { PasteCollapseView, detectPaste } from './components/PasteCollapse.js';
23
+ export { applyVimKey, createVimState } from './components/vim-bindings.js';
24
+ export async function runInkTUI(opts) {
25
+ const events = createEventStream();
26
+ const element = React.createElement(App, {
27
+ events,
28
+ registry: opts.registry,
29
+ providers: opts.providers,
30
+ sessions: opts.sessions,
31
+ config: opts.config,
32
+ cwd: opts.cwd,
33
+ ...(opts.systemPrompt !== undefined ? { systemPrompt: opts.systemPrompt } : {}),
34
+ ...(opts.slashCommands !== undefined ? { slashCommands: opts.slashCommands } : {}),
35
+ ...(opts.models !== undefined ? { models: opts.models } : {}),
36
+ });
37
+ const instance = render(element, {
38
+ exitOnCtrlC: false,
39
+ });
40
+ try {
41
+ await instance.waitUntilExit();
42
+ }
43
+ finally {
44
+ events.close();
45
+ }
46
+ }
47
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,51 @@
1
+ /**
2
+ * useEventProjection: subscribes to the kernel EventStream and projects
3
+ * raw AgentEvents into the transcript records that App renders.
4
+ *
5
+ * Split out of App.tsx so the root component stays focused on layout.
6
+ * The projection rule set mirrors the v1 renderer: contiguous text
7
+ * deltas fold into a single TextSpan; thinking deltas into a
8
+ * ThinkingSpan; each tool invocation produces a ToolRecord that
9
+ * starts in 'running' and flips to 'done' or 'error' on exec_end.
10
+ */
11
+ import type { UsageTotal } from '../../kernel/types.js';
12
+ import type { EventStream } from '../../kernel/event-stream.js';
13
+ import type { ToolStatus } from './components/ToolBox.js';
14
+ export type TranscriptItem = {
15
+ kind: 'user';
16
+ id: string;
17
+ text: string;
18
+ } | {
19
+ kind: 'text';
20
+ id: string;
21
+ content: string;
22
+ } | {
23
+ kind: 'thinking';
24
+ id: string;
25
+ content: string;
26
+ } | {
27
+ kind: 'tool';
28
+ id: string;
29
+ name: string;
30
+ status: ToolStatus;
31
+ argSummary: string;
32
+ outputPreview: string;
33
+ startedAt: number;
34
+ durationMs?: number;
35
+ } | {
36
+ kind: 'error';
37
+ id: string;
38
+ message: string;
39
+ } | {
40
+ kind: 'notice';
41
+ id: string;
42
+ text: string;
43
+ };
44
+ export interface EventProjection {
45
+ liveItems: TranscriptItem[];
46
+ totals: UsageTotal;
47
+ commitLive: () => TranscriptItem[];
48
+ appendLive: (item: TranscriptItem) => void;
49
+ clear: () => void;
50
+ }
51
+ export declare function useEventProjection(events: EventStream): EventProjection;