dispach 0.1.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 (346) hide show
  1. package/README.md +596 -0
  2. package/dist/App-dxqm39zx.js +11 -0
  3. package/dist/App-dxqm39zx.js.map +25 -0
  4. package/dist/ConfigEditor-7v5nebvy.js +6 -0
  5. package/dist/ConfigEditor-7v5nebvy.js.map +11 -0
  6. package/dist/KeyProbe-vjhmdpx6.js +5 -0
  7. package/dist/KeyProbe-vjhmdpx6.js.map +11 -0
  8. package/dist/Picker-jxaesaxy.js +5 -0
  9. package/dist/Picker-jxaesaxy.js.map +10 -0
  10. package/dist/SessionPicker-z2t0p4b5.js +5 -0
  11. package/dist/SessionPicker-z2t0p4b5.js.map +11 -0
  12. package/dist/SkillBrowser-yyf2gy0q.js +5 -0
  13. package/dist/SkillBrowser-yyf2gy0q.js.map +11 -0
  14. package/dist/WizardApp-12ndxgqv.js +5 -0
  15. package/dist/WizardApp-12ndxgqv.js.map +13 -0
  16. package/dist/agents.d.ts +9 -0
  17. package/dist/agents.d.ts.map +1 -0
  18. package/dist/browse.d.ts +63 -0
  19. package/dist/browse.d.ts.map +1 -0
  20. package/dist/client.d.ts +25 -0
  21. package/dist/client.d.ts.map +1 -0
  22. package/dist/client.js +34 -0
  23. package/dist/client.js.map +11 -0
  24. package/dist/components/App.d.ts +28 -0
  25. package/dist/components/App.d.ts.map +1 -0
  26. package/dist/components/Banner.d.ts +16 -0
  27. package/dist/components/Banner.d.ts.map +1 -0
  28. package/dist/components/Brandmark.d.ts +31 -0
  29. package/dist/components/Brandmark.d.ts.map +1 -0
  30. package/dist/components/CheckList.d.ts +38 -0
  31. package/dist/components/CheckList.d.ts.map +1 -0
  32. package/dist/components/CommandOutput.d.ts +29 -0
  33. package/dist/components/CommandOutput.d.ts.map +1 -0
  34. package/dist/components/ConfigEditor.d.ts +64 -0
  35. package/dist/components/ConfigEditor.d.ts.map +1 -0
  36. package/dist/components/HistorySearch.d.ts +23 -0
  37. package/dist/components/HistorySearch.d.ts.map +1 -0
  38. package/dist/components/KeyProbe.d.ts +36 -0
  39. package/dist/components/KeyProbe.d.ts.map +1 -0
  40. package/dist/components/LineCursor.d.ts +55 -0
  41. package/dist/components/LineCursor.d.ts.map +1 -0
  42. package/dist/components/Live.d.ts +17 -0
  43. package/dist/components/Live.d.ts.map +1 -0
  44. package/dist/components/Palette.d.ts +21 -0
  45. package/dist/components/Palette.d.ts.map +1 -0
  46. package/dist/components/Picker.d.ts +23 -0
  47. package/dist/components/Picker.d.ts.map +1 -0
  48. package/dist/components/Prompt.d.ts +20 -0
  49. package/dist/components/Prompt.d.ts.map +1 -0
  50. package/dist/components/Screen.d.ts +39 -0
  51. package/dist/components/Screen.d.ts.map +1 -0
  52. package/dist/components/SelectList.d.ts +34 -0
  53. package/dist/components/SelectList.d.ts.map +1 -0
  54. package/dist/components/SessionPicker.d.ts +26 -0
  55. package/dist/components/SessionPicker.d.ts.map +1 -0
  56. package/dist/components/SkillBrowser.d.ts +39 -0
  57. package/dist/components/SkillBrowser.d.ts.map +1 -0
  58. package/dist/components/Spinner.d.ts +13 -0
  59. package/dist/components/Spinner.d.ts.map +1 -0
  60. package/dist/components/StatusBar.d.ts +11 -0
  61. package/dist/components/StatusBar.d.ts.map +1 -0
  62. package/dist/components/SummaryCard.d.ts +11 -0
  63. package/dist/components/SummaryCard.d.ts.map +1 -0
  64. package/dist/components/TextField.d.ts +39 -0
  65. package/dist/components/TextField.d.ts.map +1 -0
  66. package/dist/components/Transcript.d.ts +23 -0
  67. package/dist/components/Transcript.d.ts.map +1 -0
  68. package/dist/components/WizardApp.d.ts +18 -0
  69. package/dist/components/WizardApp.d.ts.map +1 -0
  70. package/dist/components/WizardFrame.d.ts +19 -0
  71. package/dist/components/WizardFrame.d.ts.map +1 -0
  72. package/dist/config-yz0nz51b.js +24 -0
  73. package/dist/config-yz0nz51b.js.map +10 -0
  74. package/dist/config.d.ts +71 -0
  75. package/dist/config.d.ts.map +1 -0
  76. package/dist/credential-wgt4gvcz.js +19 -0
  77. package/dist/credential-wgt4gvcz.js.map +10 -0
  78. package/dist/credential.d.ts +68 -0
  79. package/dist/credential.d.ts.map +1 -0
  80. package/dist/daemon.d.ts +47 -0
  81. package/dist/daemon.d.ts.map +1 -0
  82. package/dist/editor.d.ts +81 -0
  83. package/dist/editor.d.ts.map +1 -0
  84. package/dist/hooks/useElapsed.d.ts +10 -0
  85. package/dist/hooks/useElapsed.d.ts.map +1 -0
  86. package/dist/hooks/useTerminalSize.d.ts +14 -0
  87. package/dist/hooks/useTerminalSize.d.ts.map +1 -0
  88. package/dist/hooks/useTurn.d.ts +41 -0
  89. package/dist/hooks/useTurn.d.ts.map +1 -0
  90. package/dist/index-2cvtz0fy.js +903 -0
  91. package/dist/index-2cvtz0fy.js.map +194 -0
  92. package/dist/index-3nwfz9jq.js +12 -0
  93. package/dist/index-3nwfz9jq.js.map +11 -0
  94. package/dist/index-6b7qvh1x.js +6 -0
  95. package/dist/index-6b7qvh1x.js.map +10 -0
  96. package/dist/index-6z0yr17z.js +12 -0
  97. package/dist/index-6z0yr17z.js.map +11 -0
  98. package/dist/index-7da4fqcr.js +7 -0
  99. package/dist/index-7da4fqcr.js.map +11 -0
  100. package/dist/index-8bmhd2hj.js +6 -0
  101. package/dist/index-8bmhd2hj.js.map +10 -0
  102. package/dist/index-9d011p3q.js +6 -0
  103. package/dist/index-9d011p3q.js.map +10 -0
  104. package/dist/index-9f9pp2ef.js +6 -0
  105. package/dist/index-9f9pp2ef.js.map +10 -0
  106. package/dist/index-9nsfs0vy.js +6 -0
  107. package/dist/index-9nsfs0vy.js.map +10 -0
  108. package/dist/index-9pj1ws0p.js +77 -0
  109. package/dist/index-9pj1ws0p.js.map +12 -0
  110. package/dist/index-b5wwtxzk.js +66 -0
  111. package/dist/index-b5wwtxzk.js.map +12 -0
  112. package/dist/index-b8zwg8a3.js +6 -0
  113. package/dist/index-b8zwg8a3.js.map +10 -0
  114. package/dist/index-bry9bzt3.js +427 -0
  115. package/dist/index-bry9bzt3.js.map +11 -0
  116. package/dist/index-bwckzbf8.js +6 -0
  117. package/dist/index-bwckzbf8.js.map +10 -0
  118. package/dist/index-cx3vz7sf.js +6 -0
  119. package/dist/index-cx3vz7sf.js.map +11 -0
  120. package/dist/index-e8n70sgj.js +6 -0
  121. package/dist/index-e8n70sgj.js.map +11 -0
  122. package/dist/index-fvhg0xyd.js +167 -0
  123. package/dist/index-fvhg0xyd.js.map +19 -0
  124. package/dist/index-gbnc99j8.js +14 -0
  125. package/dist/index-gbnc99j8.js.map +13 -0
  126. package/dist/index-h2yds678.js +7 -0
  127. package/dist/index-h2yds678.js.map +11 -0
  128. package/dist/index-j97vttdt.js +10 -0
  129. package/dist/index-j97vttdt.js.map +10 -0
  130. package/dist/index-jk0def33.js +6 -0
  131. package/dist/index-jk0def33.js.map +12 -0
  132. package/dist/index-jym27m75.js +6 -0
  133. package/dist/index-jym27m75.js.map +10 -0
  134. package/dist/index-mgdgx22q.js +10 -0
  135. package/dist/index-mgdgx22q.js.map +10 -0
  136. package/dist/index-mrtb5y08.js +6 -0
  137. package/dist/index-mrtb5y08.js.map +11 -0
  138. package/dist/index-my5cjx00.js +6 -0
  139. package/dist/index-my5cjx00.js.map +10 -0
  140. package/dist/index-qc2vrq9z.js +7 -0
  141. package/dist/index-qc2vrq9z.js.map +11 -0
  142. package/dist/index-rqbtm761.js +6 -0
  143. package/dist/index-rqbtm761.js.map +10 -0
  144. package/dist/index-rqzg861g.js +6 -0
  145. package/dist/index-rqzg861g.js.map +10 -0
  146. package/dist/index-t1xvacym.js +6 -0
  147. package/dist/index-t1xvacym.js.map +11 -0
  148. package/dist/index-xgqzk5cq.js +9 -0
  149. package/dist/index-xgqzk5cq.js.map +12 -0
  150. package/dist/index-xqyms08r.js +6 -0
  151. package/dist/index-xqyms08r.js.map +10 -0
  152. package/dist/index-yr25dnf5.js +6 -0
  153. package/dist/index-yr25dnf5.js.map +10 -0
  154. package/dist/index.d.ts +23 -0
  155. package/dist/index.d.ts.map +1 -0
  156. package/dist/index.js +527 -0
  157. package/dist/index.js.map +48 -0
  158. package/dist/init.d.ts +34 -0
  159. package/dist/init.d.ts.map +1 -0
  160. package/dist/keymap.d.ts +126 -0
  161. package/dist/keymap.d.ts.map +1 -0
  162. package/dist/keys.d.ts +17 -0
  163. package/dist/keys.d.ts.map +1 -0
  164. package/dist/lib/ambient.d.ts +69 -0
  165. package/dist/lib/ambient.d.ts.map +1 -0
  166. package/dist/lib/args.d.ts +33 -0
  167. package/dist/lib/args.d.ts.map +1 -0
  168. package/dist/lib/bootstrap.d.ts +84 -0
  169. package/dist/lib/bootstrap.d.ts.map +1 -0
  170. package/dist/lib/browse.d.ts +89 -0
  171. package/dist/lib/browse.d.ts.map +1 -0
  172. package/dist/lib/browser.d.ts +55 -0
  173. package/dist/lib/browser.d.ts.map +1 -0
  174. package/dist/lib/chat-frame.d.ts +156 -0
  175. package/dist/lib/chat-frame.d.ts.map +1 -0
  176. package/dist/lib/clipboard.d.ts +32 -0
  177. package/dist/lib/clipboard.d.ts.map +1 -0
  178. package/dist/lib/commands.d.ts +26 -0
  179. package/dist/lib/commands.d.ts.map +1 -0
  180. package/dist/lib/composer.d.ts +85 -0
  181. package/dist/lib/composer.d.ts.map +1 -0
  182. package/dist/lib/config-apply.d.ts +51 -0
  183. package/dist/lib/config-apply.d.ts.map +1 -0
  184. package/dist/lib/config-editor.d.ts +113 -0
  185. package/dist/lib/config-editor.d.ts.map +1 -0
  186. package/dist/lib/config-env.d.ts +110 -0
  187. package/dist/lib/config-env.d.ts.map +1 -0
  188. package/dist/lib/config-rows.d.ts +37 -0
  189. package/dist/lib/config-rows.d.ts.map +1 -0
  190. package/dist/lib/config-view.d.ts +133 -0
  191. package/dist/lib/config-view.d.ts.map +1 -0
  192. package/dist/lib/confirm.d.ts +86 -0
  193. package/dist/lib/confirm.d.ts.map +1 -0
  194. package/dist/lib/const.d.ts +213 -0
  195. package/dist/lib/const.d.ts.map +1 -0
  196. package/dist/lib/csi.d.ts +70 -0
  197. package/dist/lib/csi.d.ts.map +1 -0
  198. package/dist/lib/curated.d.ts +44 -0
  199. package/dist/lib/curated.d.ts.map +1 -0
  200. package/dist/lib/daemon-plan.d.ts +151 -0
  201. package/dist/lib/daemon-plan.d.ts.map +1 -0
  202. package/dist/lib/dotenv-edit.d.ts +30 -0
  203. package/dist/lib/dotenv-edit.d.ts.map +1 -0
  204. package/dist/lib/env.d.ts +10 -0
  205. package/dist/lib/env.d.ts.map +1 -0
  206. package/dist/lib/exit.d.ts +170 -0
  207. package/dist/lib/exit.d.ts.map +1 -0
  208. package/dist/lib/help.d.ts +10 -0
  209. package/dist/lib/help.d.ts.map +1 -0
  210. package/dist/lib/init-flow.d.ts +539 -0
  211. package/dist/lib/init-flow.d.ts.map +1 -0
  212. package/dist/lib/init-skills.d.ts +46 -0
  213. package/dist/lib/init-skills.d.ts.map +1 -0
  214. package/dist/lib/keyboard.d.ts +76 -0
  215. package/dist/lib/keyboard.d.ts.map +1 -0
  216. package/dist/lib/keys-view.d.ts +57 -0
  217. package/dist/lib/keys-view.d.ts.map +1 -0
  218. package/dist/lib/launchd.d.ts +151 -0
  219. package/dist/lib/launchd.d.ts.map +1 -0
  220. package/dist/lib/lifecycle.d.ts +126 -0
  221. package/dist/lib/lifecycle.d.ts.map +1 -0
  222. package/dist/lib/log-follow.d.ts +71 -0
  223. package/dist/lib/log-follow.d.ts.map +1 -0
  224. package/dist/lib/mouse.d.ts +84 -0
  225. package/dist/lib/mouse.d.ts.map +1 -0
  226. package/dist/lib/multiselect.d.ts +37 -0
  227. package/dist/lib/multiselect.d.ts.map +1 -0
  228. package/dist/lib/origins.d.ts +40 -0
  229. package/dist/lib/origins.d.ts.map +1 -0
  230. package/dist/lib/output.d.ts +29 -0
  231. package/dist/lib/output.d.ts.map +1 -0
  232. package/dist/lib/palette.d.ts +69 -0
  233. package/dist/lib/palette.d.ts.map +1 -0
  234. package/dist/lib/probe.d.ts +158 -0
  235. package/dist/lib/probe.d.ts.map +1 -0
  236. package/dist/lib/providers.d.ts +63 -0
  237. package/dist/lib/providers.d.ts.map +1 -0
  238. package/dist/lib/provision.d.ts +163 -0
  239. package/dist/lib/provision.d.ts.map +1 -0
  240. package/dist/lib/remove-plan.d.ts +120 -0
  241. package/dist/lib/remove-plan.d.ts.map +1 -0
  242. package/dist/lib/render.d.ts +78 -0
  243. package/dist/lib/render.d.ts.map +1 -0
  244. package/dist/lib/resume.d.ts +69 -0
  245. package/dist/lib/resume.d.ts.map +1 -0
  246. package/dist/lib/rows.d.ts +69 -0
  247. package/dist/lib/rows.d.ts.map +1 -0
  248. package/dist/lib/sandbox.d.ts +101 -0
  249. package/dist/lib/sandbox.d.ts.map +1 -0
  250. package/dist/lib/schema.d.ts +491 -0
  251. package/dist/lib/schema.d.ts.map +1 -0
  252. package/dist/lib/screen.d.ts +102 -0
  253. package/dist/lib/screen.d.ts.map +1 -0
  254. package/dist/lib/scroll.d.ts +64 -0
  255. package/dist/lib/scroll.d.ts.map +1 -0
  256. package/dist/lib/select.d.ts +23 -0
  257. package/dist/lib/select.d.ts.map +1 -0
  258. package/dist/lib/service-env.d.ts +38 -0
  259. package/dist/lib/service-env.d.ts.map +1 -0
  260. package/dist/lib/service.d.ts +102 -0
  261. package/dist/lib/service.d.ts.map +1 -0
  262. package/dist/lib/session-commands.d.ts +229 -0
  263. package/dist/lib/session-commands.d.ts.map +1 -0
  264. package/dist/lib/session-key.d.ts +55 -0
  265. package/dist/lib/session-key.d.ts.map +1 -0
  266. package/dist/lib/sessions-view.d.ts +31 -0
  267. package/dist/lib/sessions-view.d.ts.map +1 -0
  268. package/dist/lib/source-cache.d.ts +105 -0
  269. package/dist/lib/source-cache.d.ts.map +1 -0
  270. package/dist/lib/source.d.ts +281 -0
  271. package/dist/lib/source.d.ts.map +1 -0
  272. package/dist/lib/sources.d.ts +107 -0
  273. package/dist/lib/sources.d.ts.map +1 -0
  274. package/dist/lib/spawn.d.ts +56 -0
  275. package/dist/lib/spawn.d.ts.map +1 -0
  276. package/dist/lib/stdin-tap.d.ts +41 -0
  277. package/dist/lib/stdin-tap.d.ts.map +1 -0
  278. package/dist/lib/subcommand.d.ts +57 -0
  279. package/dist/lib/subcommand.d.ts.map +1 -0
  280. package/dist/lib/systemd.d.ts +60 -0
  281. package/dist/lib/systemd.d.ts.map +1 -0
  282. package/dist/lib/templates.d.ts +35 -0
  283. package/dist/lib/templates.d.ts.map +1 -0
  284. package/dist/lib/terminal.d.ts +98 -0
  285. package/dist/lib/terminal.d.ts.map +1 -0
  286. package/dist/lib/text-selection.d.ts +75 -0
  287. package/dist/lib/text-selection.d.ts.map +1 -0
  288. package/dist/lib/theme.d.ts +90 -0
  289. package/dist/lib/theme.d.ts.map +1 -0
  290. package/dist/lib/types.d.ts +467 -0
  291. package/dist/lib/types.d.ts.map +1 -0
  292. package/dist/lib/warnings.d.ts +79 -0
  293. package/dist/lib/warnings.d.ts.map +1 -0
  294. package/dist/lib/width.d.ts +39 -0
  295. package/dist/lib/width.d.ts.map +1 -0
  296. package/dist/lib/wizard.d.ts +95 -0
  297. package/dist/lib/wizard.d.ts.map +1 -0
  298. package/dist/lib/wordmark.d.ts +60 -0
  299. package/dist/lib/wordmark.d.ts.map +1 -0
  300. package/dist/lib/wrap.d.ts +74 -0
  301. package/dist/lib/wrap.d.ts.map +1 -0
  302. package/dist/memory.d.ts +25 -0
  303. package/dist/memory.d.ts.map +1 -0
  304. package/dist/model.d.ts +47 -0
  305. package/dist/model.d.ts.map +1 -0
  306. package/dist/plugins.d.ts +15 -0
  307. package/dist/plugins.d.ts.map +1 -0
  308. package/dist/remove.d.ts +52 -0
  309. package/dist/remove.d.ts.map +1 -0
  310. package/dist/run.d.ts +42 -0
  311. package/dist/run.d.ts.map +1 -0
  312. package/dist/schedules.d.ts +41 -0
  313. package/dist/schedules.d.ts.map +1 -0
  314. package/dist/serve.d.ts +41 -0
  315. package/dist/serve.d.ts.map +1 -0
  316. package/dist/sessions.d.ts +13 -0
  317. package/dist/sessions.d.ts.map +1 -0
  318. package/dist/skills.d.ts +80 -0
  319. package/dist/skills.d.ts.map +1 -0
  320. package/dist/soul.d.ts +19 -0
  321. package/dist/soul.d.ts.map +1 -0
  322. package/dist/sources.d.ts +32 -0
  323. package/dist/sources.d.ts.map +1 -0
  324. package/dist/start.d.ts +26 -0
  325. package/dist/start.d.ts.map +1 -0
  326. package/dist/stop.d.ts +58 -0
  327. package/dist/stop.d.ts.map +1 -0
  328. package/dist/terminal-setup.d.ts +31 -0
  329. package/dist/terminal-setup.d.ts.map +1 -0
  330. package/dist/tools.d.ts +22 -0
  331. package/dist/tools.d.ts.map +1 -0
  332. package/dist/transcript.d.ts +124 -0
  333. package/dist/transcript.d.ts.map +1 -0
  334. package/dist/validate.d.ts +36 -0
  335. package/dist/validate.d.ts.map +1 -0
  336. package/dist/web-w7r68df1.js +14 -0
  337. package/dist/web-w7r68df1.js.map +11 -0
  338. package/dist/web.d.ts +36 -0
  339. package/dist/web.d.ts.map +1 -0
  340. package/dist/wire.d.ts +10 -0
  341. package/dist/wire.d.ts.map +1 -0
  342. package/dist/wire.js +33 -0
  343. package/dist/wire.js.map +10 -0
  344. package/dist/workspace.d.ts +19 -0
  345. package/dist/workspace.d.ts.map +1 -0
  346. package/package.json +78 -0
@@ -0,0 +1,467 @@
1
+ /**
2
+ * Domain shapes.
3
+ *
4
+ * The split follows termheat's rule: `types.ts` owns the shapes the CLI reasons *about*, and the
5
+ * modules beside it own the logic. `schema.ts` owns the contracts between modules — parser output,
6
+ * command options, component props.
7
+ */
8
+ /**
9
+ * How output is rendered.
10
+ *
11
+ * - `json` — one machine-readable document on stdout and nothing else.
12
+ * - `plain` — line-oriented text, no ANSI, no cursor movement. Safe to pipe, log, or diff.
13
+ * - `rich` — the Ink app: live transcript, status bar, input line.
14
+ */
15
+ export type RenderMode = "json" | "plain" | "rich";
16
+ /** What the environment says about how much rendering is welcome. */
17
+ export interface EnvFacts {
18
+ readonly noColor: boolean;
19
+ readonly dumbTerminal: boolean;
20
+ readonly ci: boolean;
21
+ readonly debug: boolean;
22
+ /** Sandbox root override (`<ENVPREFIX>HOME`). Tests point it at a tmpdir, never real HOME. */
23
+ readonly sandboxHome: string | undefined;
24
+ /**
25
+ * `<ENVPREFIX>NO_CSI_U` — do not negotiate the kitty keyboard protocol.
26
+ *
27
+ * The hatch for a terminal that answers the protocol query and then implements it badly. `mode:
28
+ * "auto"` already covers a terminal that stays silent, so this is not for "might not work" — it is
29
+ * for "answers and is worse", which no amount of detection can tell apart from "answers and works".
30
+ */
31
+ readonly noEnhancedKeys: boolean;
32
+ }
33
+ export type TranscriptRole = "user" | "assistant" | "reasoning" | "note" | "error" | "tool"
34
+ /**
35
+ * The opening banner, exactly one and always first. Its own role because the rich renderer gives
36
+ * it the screen's first rows and its own emphasis.
37
+ */
38
+ | "banner";
39
+ /**
40
+ * A finished line of conversation.
41
+ *
42
+ * Immutable once created, which is not a style preference: finished items render inside Ink's
43
+ * `<Static>`, which writes a node to the terminal once and never touches it again. Mutating one
44
+ * would change a value the renderer will never look at, so the change would silently not appear.
45
+ */
46
+ export interface TranscriptItem {
47
+ /** Stable and unique. React keys off it, and a reused key drops a line. */
48
+ readonly id: string;
49
+ readonly role: TranscriptRole;
50
+ readonly text: string;
51
+ /** Present on a completed assistant reply. */
52
+ readonly stats?: TurnStats;
53
+ /**
54
+ * The call this row is about, for a `tool` row only.
55
+ *
56
+ * A tool used to occupy two items: one appended when the call started and a second when it
57
+ * returned, because `<Static>` had already written the first and editing a written node silently
58
+ * does nothing. `<Static>` went in Phase 5.5 and the transcript became a buffer this code owns, so
59
+ * the row is now *completed* — four rows per call became one. The id is what pairs them: calls can
60
+ * overlap, so "the last tool row" is not the row a result belongs to.
61
+ */
62
+ readonly callId?: string;
63
+ /** A tool row still waiting for its result. Drawn as running rather than as finished. */
64
+ readonly pending?: boolean;
65
+ }
66
+ /**
67
+ * One drawn line of the finished conversation.
68
+ *
69
+ * The transcript is windowed rather than written once, so its unit is a row on screen instead of a
70
+ * message: an offset counting items would page over a forty-row reply in a single keystroke. Wrapping
71
+ * has already happened — `text` is exactly what is painted, prefix and indent included — which is what
72
+ * makes the row count the scroll layer works in the row count the terminal shows.
73
+ */
74
+ export interface TranscriptRow {
75
+ /** Stable per item and per row within it. React keys off it; two identical replies are two rows. */
76
+ readonly key: string;
77
+ readonly role: TranscriptRole;
78
+ readonly text: string;
79
+ readonly dim?: boolean;
80
+ readonly bold?: boolean;
81
+ /**
82
+ * Columns of `text` that are the role prefix or its hanging indent.
83
+ *
84
+ * A selection may not include them and a copy must not contain them: `› ` and ` · ` are chrome this
85
+ * renderer added, not something anybody wrote. The reference CLI marks the same cells `noSelect` for
86
+ * the same reason. Rendering already knows the number — it builds the row from it — so carrying it is
87
+ * cheaper and safer than a consumer re-deriving it from the role.
88
+ */
89
+ readonly lead: number;
90
+ /**
91
+ * This row continues the row above rather than starting a new logical line.
92
+ *
93
+ * What rejoins a wrapped paragraph on copy. Known here by construction — `transcriptRows` wraps the
94
+ * text and therefore knows which rows it invented — and *not* recoverable afterwards: a row's text is
95
+ * not a slice of its source, so nothing downstream can tell a wrap from a real newline.
96
+ */
97
+ readonly continuation: boolean;
98
+ }
99
+ export interface TurnStats {
100
+ readonly promptTokens: number;
101
+ readonly outputTokens: number;
102
+ readonly durationMs: number;
103
+ readonly steps: number;
104
+ /** `final` is the only clean ending. The rest are reported as themselves, never as success. */
105
+ readonly reason: string;
106
+ }
107
+ /** The turn in flight. Everything here is still moving, so none of it belongs in `<Static>`. */
108
+ export interface LiveTurn {
109
+ readonly text: string;
110
+ readonly reasoning: string;
111
+ /** Which stream produced the most recent delta, so a view can label a switch. */
112
+ readonly last: "text" | "reasoning" | undefined;
113
+ }
114
+ /** `working` is a tool running: the model is not producing tokens, so `streaming` would mislead. */
115
+ export type TurnStatus = "idle" | "thinking" | "streaming" | "working" | "cancelling";
116
+ export interface TranscriptState {
117
+ /**
118
+ * The finished conversation, in the order it happened.
119
+ *
120
+ * Append-mostly rather than append-only, and the two exceptions are deliberate: a `tool` row is
121
+ * completed by its own result, and a turn's statistics are attached to the reply they belong to. Both
122
+ * were impossible while this lived in `<Static>`, which is why each used to cost an extra row.
123
+ */
124
+ readonly items: readonly TranscriptItem[];
125
+ readonly live: LiveTurn | undefined;
126
+ readonly status: TurnStatus;
127
+ /** Monotonic id source. Kept in state so the reducer needs no clock and no randomness. */
128
+ readonly nextId: number;
129
+ /**
130
+ * Index into `items` where the current turn began, so `turn.end` can find the reply it is about.
131
+ *
132
+ * Needed because a reply is committed at each step boundary rather than once at the end, and the
133
+ * statistics arrive after all of them. Searching backwards without a floor would attach a turn's cost
134
+ * to the previous turn's reply on any turn that produced no text of its own.
135
+ *
136
+ * Required and explicitly `undefined` between turns, the way `live` is: an optional property under
137
+ * `exactOptionalPropertyTypes` cannot be *cleared*, only omitted, and a field a reducer has to clear
138
+ * on every turn boundary is the wrong shape for that.
139
+ */
140
+ readonly turnFrom: number | undefined;
141
+ /**
142
+ * How full the prompt was on the most recent step, as a fraction of the budget.
143
+ *
144
+ * On the status line rather than in the transcript because it is a gauge, not an event: it changes
145
+ * every step and a reader wants the current value, never the history of it. The stages that
146
+ * *destroy* detail — collapse and reset — do get transcript notes, because those are events and a
147
+ * person who was not watching the gauge still needs to know their conversation was summarised.
148
+ */
149
+ readonly pressure?: number;
150
+ /**
151
+ * The phase the session is in, once something has moved it.
152
+ *
153
+ * Absent until the first `phase.changed`, deliberately: the entry phase is not an event and putting
154
+ * it here would mean the reducer inventing a fact it was never told. What a reader needs is *that it
155
+ * changed* and what to now — which is exactly what the event carries.
156
+ */
157
+ readonly phase?: string;
158
+ }
159
+ /**
160
+ * The subset of Ink's `Key` this CLI acts on.
161
+ *
162
+ * Declared here rather than imported from Ink so that `keymap.ts` and `editor.ts` stay free of the
163
+ * rich-path dependency — they are the two modules most worth unit-testing, and importing Ink would
164
+ * cost every plain-path invocation ~170 ms under Node. Ink's own `Key` satisfies this structurally.
165
+ */
166
+ export interface KeyState {
167
+ readonly upArrow: boolean;
168
+ readonly downArrow: boolean;
169
+ readonly leftArrow: boolean;
170
+ readonly rightArrow: boolean;
171
+ /**
172
+ * Page keys. Ink has always reported these; nothing asked for them until the transcript stopped
173
+ * being the terminal's scrollback and became a buffer with a window over it.
174
+ */
175
+ readonly pageUp: boolean;
176
+ readonly pageDown: boolean;
177
+ readonly return: boolean;
178
+ readonly escape: boolean;
179
+ readonly ctrl: boolean;
180
+ readonly shift: boolean;
181
+ readonly tab: boolean;
182
+ readonly backspace: boolean;
183
+ readonly delete: boolean;
184
+ readonly meta: boolean;
185
+ /**
186
+ * Home and End. Ink has reported these since 7.0 and this type never declared them, so they were
187
+ * parsed on the way in and dropped on the floor: both keys did nothing at all, in every surface,
188
+ * for as long as the CLI has existed. Nothing to negotiate and nothing to configure — a missing
189
+ * field, and the cheapest fix on the whole keyboard.
190
+ */
191
+ readonly home: boolean;
192
+ readonly end: boolean;
193
+ /**
194
+ * Cmd on macOS, Win elsewhere — and **only ever true under the kitty keyboard protocol**.
195
+ *
196
+ * No legacy escape sequence can express it. Worse, Ink's legacy path folds it into `meta`
197
+ * (`key.meta = key.meta || !!(modifier & 10)`, where bit 8 is super and bit 2 is alt), so without
198
+ * the protocol `cmd+←` is indistinguishable from `⌥←` and silently word-moves. Negotiating the
199
+ * protocol is what separates them; `mode: "auto"` means this is simply `false` where it cannot be
200
+ * known, which is the honest value rather than a guess.
201
+ */
202
+ readonly super: boolean;
203
+ /**
204
+ * Press, repeat, or release — and `release` must be dropped before anything acts on the key.
205
+ *
206
+ * `reportEventTypes` is what makes an arrow-with-modifier parse through Ink's kitty branch rather
207
+ * than its legacy one, which is the only way `super` survives on an arrow key. The cost is that
208
+ * Ink passes the event type straight through (`use-input.js:63`) and filters nothing, so every
209
+ * enhanced key would otherwise fire twice: once down, once up. Optional because a terminal that
210
+ * never negotiated the protocol reports no event type at all.
211
+ */
212
+ readonly eventType?: "press" | "repeat" | "release";
213
+ }
214
+ /**
215
+ * A move of a scrolling window: a row, a page, or an end.
216
+ *
217
+ * Here rather than in `lib/scroll.ts` because it is a shape the keymap produces and the reducer
218
+ * consumes, and neither should have to import the other — the same reason `KeyState` is declared here
219
+ * rather than imported from Ink.
220
+ */
221
+ export type ScrollMove = "up" | "down" | "pageUp" | "pageDown" | "top" | "bottom";
222
+ /**
223
+ * The intents that only move the cursor.
224
+ *
225
+ * A subset of `Intent["kind"]` written out rather than derived, because it is the set `extend` may carry
226
+ * and that is a smaller claim than "every intent with no payload". Deriving it would silently admit the
227
+ * next payload-free intent — `undo`, say — into a shift chord.
228
+ */
229
+ export type MotionKind = "cursorLeft" | "cursorRight" | "cursorHome" | "cursorEnd" | "wordLeft" | "wordRight" | "lineUp" | "lineDown" | "bufferStart" | "bufferEnd";
230
+ export type Intent = {
231
+ readonly kind: "submit";
232
+ }
233
+ /** Ctrl-C while a turn is running: cancel the turn, keep the process. */
234
+ | {
235
+ readonly kind: "cancel";
236
+ }
237
+ /** Ctrl-C at an idle prompt, or Ctrl-D. */
238
+ | {
239
+ readonly kind: "exit";
240
+ }
241
+ /**
242
+ * A first Ctrl-C at an idle prompt: say what a second one will do, and do nothing else.
243
+ *
244
+ * An intent rather than a component detail, because it is the same decision `cancel` and `exit` are —
245
+ * what one keystroke means given what the session is doing — and the three have to be decided
246
+ * together or the chord that cancels a turn becomes the chord that ends the session a moment later.
247
+ */
248
+ | {
249
+ readonly kind: "arm";
250
+ }
251
+ /**
252
+ * Move the transcript window. The buffer is ours now, so its scrolling is a keystroke away.
253
+ *
254
+ * `times` is for the wheel, which arrives as a count rather than as one event: a chunk can hold
255
+ * several notches, and honouring one of them makes a flick of the wheel move a single row.
256
+ */
257
+ | {
258
+ readonly kind: "scroll";
259
+ readonly move: ScrollMove;
260
+ readonly times?: number;
261
+ }
262
+ /**
263
+ * Show reasoning blocks whole rather than folded to a count.
264
+ *
265
+ * A view state, not an edit, and deliberately session-wide rather than per block: a cursor that walked
266
+ * the transcript to pick one would be a second focus to reason about on a surface where the composer
267
+ * already owns the keyboard. Folding is what makes the reply findable; this is the way to read past it.
268
+ */
269
+ | {
270
+ readonly kind: "reasoning";
271
+ } | {
272
+ readonly kind: "insert";
273
+ readonly text: string;
274
+ }
275
+ /**
276
+ * Text arriving as one chunk with newlines in it — a paste, or a here-doc fed to the process.
277
+ *
278
+ * It cannot be an `insert`: the newlines are control characters, and stripping them silently
279
+ * runs the words together. It cannot be a `submit` either, because one chunk can carry several
280
+ * finished lines. So the segments travel intact and the caller decides: every finished line is
281
+ * submitted in order, and an unterminated tail stays on the input line.
282
+ */
283
+ | {
284
+ readonly kind: "paste";
285
+ readonly lines: readonly string[];
286
+ readonly complete: boolean;
287
+ } | {
288
+ readonly kind: "backspace";
289
+ } | {
290
+ readonly kind: "delete";
291
+ } | {
292
+ readonly kind: "cursorLeft";
293
+ } | {
294
+ readonly kind: "cursorRight";
295
+ } | {
296
+ readonly kind: "cursorHome";
297
+ } | {
298
+ readonly kind: "cursorEnd";
299
+ }
300
+ /**
301
+ * The ends of the whole buffer, not of a line — `cmd+↑`/`cmd+↓`.
302
+ *
303
+ * Distinct from `cursorHome`/`cursorEnd` because a message can have many lines and macOS binds both
304
+ * pairs: cmd with a horizontal arrow is the line, cmd with a vertical one is the document. Collapsing
305
+ * them would make one of the two chords silently mean the other.
306
+ */
307
+ | {
308
+ readonly kind: "bufferStart";
309
+ } | {
310
+ readonly kind: "bufferEnd";
311
+ }
312
+ /**
313
+ * A motion that moves the cursor and leaves the anchor, which is what selecting *is*.
314
+ *
315
+ * One intent carrying a motion rather than a shifted twin of every motion: ten motions would have
316
+ * become twenty intents and twenty reducer cases, and the second ten would have been the first ten
317
+ * plus one line each. The keymap decides that shift means extend; the reducer reuses the motion it
318
+ * already implements, so a selection can never disagree with the plain move about where it lands.
319
+ */
320
+ | {
321
+ readonly kind: "extend";
322
+ readonly to: MotionKind;
323
+ } | {
324
+ readonly kind: "selectAll";
325
+ }
326
+ /**
327
+ * Copy or cut what is selected in the message.
328
+ *
329
+ * Separate intents rather than one with a flag, because only one of them edits the line — and the
330
+ * reducer's job is the edit. The clipboard write is the caller's, the same split `submit` already has.
331
+ */
332
+ | {
333
+ readonly kind: "copySelection";
334
+ } | {
335
+ readonly kind: "cutSelection";
336
+ }
337
+ /**
338
+ * A mouse gesture that is not the wheel, with where it happened.
339
+ *
340
+ * The keymap cannot resolve this on its own: turning a screen cell into a row of the conversation needs
341
+ * the frame's geometry, and the keymap is pure and has none. So it reports the gesture and the caller
342
+ * with the layout decides what it selects — the same split as `scroll`, which the keymap names and the
343
+ * component applies.
344
+ */
345
+ | {
346
+ readonly kind: "pointer";
347
+ readonly gesture: "press" | "drag" | "release";
348
+ readonly column: number;
349
+ readonly row: number;
350
+ readonly shift: boolean;
351
+ } | {
352
+ readonly kind: "historyPrev";
353
+ } | {
354
+ readonly kind: "historyNext";
355
+ } | {
356
+ readonly kind: "killToStart";
357
+ } | {
358
+ readonly kind: "killToEnd";
359
+ } | {
360
+ readonly kind: "killWord";
361
+ }
362
+ /** A line break inside the message — ⌥⏎, shift+⏎ where the terminal can send it, or `\` then ⏎. */
363
+ | {
364
+ readonly kind: "newline";
365
+ }
366
+ /**
367
+ * Word-wise motion and deletion — ⌥← ⌥→ ⌥⌫ ⌥d.
368
+ *
369
+ * `killWord` is the backward one and predates these; it keeps its name because `^W` is documented
370
+ * under it and renaming a chord's intent to make a set look tidy is churn a reader pays for.
371
+ */
372
+ | {
373
+ readonly kind: "wordLeft";
374
+ } | {
375
+ readonly kind: "wordRight";
376
+ } | {
377
+ readonly kind: "killWordForward";
378
+ }
379
+ /**
380
+ * Cursor up or down a line, column preserved.
381
+ *
382
+ * Distinct from `historyPrev`/`historyNext`: which one an arrow means depends on whether the cursor
383
+ * is on the first or last line, and that decision lives in `keyToIntent` with the rest of the
384
+ * keyboard rather than being re-derived per renderer.
385
+ */
386
+ | {
387
+ readonly kind: "lineUp";
388
+ } | {
389
+ readonly kind: "lineDown";
390
+ } | {
391
+ readonly kind: "undo";
392
+ } | {
393
+ readonly kind: "redo";
394
+ }
395
+ /** `^R`. While it is open, `insert`, `backspace` and the history intents act on the query. */
396
+ | {
397
+ readonly kind: "searchOpen";
398
+ }
399
+ /** Put the highlighted match on the line and close. */
400
+ | {
401
+ readonly kind: "searchAccept";
402
+ }
403
+ /** Close and leave the line exactly as it was. */
404
+ | {
405
+ readonly kind: "searchCancel";
406
+ } | {
407
+ readonly kind: "none";
408
+ };
409
+ /** A point the editor can be returned to. Value and cursor together, or undo puts the caret nowhere. */
410
+ export interface EditorSnapshot {
411
+ readonly value: string;
412
+ readonly cursor: number;
413
+ }
414
+ /**
415
+ * Reverse history search, while it is open.
416
+ *
417
+ * A *mode*: with this set, a printable key extends the query rather than the line, and the arrows walk
418
+ * matches rather than the buffer. Modes are worth avoiding in general and this one earns itself — the
419
+ * alternative is a second editor for the query, and that second editor then needs its own cursor,
420
+ * history and undo, none of which a search box wants.
421
+ *
422
+ * `index` counts from the newest match. The line itself is untouched until the search is accepted, so
423
+ * cancelling costs nothing.
424
+ */
425
+ export interface EditorSearch {
426
+ readonly query: string;
427
+ readonly index: number;
428
+ }
429
+ export interface EditorState {
430
+ /**
431
+ * The buffer. May contain newlines: a message is composed, not typed on one line.
432
+ *
433
+ * A flat string rather than an array of lines. Every operation here already walks code points —
434
+ * `"👍".length` is 2, so a cursor counted in string indices lands inside a surrogate pair — and a
435
+ * line array would need that walk *plus* a two-part cursor, doubling the arithmetic that already
436
+ * had to be right. `\n` is one code point; the line helpers derive bounds when they need them.
437
+ */
438
+ readonly value: string;
439
+ /** Index into `value` in code points, 0..length. */
440
+ readonly cursor: number;
441
+ /** Newest last. Submitting appends; the arrows walk it. */
442
+ readonly history: readonly string[];
443
+ /** How far back the arrows have walked. 0 = editing a fresh line. */
444
+ readonly historyOffset: number;
445
+ /** The line being edited when history browsing started, restored on the way back down. */
446
+ readonly draft: string;
447
+ /** Undo stack, oldest first. Bounded — see `UNDO_LIMIT`. */
448
+ readonly past: readonly EditorSnapshot[];
449
+ /** What undo took away, newest first, so redo can put it back. Cleared by any fresh edit. */
450
+ readonly future: readonly EditorSnapshot[];
451
+ /** Set while `^R` is open. */
452
+ readonly search: EditorSearch | undefined;
453
+ /**
454
+ * Where a selection started, or `undefined` when there is none.
455
+ *
456
+ * Required-but-possibly-undefined rather than optional, exactly as `search` above is, and for the same
457
+ * reason: `exactOptionalPropertyTypes` makes an optional field impossible to *clear* by assignment, and
458
+ * clearing this one happens on every unshifted keystroke. Declaring it required also turns every
459
+ * existing construction site into a compile error, which is how they get found rather than missed.
460
+ *
461
+ * A code-point offset like `cursor`, and deliberately not a `{start, end}` pair: the pair cannot say
462
+ * which end is moving, so shift-extending leftward past the anchor and back would collapse to the
463
+ * wrong side. Anchor plus cursor keeps the direction, and the *rendered* range normalises.
464
+ */
465
+ readonly anchor: number | undefined;
466
+ }
467
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAA;AAElD,qEAAqE;AACrE,MAAM,WAAW,QAAQ;IACrB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAA;IAC9B,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAA;IACpB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;IACvB,8FAA8F;IAC9F,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IACxC;;;;;;OAMG;IACH,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAA;CACnC;AAID,MAAM,MAAM,cAAc,GACpB,MAAM,GACN,WAAW,GACX,WAAW,GACX,MAAM,GACN,OAAO,GACP,MAAM;AACR;;;GAGG;GACD,QAAQ,CAAA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AY;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACzB;AAED,MAAM,WAAW,WAAW;IACxB;;;;;;;OAOG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,oDAAoD;IACpD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,2DAA2D;IAC3D,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;IACnC,qEAAqE;IACrE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,0FAA0F;IAC1F,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,4DAA4D;IAC5D,QAAQ,CAAC,IAAI,EAAE,SAAS,cAAc,EAAE,CAAA;IACxC,6FAA6F;IAC7F,QAAQ,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,CAAA;IAC1C,8BAA8B;IAC9B,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,CAAA;IACzC;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;CACtC"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Silence the runtime warnings this project has already decided about, and nothing else.
3
+ *
4
+ * Under Node every command printed two lines of Node's own noise into the middle of its output:
5
+ *
6
+ * ```
7
+ * milo — running
8
+ * state running · pid 14922 up 24s
9
+ *
10
+ * (node:30494) ExperimentalWarning: SQLite is an experimental feature and might change at any time
11
+ * (Use `node --trace-warnings ...` to show where the warning was created)
12
+ * ```
13
+ *
14
+ * That warning is true, unavoidable and *already answered*: `node:sqlite` is a deliberate soft-compat
15
+ * target with a documented adapter (`store/sqlite/driver.ts`), CI runs the whole core suite under it,
16
+ * and the six behavioural divergences from `bun:sqlite` are enumerated in that file. Nobody running
17
+ * the binary learns anything from it. It is the same shape as a `trust: "trusted"` declaration with
18
+ * no `trustReason`: **a warning present for every correct run is a warning nobody reads**, and its
19
+ * cost is that it trains the eye to skip the region of the screen where a real warning would appear.
20
+ *
21
+ * Two things keep this from becoming a way to lose warnings that matter.
22
+ *
23
+ * **The list is specific and each entry carries its reason.** Not "drop every `ExperimentalWarning`" —
24
+ * the next experimental API this CLI starts depending on should be loud, because that is news. An
25
+ * entry here is a claim that someone looked at this exact warning and accepted it.
26
+ *
27
+ * **`--trace-warnings` disables the whole mechanism.** Somebody passing it is debugging warnings, and
28
+ * a filter that hides one from the person who explicitly asked to see them is a filter that wastes an
29
+ * afternoon.
30
+ *
31
+ * Wrapping `process.emitWarning` rather than replacing the `warning` listener is deliberate: the
32
+ * listener route means reimplementing Node's `(node:PID) [CODE] Name: message` format and its
33
+ * printed-once `--trace-warnings` hint, and a hand-rolled copy of those drifts from the real thing
34
+ * silently. Wrapping the emitter leaves every warning we do *not* suppress formatted by Node itself.
35
+ *
36
+ * What makes the filter effective is the *call site*, not import order: `openDatabase` reaches
37
+ * `node:sqlite` through a dynamic `import()` inside the function, so the warning fires when a store
38
+ * opens rather than when a module loads, and `index.ts` installs this well before that. The module
39
+ * still imports nothing — pinned by a test — so it stays movable to the front of the graph if an
40
+ * eager `node:sqlite` import ever changes that, and so it can never be the thing that pulls core in
41
+ * early.
42
+ */
43
+ interface AcceptedWarning {
44
+ readonly name: string;
45
+ /** Matched against the warning text with `includes`, so it is a stable substring, not a regex. */
46
+ readonly contains: string;
47
+ /** Why this one is accepted. An entry without a reason is an entry nobody can review. */
48
+ readonly because: string;
49
+ }
50
+ /**
51
+ * Warnings this project has looked at and accepted. Adding a line is a decision; it belongs in a
52
+ * review alongside whatever made the warning appear.
53
+ */
54
+ export declare const ACCEPTED_WARNINGS: readonly AcceptedWarning[];
55
+ /**
56
+ * Whether a warning is one of the accepted set. Pure, so the table above can be asserted without
57
+ * emitting anything into a test runner's output.
58
+ */
59
+ export declare function isAcceptedWarning(name: string, message: string): boolean;
60
+ /**
61
+ * How the process was invoked. Taken as an argument rather than read here so a test does not depend
62
+ * on the flags its own runner happened to be started with — the filter would silently not install
63
+ * under a `--trace-warnings` test run, and the failure would look like a broken filter.
64
+ */
65
+ export interface WarningEnv {
66
+ readonly execArgv: readonly string[];
67
+ readonly nodeOptions: string | undefined;
68
+ }
69
+ /** `--trace-warnings` anywhere in the invocation turns the filter off entirely. */
70
+ export declare function tracingWarnings(env: WarningEnv): boolean;
71
+ /**
72
+ * Install the filter. Idempotent — wrapping the wrapper would leave the process one frame deeper for
73
+ * every call, and nothing would report it.
74
+ */
75
+ export declare function quietAcceptedWarnings(env?: WarningEnv): void;
76
+ /** Tests only: put the real emitter back, so each case installs into a fresh process state. */
77
+ export declare function resetForTests(): void;
78
+ export {};
79
+ //# sourceMappingURL=warnings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"warnings.d.ts","sourceRoot":"","sources":["../../src/lib/warnings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,UAAU,eAAe;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,kGAAkG;IAClG,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,yFAAyF;IACzF,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAC3B;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,eAAe,EAOvD,CAAA;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAIxE;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACvB,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;IACpC,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;CAC3C;AAED,mFAAmF;AACnF,wBAAgB,eAAe,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAGxD;AAKD;;;GAGG;AACH,wBAAgB,qBAAqB,CACjC,GAAG,GAAE,UAAkF,GACxF,IAAI,CAYN;AAWD,+FAA+F;AAC/F,wBAAgB,aAAa,IAAI,IAAI,CAIpC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * How many terminal columns a string occupies.
3
+ *
4
+ * ## Why this exists
5
+ *
6
+ * `lib/wrap.ts` measured in **code points** and there was no width function anywhere in the CLI. An emoji
7
+ * is one code point and two columns, so `"👍".repeat(10)` measured 10 and drew 20 — and every cap built on
8
+ * that measurement was short. Short by a row on the alternate screen is a frame taller than the terminal,
9
+ * which scrolls the buffer and leaves the status line halfway up the display: the exact corruption
10
+ * `lib/wrap.ts` was written to prevent, still reachable through the one input it could not measure.
11
+ *
12
+ * It became urgent with mouse selection, where a column has to map back to a character. A drag that grabs
13
+ * the wrong text on any line containing an emoji is the "looks right and isn't" failure this repo avoids.
14
+ *
15
+ * ## What it is, and what it is not
16
+ *
17
+ * A range table, not a dependency — the same call `SPINNER_FRAMES` makes, and for the same reason: this is
18
+ * a handful of comparisons against data that changes once a year, and a package would be a supply chain.
19
+ *
20
+ * It is **not** full UAX #11, and the gap is stated rather than discovered. Width is defined per code
21
+ * point, so a grapheme cluster built from several — a ZWJ family emoji, a flag pair, a letter with two
22
+ * combining marks — is measured by summing its parts. Zero-width joiners and variation selectors count as
23
+ * zero, which makes the common cases right; a flag (two regional indicators, four columns by this count,
24
+ * two on screen) is over-measured, and over-measuring wraps early rather than overflowing. That is the
25
+ * direction to be wrong in, and it is why this rounds up rather than down.
26
+ */
27
+ /**
28
+ * Columns one code point occupies: 0, 1, or 2.
29
+ *
30
+ * A C0 control counts as zero. They should never reach a measured string — `wrap.ts` expands tabs and
31
+ * `printableOnly` strips the rest — so this is a floor rather than a feature: counting an escape byte as a
32
+ * column would make every row containing one wrap early, which is harder to spot than it sounds.
33
+ */
34
+ export declare function charWidth(code: number): number;
35
+ /** Columns a string occupies, summed per code point. */
36
+ export declare function textWidth(text: string): number;
37
+ /** Per-code-point widths of `cells`, for a caller that walks a line and needs each one. */
38
+ export declare function cellWidths(cells: readonly string[]): readonly number[];
39
+ //# sourceMappingURL=width.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"width.d.ts","sourceRoot":"","sources":["../../src/lib/width.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAyDH;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK9C;AAED,wDAAwD;AACxD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAI9C;AAED,2FAA2F;AAC3F,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,CAEtE"}