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,57 @@
1
+ /**
2
+ * Running one of this binary's own commands, for a pane inside a session.
3
+ *
4
+ * ## Why a child process rather than calling the function
5
+ *
6
+ * The obvious implementation is to call `validateCommand()` and swap `process.stdout.write` for a
7
+ * collector. It is also wrong here: Ink *owns* stdout while a session is mounted, and it writes a frame
8
+ * whenever anything re-renders. A frame drawn during the capture window lands in the collector instead of
9
+ * on the terminal — so the screen silently misses a repaint and the pane shows a frame of itself. Nothing
10
+ * errors; the display is just wrong, intermittently, depending on timing.
11
+ *
12
+ * A child writes to its own pipe. Nothing is hijacked, the frame keeps rendering, and the pane shows
13
+ * exactly what the command prints — which is also the honest thing to show, since "run this command" is
14
+ * what the palette offered. The cost is process startup, which is the same ~100 ms every command in this
15
+ * CLI already pays and is invisible next to reading the result.
16
+ *
17
+ * `--plain` is forced, for the reason it exists: a child that thought it had a terminal would return
18
+ * escape sequences, and the pane would render them as text.
19
+ */
20
+ export interface SubcommandResult {
21
+ readonly lines: readonly string[];
22
+ readonly code: number;
23
+ }
24
+ export interface SubcommandRequest {
25
+ readonly name: string;
26
+ /** Arguments as typed after the command word, split on whitespace. */
27
+ readonly rest: string;
28
+ /** The agent this session is running, passed to any command that takes a manifest. */
29
+ readonly manifestPath: string;
30
+ /** Injected by tests. `process.execPath` and `process.argv[1]` otherwise. */
31
+ readonly interpreter?: string;
32
+ readonly script?: string;
33
+ readonly env?: Readonly<Record<string, string | undefined>>;
34
+ readonly timeoutMs?: number;
35
+ }
36
+ /**
37
+ * The argv for a request.
38
+ *
39
+ * Pure and exported so the assembly is testable without starting anything — which matters because
40
+ * getting it wrong means a command runs against the wrong agent, and that is not visible in the output.
41
+ */
42
+ export declare function subcommandArgv(request: SubcommandRequest): readonly string[];
43
+ /**
44
+ * Why a pane must not run this request, if it must not.
45
+ *
46
+ * A pane captures a child to completion, so a command that never finishes is a pane that shows a spinner
47
+ * until the timeout fires and then reports being killed — thirty seconds of a frozen surface for a flag
48
+ * that worked perfectly at a shell. `daemon logs --follow` is the case: it exists precisely to keep
49
+ * printing until interrupted, and there is nothing for it to be interrupted *by* in here.
50
+ *
51
+ * Refused rather than quietly dropped. Dropping the flag would hand back the tail, which looks like a
52
+ * following command that stopped immediately — a wrong answer that reads as a right one. Keyed off the
53
+ * command's own spec, so a second command that grows a `follow` flag is covered with nothing to remember.
54
+ */
55
+ export declare function paneRefusal(request: SubcommandRequest): string | undefined;
56
+ export declare function runSubcommand(request: SubcommandRequest): Promise<SubcommandResult>;
57
+ //# sourceMappingURL=subcommand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subcommand.d.ts","sourceRoot":"","sources":["../../src/lib/subcommand.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,iBAAiB;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,sEAAsE;IACtE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,sFAAsF;IACtF,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,6EAA6E;IAC7E,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAA;IAC3D,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC9B;AAuBD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,iBAAiB,GAAG,SAAS,MAAM,EAAE,CAY5E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,GAAG,SAAS,CAY1E;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA0BzF"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * The systemd user unit: rendered and written here, enabled by two commands the person runs.
3
+ *
4
+ * ## Why this stops short of running `systemctl`
5
+ *
6
+ * `service.ts` refused Linux entirely on the argument that *"a systemd renderer nobody here can
7
+ * execute would be a liability: wrong in ways no test catches, shipped with an acceptance criterion
8
+ * that could not honestly be ticked."* Half of that argument has expired — Linux is the platform a
9
+ * server runs on — and half has not: a container has no systemd (PID 1 is the entrypoint) and
10
+ * `systemctl --user` on a CI runner has no D-Bus user session, so nothing in this project's test
11
+ * environment can drive the lifecycle verbs end to end.
12
+ *
13
+ * So the split is by what can be *proven*. The unit text is pure and fully tested; writing a file
14
+ * is ordinary I/O; and `enable --now` is printed rather than executed, because an install that
15
+ * reports success while nothing runs is the failure mode this whole phase exists to remove. Two
16
+ * commands is a worse experience than one and an honest one.
17
+ *
18
+ * ## `enable-linger` is not a footnote
19
+ *
20
+ * A systemd *user* unit is stopped when the user's last session ends, unless lingering is enabled
21
+ * for that account. Without it, an always-on agent server installed over SSH is gone the moment the
22
+ * connection closes — which is precisely launchd's `disable` trap in a different costume: installs
23
+ * cleanly, reports success, and is not there later. So the line is printed with the reason attached,
24
+ * and `daemon status` warns when lingering is off.
25
+ *
26
+ * ## What is deliberately the same as launchd
27
+ *
28
+ * `Restart=on-failure` mirrors `KeepAlive: {Crashed: true}` and `RestartSec` mirrors
29
+ * `ThrottleInterval`: a configuration fault must stop once rather than retry into a log nobody
30
+ * opens, which is the 57 MB lesson. `TimeoutStopSec` mirrors `ExitTimeOut`, and must exceed the
31
+ * runtime's own stop deadline or the reaper that kills backgrounded `exec` children never finishes.
32
+ * And the environment goes through the same `assertNoSecrets` — `systemctl show` echoes
33
+ * `Environment=` exactly as `launchctl print` echoes `EnvironmentVariables`.
34
+ */
35
+ import { type ServicePlan } from "#lib/launchd";
36
+ /** `~/.config/systemd/user/<label>.service`, honouring `XDG_CONFIG_HOME` when it is set. */
37
+ export declare function unitPath(label: string, home: string, env?: Readonly<Record<string, string | undefined>>): string;
38
+ /**
39
+ * Escape a value for a systemd unit.
40
+ *
41
+ * Nothing like XML escaping: systemd's parser treats a value as literal to end of line, so the only
42
+ * thing that can break a line is a **newline**. A path containing one is refused rather than
43
+ * silently truncated — a unit whose `ExecStart` stops halfway is a service that runs the wrong
44
+ * command, which is worse than a command that fails here.
45
+ */
46
+ export declare function assertUnitSafe(value: string, field: string): void;
47
+ /**
48
+ * Quote one `ExecStart` argument.
49
+ *
50
+ * systemd splits `ExecStart` on whitespace, so a path with a space in it becomes two arguments —
51
+ * and a sandbox under `/Users/Some Name/` is an ordinary thing to have. Double quotes are systemd's
52
+ * own quoting, with backslash escaping inside them.
53
+ */
54
+ export declare function quoteArg(arg: string): string;
55
+ export declare function renderUnit(plan: ServicePlan, envPrefix: string): string;
56
+ /** The commands a person runs after the unit is written, in the order they run them. */
57
+ export declare function followUp(label: string, user: string): readonly string[];
58
+ /** How to read the log on this platform. The journal, not a file — see `renderUnit`. */
59
+ export declare function logCommand(label: string): string;
60
+ //# sourceMappingURL=systemd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"systemd.d.ts","sourceRoot":"","sources":["../../src/lib/systemd.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAGH,OAAO,EAAwB,KAAK,WAAW,EAAoB,MAAM,cAAc,CAAA;AAGvF,4FAA4F;AAC5F,wBAAgB,QAAQ,CACpB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,GAAG,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAe,GAChE,MAAM,CAIR;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAMjE;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG5C;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAyCvE;AAED,wFAAwF;AACxF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAMvE;AAED,wFAAwF;AACxF,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEhD"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * The workspace templates, embedded.
3
+ *
4
+ * Embedded rather than read from disk because the installed binary ships only `dist/` — an
5
+ * `init` run in an arbitrary directory has no `examples/` to read. The human-edited source of
6
+ * truth stays `examples/workspace-template/`; `test/templates.test.ts` asserts byte-equality
7
+ * between that directory and these constants, so an edit to one without the other fails CI
8
+ * rather than shipping a scaffold that silently drifted from the documented templates.
9
+ *
10
+ * These are the *un-substituted* forms, `{{PLACEHOLDER}}` tokens intact. Substitution is
11
+ * `fillTemplate`'s job, and any token it does not fill survives into the generated file on
12
+ * purpose — the `workspace` command warns about unfilled placeholders until a person writes
13
+ * the real text, which is the nag-until-personalised mechanism working as designed.
14
+ */
15
+ /**
16
+ * The starter skill `init --skills starter` scaffolds.
17
+ *
18
+ * Embedded for the same reason as the workspace templates, and byte-equal to
19
+ * `examples/workspace-template/skills/starter/SKILL.md` by the same test. It carries no
20
+ * `{{PLACEHOLDER}}` tokens: a skill is a procedure nobody can guess from the agent's name, so there is
21
+ * nothing to substitute and the whole file is deliberately written as instructions to a person.
22
+ */
23
+ export declare const SKILL_TEMPLATE = "---\nname: {{SKILL_NAME}}\ndescription: Replace this description with what the skill does and when to use it, naming the specific words someone would type \u2014 file formats, tool names, the error they are looking at. Selection is lexical and this sentence is all it has.\nmetadata:\n \"{{WHEN_NOT_TO_USE_KEY}}\": >\n Replace this too. Say what this skill is NOT for, and name the skill or the plain answer\n that handles those cases instead.\n---\n\n<!--\nSKILL.md \u2014 one procedure the agent follows on the turns that call for it.\n\nThe format is agentskills.io, so this folder is portable to other clients. The spec's fields are\n`name` (which must equal this directory's name), `description`, and optionally `license`,\n`compatibility`, `metadata` and `allowed-tools`. Anything else is ignored rather than refused.\n\nHOW SELECTION WORKS, because it changes how you write the description. The harness ranks every\nskill's name and description against what was just asked, picks at most `skills.maxActive`, and\ninjects the winner. The model does not choose \u2014 so the description is a routing signal aimed at a\nlexical scorer, not a pitch aimed at a reader. Concrete nouns beat adjectives. A description whose\nonly distinctive word is a common verb activates on any turn using that verb: measured, a skill\nopening \"Write and debug a Dockerfile\" was selected for \"write me a haiku about autumn\".\n\nNegative guidance is not a spec field, which is why it lives under `metadata`. It is worth writing\nanyway \u2014 negative examples are the cheapest routing improvement available \u2014 and `skills validate`\nwarns when it is missing. It is never required to load, so a skill vendored from elsewhere works\nas it arrives.\n\nTHE BODY IS INJECTED VERBATIM on every turn this skill activates, so every line below is paid for.\nWrite steps, not background. Detail that is only occasionally needed goes in `references/` for the\nmodel to read on demand. These HTML comments are stripped before the model sees the file, so\nauthoring notes like this one are free.\n\nSCRIPTS. Drop an executable into `scripts/` and it becomes a tool named\n`skill.{{SKILL_NAME}}.<filename>`, callable only while this skill is active. A `.py` runs under `python3`,\nor under `uv run` if this folder has a `pyproject.toml` or `requirements.txt`; `.ts` and `.js` run\nunder the host; anything else needs an executable bit and a shebang. A file in `scripts/` that\nmatches none of those will never run, and `skills validate` says so. A deterministic script beats\ninstructions the model has to interpret \u2014 prefer one wherever the work is mechanical.\n-->\n\nReplace everything below with the steps.\n\n1. State the first step as an action, not a topic.\n2. Where a step has a rule that was learned the hard way, say the rule and why \u2014 a step with a\n reason generalises to the case you did not think of.\n3. Say what to report at the end, and what not to do. A procedure that does not say where it stops\n gets carried into the next turn.\n";
24
+ export declare const WORKSPACE_TEMPLATE_FILES: readonly ["AGENTS.md", "POLICY.md", "USER.md", "MEMORY.md", "REMINDER.md", "SOUL.md", "SOUL.compact.md"];
25
+ export type WorkspaceTemplateName = (typeof WORKSPACE_TEMPLATE_FILES)[number];
26
+ export declare const WORKSPACE_TEMPLATES: Record<WorkspaceTemplateName, string>;
27
+ /**
28
+ * Replace `{{NAME}}` tokens with values; tokens without a value survive untouched.
29
+ *
30
+ * Deliberately not an error path: a surviving token is the scaffold contract, not a failure.
31
+ * The regex is the same shape the authoring check uses to *find* placeholders, so what this
32
+ * function leaves behind is exactly what `checkAuthoring` will report.
33
+ */
34
+ export declare function fillTemplate(text: string, values: Record<string, string>): string;
35
+ //# sourceMappingURL=templates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/lib/templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,i/FACo9F,CAAA;AAE/+F,eAAO,MAAM,wBAAwB,0GAQ3B,CAAA;AAEV,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE7E,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,qBAAqB,EAAE,MAAM,CAerE,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAKjF"}
@@ -0,0 +1,98 @@
1
+ /**
2
+ * Which terminal this is, and what it would take to make shift+enter send a newline.
3
+ *
4
+ * ## The problem, stated once
5
+ *
6
+ * A terminal sends the byte `CR` for enter. For shift+enter it sends… `CR`. The two are the same
7
+ * keystroke as far as the process is concerned, which is why every terminal-based chat app either
8
+ * documents a different chord or asks you to install a key binding.
9
+ *
10
+ * The sequence to install is `CSI 13;2u` — the kitty keyboard protocol's encoding of "return with
11
+ * shift". Ink already parses it into `return + shift` (measured, not assumed), so nothing in the runtime
12
+ * needs to change: the terminal either sends something distinguishable or it does not.
13
+ *
14
+ * ⌥⏎ is always available and needs none of this, because it arrives as `ESC` then `CR` — two bytes, and
15
+ * therefore already distinguishable. That is why it is the documented chord and this command is an
16
+ * optional convenience rather than a prerequisite.
17
+ *
18
+ * ## Why some terminals are written and others are explained
19
+ *
20
+ * A terminal whose configuration is a text file can be edited safely: append a line, keep a backup, and
21
+ * a person can read the diff. A terminal whose configuration is a binary plist inside an array of
22
+ * profiles cannot — iTerm2 also holds its preferences in memory and rewrites them on quit, so an edit
23
+ * made underneath it is silently discarded. Writing one anyway would produce the worst outcome
24
+ * available: a command that reports success and changes nothing.
25
+ *
26
+ * So `write` terminals get a file edit and `explain` terminals get the exact steps. The difference is a
27
+ * property of the terminal, recorded here rather than discovered per user.
28
+ *
29
+ * Pure and PURE-listed: detection is a function of the environment *passed in*, and the recipes are
30
+ * data. The file I/O lives in `terminal-setup.ts`.
31
+ */
32
+ /** The sequence a terminal must send for shift+enter. Ink parses this into `return + shift`. */
33
+ export declare const SHIFT_ENTER_SEQUENCE = "\u001B[13;2u";
34
+ /** The same thing spelled for a config file that wants an escaped literal rather than the byte. */
35
+ export declare const SHIFT_ENTER_ESCAPED = "\\x1b[13;2u";
36
+ export type TerminalId = "vscode" | "ghostty" | "kitty" | "wezterm" | "iterm2" | "apple" | "warp" | "unknown";
37
+ export interface TerminalRecipe {
38
+ readonly id: TerminalId;
39
+ readonly name: string;
40
+ /**
41
+ * `write` — the configuration is a text file this command can append to.
42
+ * `explain` — it is not, so the steps are printed and a person performs them.
43
+ * `unverified` — the terminal is known, and there is no recipe anyone has checked.
44
+ *
45
+ * The third state earns itself because both alternatives are worse. Reporting a known terminal as
46
+ * "not recognised" is a lie about what we know; inventing a recipe for it produces the one outcome
47
+ * this module is arranged to avoid — a command that reports success and changes nothing. Found by
48
+ * running the command: the author's own terminal turned out to be one of these.
49
+ *
50
+ * There was briefly a fourth, `none` — "nothing to configure" — added when the kitty keyboard protocol
51
+ * turned out to make shift+⏎ work in Warp on its own. It is gone, because the measurement behind it was
52
+ * incomplete: the protocol fixes the *arrow* chords and not the letter ones, so Warp does have a step
53
+ * after all. Recorded here rather than silently reverted, because the mistake is the useful part — a
54
+ * state was invented for a case that a fuller measurement dissolved, and a state nothing reaches is
55
+ * exactly the dead vocabulary this repo keeps removing.
56
+ */
57
+ readonly how: "write" | "explain" | "unverified";
58
+ /** Path relative to the home directory. Absent for an `explain` terminal. */
59
+ readonly configPath?: string;
60
+ /** The line to add. Absent for an `explain` terminal. */
61
+ readonly line?: string;
62
+ /** How to tell whether the line is already there — a substring, not a regex, so it cannot over-match. */
63
+ readonly marker?: string;
64
+ /** For `explain`: the steps, in order. */
65
+ readonly steps?: readonly string[];
66
+ /** Why this terminal cannot be configured automatically. Present whenever `how` is `explain`. */
67
+ readonly reason?: string;
68
+ }
69
+ /**
70
+ * Which terminal is running this, from the environment it was given.
71
+ *
72
+ * Order matters. VS Code sets `TERM_PROGRAM=vscode` while its integrated terminal may *also* be running
73
+ * under another emulator's variables, and the innermost one is the one whose key bindings apply. The
74
+ * program-specific variables are therefore checked before the generic `TERM`, which is the only one a
75
+ * multiplexer rewrites.
76
+ */
77
+ export declare function detectTerminal(env: Readonly<Record<string, string | undefined>>): TerminalId;
78
+ export declare function recipeFor(id: TerminalId): TerminalRecipe | undefined;
79
+ /** Every terminal this command knows, for `--help` and for the "not this one" message. */
80
+ export declare function knownTerminals(): readonly TerminalRecipe[];
81
+ /**
82
+ * Is the binding already installed?
83
+ *
84
+ * Substring rather than an exact line, because a person may have written it differently — a different
85
+ * indent, a comment after it, VS Code's own formatting of the JSON. Reporting "already configured" for a
86
+ * hand-written equivalent is right; rewriting it would produce a duplicate binding whose behaviour
87
+ * depends on which the terminal reads last.
88
+ */
89
+ export declare function alreadyConfigured(contents: string, recipe: TerminalRecipe): boolean;
90
+ /**
91
+ * The file's new contents.
92
+ *
93
+ * VS Code's `keybindings.json` is an array, so the line goes *inside* it and cannot simply be appended;
94
+ * everything else is a line-oriented config where appending is correct. Both cases keep whatever was
95
+ * there — this never rewrites a file it did not author.
96
+ */
97
+ export declare function withBinding(contents: string, recipe: TerminalRecipe): string | undefined;
98
+ //# sourceMappingURL=terminal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminal.d.ts","sourceRoot":"","sources":["../../src/lib/terminal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,gGAAgG;AAChG,eAAO,MAAM,oBAAoB,iBAAiB,CAAA;AAElD,mGAAmG;AACnG,eAAO,MAAM,mBAAmB,gBAAgB,CAAA;AAIhD,MAAM,MAAM,UAAU,GAChB,QAAQ,GACR,SAAS,GACT,OAAO,GACP,SAAS,GACT,QAAQ,GACR,OAAO,GACP,MAAM,GACN,SAAS,CAAA;AAEf,MAAM,WAAW,cAAc;IAC3B,QAAQ,CAAC,EAAE,EAAE,UAAU,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,SAAS,GAAG,YAAY,CAAA;IAChD,6EAA6E;IAC7E,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;IAC5B,yDAAyD;IACzD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB,yGAAyG;IACzG,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,0CAA0C;IAC1C,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAClC,iGAAiG;IACjG,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAC3B;AAqFD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,GAAG,UAAU,CAU5F;AAED,wBAAgB,SAAS,CAAC,EAAE,EAAE,UAAU,GAAG,cAAc,GAAG,SAAS,CAEpE;AAED,0FAA0F;AAC1F,wBAAgB,cAAc,IAAI,SAAS,cAAc,EAAE,CAE1D;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,GAAG,OAAO,CAEnF;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS,CAkBxF"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Selecting text in the transcript with the mouse.
3
+ *
4
+ * ## Buffer coordinates, and why that is the whole design
5
+ *
6
+ * The reference CLI keeps its selection in *screen* coordinates against a viewport-sized cell grid, and
7
+ * roughly forty per cent of its state exists to survive that choice: two accumulators for rows that
8
+ * scrolled out of the grid mid-drag, two parallel soft-wrap bitmaps to go with them, a pre-clamp anchor
9
+ * row, and a function to capture rows before they are overwritten. All of it because the text is gone once
10
+ * it leaves the viewport, so the selection has to hoard it.
11
+ *
12
+ * We never lose the text. The transcript is `readonly TranscriptRow[]` for the whole conversation with a
13
+ * window over it, so a selection stored as `{row, column}` into *that* array needs none of those fields: it
14
+ * is stable while the view scrolls, because scrolling only moves the window, and a copy is a substring of
15
+ * data still in hand. Drag-to-scroll is then free rather than the hardest case.
16
+ *
17
+ * ## What it deliberately does not do
18
+ *
19
+ * Rectangular selection. Terminals select linearly — from a point, through every intervening row, to
20
+ * another point — and a block selection is a different gesture with no way to ask for it here.
21
+ */
22
+ import type { TranscriptRow } from "#lib/types";
23
+ /** A position in the row buffer. `column` indexes code points of that row's `text`. */
24
+ export interface TextPoint {
25
+ readonly row: number;
26
+ readonly column: number;
27
+ }
28
+ export interface TextSelection {
29
+ /** Where the press happened. */
30
+ readonly anchor: TextPoint;
31
+ /** Where the pointer is now. Equal to `anchor` until the first motion. */
32
+ readonly focus: TextPoint;
33
+ /** True between press and release, which is what tells a finished selection from a live drag. */
34
+ readonly dragging: boolean;
35
+ }
36
+ /** Begin a selection at a point. Focus starts equal to anchor, so a bare click selects nothing. */
37
+ export declare function beginSelection(at: TextPoint): TextSelection;
38
+ /** Move the focus. A no-op once the drag has finished, so a stray motion report cannot resurrect it. */
39
+ export declare function dragSelection(selection: TextSelection, to: TextPoint): TextSelection;
40
+ /** Keep the range and stop tracking, so the highlight stays up and the text can be copied. */
41
+ export declare function endSelection(selection: TextSelection): TextSelection;
42
+ /** Extend an existing selection to a point, as shift-click does. */
43
+ export declare function extendSelection(selection: TextSelection, to: TextPoint): TextSelection;
44
+ /** The range in reading order, or `undefined` when nothing is selected. */
45
+ export declare function textBounds(selection: TextSelection | undefined): {
46
+ readonly start: TextPoint;
47
+ readonly end: TextPoint;
48
+ } | undefined;
49
+ /**
50
+ * Which columns of one row are selected, or `undefined` if none are.
51
+ *
52
+ * Clamped to the row's own length by the caller's `cells`, because a drag that runs off the end of a short
53
+ * row must select to its end rather than to the pointer's column — which is what makes dragging down
54
+ * through ragged text feel like one continuous sweep.
55
+ */
56
+ export declare function rowSelection(selection: TextSelection | undefined, row: number, cells: number): {
57
+ readonly from: number;
58
+ readonly to: number;
59
+ } | undefined;
60
+ /**
61
+ * The selected text, with wrapped rows rejoined into the lines they came from.
62
+ *
63
+ * A row's `continuation` flag is what makes this a copy of the *source* rather than of the layout: without
64
+ * it, pasting a wrapped paragraph would carry the newlines this renderer invented. The role prefix is
65
+ * dropped for the same reason — `› ` and ` · ` are chrome nobody typed.
66
+ *
67
+ * Trailing whitespace goes per logical line, not per row, so a break that consumed a space does not leave
68
+ * one behind in the middle of a rejoined sentence.
69
+ */
70
+ export declare function selectedText(rows: readonly TranscriptRow[], selection: TextSelection | undefined): string;
71
+ /** The word under a point, as a selection. Falls back to the whole row when the point is whitespace. */
72
+ export declare function wordAt(rows: readonly TranscriptRow[], at: TextPoint): TextSelection;
73
+ /** The whole row under a point, prefix excluded. */
74
+ export declare function lineAt(rows: readonly TranscriptRow[], at: TextPoint): TextSelection;
75
+ //# sourceMappingURL=text-selection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-selection.d.ts","sourceRoot":"","sources":["../../src/lib/text-selection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C,uFAAuF;AACvF,MAAM,WAAW,SAAS;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAC1B;AAED,MAAM,WAAW,aAAa;IAC1B,gCAAgC;IAChC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAA;IAC1B,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;IACzB,iGAAiG;IACjG,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;CAC7B;AAED,mGAAmG;AACnG,wBAAgB,cAAc,CAAC,EAAE,EAAE,SAAS,GAAG,aAAa,CAE3D;AAED,wGAAwG;AACxG,wBAAgB,aAAa,CAAC,SAAS,EAAE,aAAa,EAAE,EAAE,EAAE,SAAS,GAAG,aAAa,CAGpF;AAED,8FAA8F;AAC9F,wBAAgB,YAAY,CAAC,SAAS,EAAE,aAAa,GAAG,aAAa,CAEpE;AAED,oEAAoE;AACpE,wBAAgB,eAAe,CAAC,SAAS,EAAE,aAAa,EAAE,EAAE,EAAE,SAAS,GAAG,aAAa,CAEtF;AAMD,2EAA2E;AAC3E,wBAAgB,UAAU,CACtB,SAAS,EAAE,aAAa,GAAG,SAAS,GACrC;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAA;CAAE,GAAG,SAAS,CAKpE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CACxB,SAAS,EAAE,aAAa,GAAG,SAAS,EACpC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GACd;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAO5D;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CACxB,IAAI,EAAE,SAAS,aAAa,EAAE,EAC9B,SAAS,EAAE,aAAa,GAAG,SAAS,GACrC,MAAM,CAsBR;AAOD,wGAAwG;AACxG,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,aAAa,EAAE,EAAE,EAAE,EAAE,SAAS,GAAG,aAAa,CAcnF;AAED,oDAAoD;AACpD,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,aAAa,EAAE,EAAE,EAAE,EAAE,SAAS,GAAG,aAAa,CAQnF"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * The one home for appearance: colour tokens, glyphs, and the maps components render from.
3
+ *
4
+ * `lib/const.ts` keeps *behavioural* numbers (row caps, history limits, control sequences); this
5
+ * module holds everything a person would touch to change how the CLI looks. Splitting the two
6
+ * extends the "no magic value inline" rule rather than weakening it — one home each, and a
7
+ * component containing a literal colour name is a review failure.
8
+ *
9
+ * Tokens are plain Ink colour names (16-colour safe; Ink's chalk layer maps them per terminal),
10
+ * which keeps this module PURE-listable. `brand` is the single deliberate exception and says why. `NO_COLOR` needs no handling here: the mode resolution
11
+ * forces plain output before Ink ever loads, and chalk independently honours it anyway.
12
+ *
13
+ * This is deliberately a single built-in token set, not a theming system — decision 11.12
14
+ * reverses Phase 2.5's "themes" non-goal in the narrowest possible sense. User-configurable
15
+ * themes stay a non-goal.
16
+ */
17
+ import type { TranscriptRole, TurnStatus } from "#lib/types";
18
+ export interface Theme {
19
+ /** The one accent, used sparingly: caret, selection cursor, user lines, banner border. */
20
+ readonly accent: string;
21
+ /** Hints, notes, reasoning, breadcrumbs. */
22
+ readonly muted: string;
23
+ readonly success: string;
24
+ readonly warning: string;
25
+ readonly error: string;
26
+ /** Tool rows and tool-running status. */
27
+ readonly info: string;
28
+ /** Cancelling — the one transitional state worth its own colour. */
29
+ readonly emphasis: string;
30
+ /**
31
+ * The background a selected run is painted on.
32
+ *
33
+ * A background rather than `inverse`, which is what the caret uses. Inverse swaps foreground and
34
+ * background, so on a coloured run it produces a different colour per role and reads as three
35
+ * highlights rather than one selection — and where a selection contains the caret the two inversions
36
+ * cancel and the caret disappears inside it. A solid background composes instead of fighting.
37
+ */
38
+ readonly selection: string;
39
+ /** Non-focal boxes: cards, frames. */
40
+ readonly border: string;
41
+ /** The focused box: the input line, the banner. */
42
+ readonly borderActive: string;
43
+ /**
44
+ * The wordmark, and only the wordmark.
45
+ *
46
+ * The one token that is a hex triplet rather than an Ink colour name, chosen by the owner. Every other
47
+ * token is 16-colour safe on purpose — a name lets chalk pick whatever the terminal actually has — and
48
+ * this is the deliberate exception, because a brand mark is the one element whose *exact* colour is the
49
+ * point. Chalk downsamples it per terminal rather than failing: on a 256-colour terminal it lands on the
50
+ * nearest cube entry, on a 16-colour one on bright green, which is the right neighbour. `NO_COLOR` is
51
+ * handled before Ink loads at all, by the mode resolution.
52
+ *
53
+ * Not reused anywhere else. A second consumer would make it an accent, and the accent already exists.
54
+ */
55
+ readonly brand: string;
56
+ }
57
+ export declare const THEME: Theme;
58
+ /** Status-dot colours, previously inlined in StatusBar. */
59
+ export declare const STATUS_COLOR: Record<TurnStatus, string>;
60
+ /** Transcript role colours, previously inlined in Transcript. `undefined` = terminal default. */
61
+ export declare const ROLE_COLOR: Record<TranscriptRole, string | undefined>;
62
+ /**
63
+ * What each role puts before its text, and re-applies as a hanging indent on every row after the first.
64
+ *
65
+ * That second half is why `reasoning` is **two columns** rather than the `\u00b7 reasoning \u00b7 ` it used to be.
66
+ * A prefix is an indent, so the longest block in the transcript was also the narrowest — 86 columns of a
67
+ * 100-column terminal, on the one item that is routinely forty rows long. The label moved to a header row
68
+ * of its own, where it costs one row once instead of fourteen columns per row.
69
+ */
70
+ export declare const ROLE_PREFIX: Record<TranscriptRole, string>;
71
+ /** The glyph vocabulary. Components compose these; none defines its own. */
72
+ export declare const GLYPH: {
73
+ readonly prompt: "› ";
74
+ readonly pointer: "❯ ";
75
+ readonly bullet: "· ";
76
+ readonly error: "✖ ";
77
+ readonly dot: "● ";
78
+ readonly check: "✓ ";
79
+ readonly ellipsis: "…";
80
+ readonly create: "+ ";
81
+ /** Multi-select boxes. Two glyphs so a ticked row reads as ticked without colour. */
82
+ readonly checked: "◉ ";
83
+ readonly unchecked: "◯ ";
84
+ };
85
+ /** Braille spinner. Ten glyphs in a const, not a dependency — decision 11.10 holds. */
86
+ export declare const SPINNER_FRAMES: readonly ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
87
+ export declare const SPINNER_INTERVAL_MS = 80;
88
+ /** cli-boxes ships inside Ink 7; rounded is the house border. Zero new dependencies. */
89
+ export declare const BORDER_STYLE: "round";
90
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/lib/theme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5D,MAAM,WAAW,KAAK;IAClB,0FAA0F;IAC1F,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,4CAA4C;IAC5C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,yCAAyC;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,oEAAoE;IACpE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB;;;;;;;OAOG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,sCAAsC;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,mDAAmD;IACnD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACzB;AAED,eAAO,MAAM,KAAK,EAAE,KAcnB,CAAA;AAED,2DAA2D;AAC3D,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAMnD,CAAA;AAED,iGAAiG;AACjG,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,CAQjE,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAQtD,CAAA;AAED,4EAA4E;AAC5E,eAAO,MAAM,KAAK;;;;;;;;;IASd,qFAAqF;;;CAG/E,CAAA;AAEV,uFAAuF;AACvF,eAAO,MAAM,cAAc,6DAA8D,CAAA;AACzF,eAAO,MAAM,mBAAmB,KAAK,CAAA;AAErC,wFAAwF;AACxF,eAAO,MAAM,YAAY,EAAG,OAAgB,CAAA"}