dispach 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/README.md +134 -85
  2. package/dist/App-qfqvx9c7.js +11 -0
  3. package/dist/{App-b1yrwrcq.js.map → App-qfqvx9c7.js.map} +6 -7
  4. package/dist/ConfigEditor-apcnj4nj.js +6 -0
  5. package/dist/{ConfigEditor-n8hdw6r7.js.map → ConfigEditor-apcnj4nj.js.map} +2 -2
  6. package/dist/KeyProbe-ya5t3v3v.js +5 -0
  7. package/dist/{KeyProbe-9jjeze5r.js.map → KeyProbe-ya5t3v3v.js.map} +2 -2
  8. package/dist/Picker-b7mn0mjg.js +5 -0
  9. package/dist/{Picker-hfeh1g6m.js.map → Picker-b7mn0mjg.js.map} +1 -1
  10. package/dist/SessionPicker-vacfwczg.js +5 -0
  11. package/dist/{SessionPicker-zyqkg4dn.js.map → SessionPicker-vacfwczg.js.map} +2 -2
  12. package/dist/SkillBrowser-66ntwaa9.js +5 -0
  13. package/dist/{SkillBrowser-3qdp8080.js.map → SkillBrowser-66ntwaa9.js.map} +1 -1
  14. package/dist/WizardApp-123998yh.js +5 -0
  15. package/dist/{WizardApp-vzpbydy3.js.map → WizardApp-123998yh.js.map} +3 -3
  16. package/dist/agents.d.ts +19 -3
  17. package/dist/agents.d.ts.map +1 -1
  18. package/dist/channels-q4fwqq87.js +31 -0
  19. package/dist/channels-q4fwqq87.js.map +10 -0
  20. package/dist/channels.d.ts +26 -0
  21. package/dist/channels.d.ts.map +1 -0
  22. package/dist/client.js +10 -10
  23. package/dist/client.js.map +3 -3
  24. package/dist/config-64q4mgxc.js +24 -0
  25. package/dist/{config-g7za9x13.js.map → config-64q4mgxc.js.map} +2 -2
  26. package/dist/{credential-npr6z8c8.js → credential-2sj7vsmw.js} +5 -5
  27. package/dist/{credential-npr6z8c8.js.map → credential-2sj7vsmw.js.map} +1 -1
  28. package/dist/daemon.d.ts.map +1 -1
  29. package/dist/index-0k3w2mxf.js +6 -0
  30. package/dist/{index-hwpvhaza.js.map → index-0k3w2mxf.js.map} +1 -1
  31. package/dist/index-1s81qstp.js +6 -0
  32. package/dist/{index-v8e92nfw.js.map → index-1s81qstp.js.map} +1 -1
  33. package/dist/index-2rycma8x.js +12 -0
  34. package/dist/{index-258d8bzg.js.map → index-2rycma8x.js.map} +4 -3
  35. package/dist/index-2zye08c4.js +6 -0
  36. package/dist/{index-vgc3y3rm.js.map → index-2zye08c4.js.map} +2 -2
  37. package/dist/{index-gme2egyq.js → index-3km1jwh7.js} +4 -4
  38. package/dist/{index-gme2egyq.js.map → index-3km1jwh7.js.map} +1 -1
  39. package/dist/index-3mtgcvkq.js +429 -0
  40. package/dist/index-3mtgcvkq.js.map +11 -0
  41. package/dist/index-4knb5vjm.js +90 -0
  42. package/dist/index-4knb5vjm.js.map +13 -0
  43. package/dist/{index-3g3ny01d.js → index-5nwwekk0.js} +4 -4
  44. package/dist/{index-3g3ny01d.js.map → index-5nwwekk0.js.map} +1 -1
  45. package/dist/index-5rm7dwq4.js +6 -0
  46. package/dist/index-5rm7dwq4.js.map +11 -0
  47. package/dist/index-79epttpm.js +6 -0
  48. package/dist/index-79epttpm.js.map +10 -0
  49. package/dist/{index-4cf6v9nb.js → index-7yk1zvds.js} +4 -4
  50. package/dist/{index-4cf6v9nb.js.map → index-7yk1zvds.js.map} +1 -1
  51. package/dist/index-81gb4ey4.js +6 -0
  52. package/dist/{index-4z7axw4r.js.map → index-81gb4ey4.js.map} +1 -1
  53. package/dist/index-8a5d8sfe.js +6 -0
  54. package/dist/{index-0d93hyfc.js.map → index-8a5d8sfe.js.map} +1 -1
  55. package/dist/index-a21zyy54.js +6 -0
  56. package/dist/index-a21zyy54.js.map +9 -0
  57. package/dist/index-b6da6c16.js +92 -0
  58. package/dist/index-b6da6c16.js.map +15 -0
  59. package/dist/index-byxrc961.js +903 -0
  60. package/dist/{index-tv4yv7d2.js.map → index-byxrc961.js.map} +16 -15
  61. package/dist/{index-ammv5st7.js → index-cgfg6t5a.js} +6 -6
  62. package/dist/{index-ammv5st7.js.map → index-cgfg6t5a.js.map} +1 -1
  63. package/dist/{index-s9mbq7h6.js → index-ehzwdnc3.js} +4 -4
  64. package/dist/{index-s9mbq7h6.js.map → index-ehzwdnc3.js.map} +1 -1
  65. package/dist/index-fzmmhmk2.js +7 -0
  66. package/dist/index-fzmmhmk2.js.map +11 -0
  67. package/dist/index-g3pk0kc0.js +6 -0
  68. package/dist/{index-9r0wyj6w.js.map → index-g3pk0kc0.js.map} +2 -2
  69. package/dist/index-h828nk24.js +153 -0
  70. package/dist/index-h828nk24.js.map +20 -0
  71. package/dist/{index-02dn6m2j.js → index-jq999vcw.js} +5 -5
  72. package/dist/{index-02dn6m2j.js.map → index-jq999vcw.js.map} +2 -2
  73. package/dist/index-k2aq5bg0.js +9 -0
  74. package/dist/{index-6p999cx4.js.map → index-k2aq5bg0.js.map} +4 -6
  75. package/dist/{index-cqqb6gaq.js → index-k3y8y3wj.js} +5 -5
  76. package/dist/{index-cqqb6gaq.js.map → index-k3y8y3wj.js.map} +1 -1
  77. package/dist/index-k59wwdgz.js +9 -0
  78. package/dist/{index-ff514z3y.js.map → index-k59wwdgz.js.map} +3 -5
  79. package/dist/index-nmnnwa02.js +6 -0
  80. package/dist/{index-6q4wf8e3.js.map → index-nmnnwa02.js.map} +1 -1
  81. package/dist/index-nn3tk25c.js +6 -0
  82. package/dist/{index-d4x6yvqh.js.map → index-nn3tk25c.js.map} +3 -4
  83. package/dist/index-q0hxh57v.js +126 -0
  84. package/dist/index-q0hxh57v.js.map +14 -0
  85. package/dist/index-srmhk9g5.js +11 -0
  86. package/dist/index-srmhk9g5.js.map +11 -0
  87. package/dist/index-swtyfhha.js +6 -0
  88. package/dist/{index-fex44816.js.map → index-swtyfhha.js.map} +2 -2
  89. package/dist/index-whq42sat.js +6 -0
  90. package/dist/{index-h9mw7b9d.js.map → index-whq42sat.js.map} +1 -1
  91. package/dist/{index-j7gyr5nx.js → index-wzsmh5j0.js} +7 -7
  92. package/dist/{index-j7gyr5nx.js.map → index-wzsmh5j0.js.map} +1 -1
  93. package/dist/{index-j55s3ehk.js → index-x7v1zq89.js} +7 -7
  94. package/dist/{index-j55s3ehk.js.map → index-x7v1zq89.js.map} +2 -2
  95. package/dist/index-xhzmv4dh.js +66 -0
  96. package/dist/index-xhzmv4dh.js.map +12 -0
  97. package/dist/index-xmv47vs0.js +6 -0
  98. package/dist/{index-gz9x25tz.js.map → index-xmv47vs0.js.map} +2 -2
  99. package/dist/index-y4c32wn7.js +6 -0
  100. package/dist/{index-qdbq8crg.js.map → index-y4c32wn7.js.map} +2 -2
  101. package/dist/index-yjcdp72k.js +6 -0
  102. package/dist/{index-tf71ap9v.js.map → index-yjcdp72k.js.map} +1 -1
  103. package/dist/index-zn24991r.js +6 -0
  104. package/dist/index-zn24991r.js.map +10 -0
  105. package/dist/index.js +374 -443
  106. package/dist/index.js.map +23 -27
  107. package/dist/init.d.ts.map +1 -1
  108. package/dist/lib/channel-actions.d.ts +103 -0
  109. package/dist/lib/channel-actions.d.ts.map +1 -0
  110. package/dist/lib/chat-frame.d.ts +12 -1
  111. package/dist/lib/chat-frame.d.ts.map +1 -1
  112. package/dist/lib/commands.d.ts +13 -0
  113. package/dist/lib/commands.d.ts.map +1 -1
  114. package/dist/lib/const.d.ts +1 -1
  115. package/dist/lib/host-actions.d.ts +121 -0
  116. package/dist/lib/host-actions.d.ts.map +1 -0
  117. package/dist/lib/init-flow.d.ts +32 -0
  118. package/dist/lib/init-flow.d.ts.map +1 -1
  119. package/dist/lib/init-whatsapp.d.ts +52 -0
  120. package/dist/lib/init-whatsapp.d.ts.map +1 -0
  121. package/dist/lib/plugin-install.d.ts +120 -0
  122. package/dist/lib/plugin-install.d.ts.map +1 -0
  123. package/dist/lib/providers.d.ts.map +1 -1
  124. package/dist/lib/provision.d.ts.map +1 -1
  125. package/dist/lib/readme-table.d.ts +15 -0
  126. package/dist/lib/readme-table.d.ts.map +1 -0
  127. package/dist/lib/sandbox.d.ts +15 -0
  128. package/dist/lib/sandbox.d.ts.map +1 -1
  129. package/dist/lib/schema.d.ts +34 -1
  130. package/dist/lib/schema.d.ts.map +1 -1
  131. package/dist/lib/subcommand.d.ts.map +1 -1
  132. package/dist/lib/web-url.d.ts +15 -0
  133. package/dist/lib/web-url.d.ts.map +1 -0
  134. package/dist/lib/wizard.d.ts.map +1 -1
  135. package/dist/memory.d.ts.map +1 -1
  136. package/dist/model.d.ts.map +1 -1
  137. package/dist/plugins.d.ts +27 -8
  138. package/dist/plugins.d.ts.map +1 -1
  139. package/dist/restart.d.ts +21 -0
  140. package/dist/restart.d.ts.map +1 -0
  141. package/dist/run.d.ts.map +1 -1
  142. package/dist/schedules.d.ts.map +1 -1
  143. package/dist/serve.d.ts.map +1 -1
  144. package/dist/sessions.d.ts.map +1 -1
  145. package/dist/skills.d.ts.map +1 -1
  146. package/dist/status.d.ts +16 -0
  147. package/dist/status.d.ts.map +1 -0
  148. package/dist/tools.d.ts.map +1 -1
  149. package/dist/validate.d.ts.map +1 -1
  150. package/dist/web-923c7f5e.js +14 -0
  151. package/dist/{web-vkb16r62.js.map → web-923c7f5e.js.map} +3 -3
  152. package/dist/web.d.ts +2 -13
  153. package/dist/web.d.ts.map +1 -1
  154. package/dist/workspace.d.ts.map +1 -1
  155. package/dist/wrapper-0w9b3my0.js +11 -0
  156. package/dist/wrapper-0w9b3my0.js.map +23 -0
  157. package/package.json +6 -3
  158. package/dist/App-b1yrwrcq.js +0 -11
  159. package/dist/ConfigEditor-n8hdw6r7.js +0 -6
  160. package/dist/KeyProbe-9jjeze5r.js +0 -5
  161. package/dist/Picker-hfeh1g6m.js +0 -5
  162. package/dist/SessionPicker-zyqkg4dn.js +0 -5
  163. package/dist/SkillBrowser-3qdp8080.js +0 -5
  164. package/dist/WizardApp-vzpbydy3.js +0 -5
  165. package/dist/config-g7za9x13.js +0 -24
  166. package/dist/index-0d93hyfc.js +0 -6
  167. package/dist/index-1c5113t4.js +0 -66
  168. package/dist/index-1c5113t4.js.map +0 -12
  169. package/dist/index-258d8bzg.js +0 -12
  170. package/dist/index-4z7axw4r.js +0 -6
  171. package/dist/index-6p999cx4.js +0 -9
  172. package/dist/index-6q4wf8e3.js +0 -6
  173. package/dist/index-9r0wyj6w.js +0 -6
  174. package/dist/index-d4x6yvqh.js +0 -6
  175. package/dist/index-fecm8xe7.js +0 -77
  176. package/dist/index-fecm8xe7.js.map +0 -12
  177. package/dist/index-fex44816.js +0 -6
  178. package/dist/index-ff514z3y.js +0 -14
  179. package/dist/index-gz9x25tz.js +0 -6
  180. package/dist/index-h9mw7b9d.js +0 -6
  181. package/dist/index-hwpvhaza.js +0 -6
  182. package/dist/index-mtn0g9vc.js +0 -7
  183. package/dist/index-mtn0g9vc.js.map +0 -11
  184. package/dist/index-qdbq8crg.js +0 -6
  185. package/dist/index-tf71ap9v.js +0 -6
  186. package/dist/index-ttwyrdjs.js +0 -427
  187. package/dist/index-ttwyrdjs.js.map +0 -11
  188. package/dist/index-tv4yv7d2.js +0 -903
  189. package/dist/index-ty24n0jh.js +0 -167
  190. package/dist/index-ty24n0jh.js.map +0 -19
  191. package/dist/index-v8e92nfw.js +0 -6
  192. package/dist/index-vgc3y3rm.js +0 -6
  193. package/dist/index-whaw4b18.js +0 -6
  194. package/dist/index-whaw4b18.js.map +0 -10
  195. package/dist/web-vkb16r62.js +0 -14
@@ -5,6 +5,6 @@
5
5
  "/**\n * What every screen has in common, as data: the header block and the footer's key hints.\n *\n * ## Why this is a module and not a component\n *\n * Three surfaces had a banner before this existed — chat, the wizard, the agent picker — and each\n * decided its own title, its own context lines and its own key hints, in JSX. So the *content* of a\n * header was only observable by mounting a renderer, and the one thing worth asserting about it is\n * exactly that content: whether the agent in scope is named, whether a session-wide warning is still\n * visible after the screen scrolls, whether the footer fits.\n *\n * Everything here is text in, text out. `Screen.tsx` is one consumer; a test asserting a header names\n * the right agent is another, and neither can drift from the other because there is one derivation.\n *\n * ## The rule the header exists to enforce\n *\n * CLAUDE.md: anything true for the whole session belongs where a person still sees it after\n * scrolling. On an inline surface that could be a line printed at the top; on the alternate screen\n * there *is* no scrolling past, so it has to be the header or nowhere. `warnings` is therefore part\n * of the header's shape rather than something each screen remembers to render.\n *\n * Colour is not decided here, for `render.ts`'s reason: this module has no idea whether it is being\n * read from a terminal or a log file, and that is `resolveMode`'s question.\n */\n\nimport {\n MAX_SCREEN_COLUMNS,\n MAX_SCREEN_ROWS,\n MIN_SCREEN_COLUMNS,\n MIN_SCREEN_ROWS,\n SCREEN_CHROME_ROWS,\n} from \"#lib/const\"\nimport { clip } from \"#lib/rows\"\n\n/**\n * A live fact about the runtime, shown as a word rather than a sentence.\n *\n * `tone` is a role, never a colour — the component maps it. A literal colour name here would put\n * appearance in a pure module and break the one-home rule `theme.ts` exists for.\n */\nexport interface StateChip {\n readonly label: string\n readonly tone: \"ok\" | \"warn\" | \"off\"\n}\n\nexport interface ScreenHeader {\n /** Product identity — `BRAND.name` and the version. The one line that is the same everywhere. */\n readonly title: string\n /** What this screen is, and the counts that make it worth looking at. */\n readonly summary: string\n /**\n * The agent this screen acts on, when it acts on one.\n *\n * Present so it is impossible to install a skill into, or stop, an agent you did not mean.\n * Absent — not blank — on the machine-level screens: `sources` is a registry shared by every\n * agent on the machine, and naming one there would be a lie about the scope of what you are\n * changing.\n */\n readonly agent?: { readonly name: string; readonly model: string }\n readonly state?: readonly StateChip[]\n /** True for the whole session, so it stays in the frame rather than scrolling away. */\n readonly warnings?: readonly string[]\n}\n\nexport interface KeyHint {\n /** As a reader sees it: `↑↓`, `enter`, `^C`, `⌥⏎`. */\n readonly key: string\n readonly does: string\n}\n\nconst SEPARATOR = \" · \"\n/** Warnings past this many are counted rather than listed — a header is not a log. */\nconst WARNINGS_SHOWN = 3\n\n/**\n * One rendered line, tagged with what it is.\n *\n * Tagged rather than returned as plain strings because the component styles each kind differently and\n * the alternative is worse in both directions: a flat list of strings forces the renderer to guess by\n * index (which broke the first time a header had no state row), and having the renderer rebuild the\n * summary from `header.agent` itself would be a second derivation of the one thing this module exists\n * to derive once. The kind travels with the text; appearance stays in `theme.ts`.\n */\nexport interface HeaderLine {\n readonly kind: \"title\" | \"summary\" | \"state\" | \"warning\"\n readonly text: string\n}\n\n/** The header, as tagged lines, each already clipped to the width. */\nexport function headerLines(header: ScreenHeader, width: number): readonly HeaderLine[] {\n const lines: HeaderLine[] = [{ kind: \"title\", text: clip(header.title, width) }]\n\n // The agent rides on the summary line rather than taking one of its own. It is the same fact —\n // \"what am I looking at, and whose\" — and a separate line for it pushes the body down on every\n // screen to say something the summary was already the place for.\n const scope =\n header.agent === undefined\n ? header.summary\n : [`${header.agent.name}${SEPARATOR}${header.agent.model}`, header.summary]\n .filter((part) => part !== \"\")\n .join(SEPARATOR)\n if (scope !== \"\") lines.push({ kind: \"summary\", text: clip(scope, width) })\n\n const chips = header.state ?? []\n if (chips.length > 0) {\n lines.push({\n kind: \"state\",\n text: clip(chips.map((chip) => chip.label).join(SEPARATOR), width),\n })\n }\n\n const warnings = header.warnings ?? []\n for (const warning of warnings.slice(0, WARNINGS_SHOWN)) {\n lines.push({ kind: \"warning\", text: clip(`⚠ ${warning}`, width) })\n }\n // Counted, not dropped. A header that silently showed three of five warnings would be the\n // trimmed-catalogue failure again: true of what is on screen, false of what is the case.\n if (warnings.length > WARNINGS_SHOWN) {\n lines.push({\n kind: \"warning\",\n text: clip(`⚠ and ${warnings.length - WARNINGS_SHOWN} more`, width),\n })\n }\n\n return lines\n}\n\n/**\n * The footer: what the keys do, on one line, clipped.\n *\n * One line and never two. A footer that wraps moves the body every time the hints change, and the\n * hints change per screen state — so a two-line footer means the list jumps as you use it. Hints are\n * dropped from the end when they do not fit, which is why the caller orders them by how likely\n * somebody is to need reminding: movement first, the destructive one last.\n */\nexport function hintLine(hints: readonly KeyHint[], width: number): string {\n const rendered = hints.map((hint) => `${hint.key} ${hint.does}`)\n // Longest prefix that fits. Built up rather than clipped down, so the line never ends in half a\n // hint — `enter inst…` reads as a different key than the one it is.\n let line = \"\"\n for (const hint of rendered) {\n const next = line === \"\" ? hint : `${line}${SEPARATOR}${hint}`\n if ([...next].length > width) break\n line = next\n }\n // Nothing fit: one clipped hint beats an empty footer, because a screen with no visible way out\n // is the worst thing a full-screen surface can be.\n return line === \"\" ? clip(rendered[0] ?? \"\", width) : line\n}\n\n/**\n * The whole header on one line, for a surface that cannot spare three.\n *\n * The chat is that surface. Its opening banner already says the version, the store, the session and every\n * load warning — and on the alternate screen that banner scrolls out of the window, taking the\n * session-wide facts with it. `headerLines`' three-to-six rows would fix that and cost a fifth of a short\n * terminal permanently, so this is the compromise the rule actually asks for: identity and scope always\n * visible, warnings reduced to a count that says where the detail is.\n *\n * A count rather than the text, deliberately. One warning wrapped over two lines is a header that changes\n * height, which is the one thing a fixed-height frame cannot have.\n */\nexport function titleLine(header: ScreenHeader, width: number): string {\n const parts = [header.title]\n // The summary was dropped here while `Screen` renders it on its own dim line, so a surface using the\n // one-line variant silently lost its label: the conversation switcher passed \"pick a conversation\"\n // and the settings editor \"settings\", and neither ever appeared. Empty adds nothing, which is what\n // the chat header passes.\n if (header.summary !== \"\") parts.push(header.summary)\n if (header.agent !== undefined) parts.push(header.agent.name, header.agent.model)\n const warnings = header.warnings ?? []\n if (warnings.length > 0) {\n parts.push(`\\u26a0 ${warnings.length} note${warnings.length === 1 ? \"\" : \"s\"} at the top`)\n }\n return clip(parts.join(SEPARATOR), width)\n}\n\n/** The hint every alternate-screen surface carries, so no screen invents its own word for leaving. */\nexport const QUIT_HINT: KeyHint = { key: \"q\", does: \"back\" }\n\n/**\n * Terminal columns and rows a screen may use, clamped.\n *\n * Here rather than beside the one command that first needed them. They were exported from `browse.ts`,\n * which is imported both statically (by the wizard) and dynamically (by the command) — and the bundler\n * emitted the export twice, producing a `Duplicate export of 'windowFor'` that every test passed straight\n * through because tests import source, not the bundle. Screen arithmetic belongs with the screen.\n */\n/**\n * Zero means unknown, not zero.\n *\n * A pty genuinely reports a width of 0 — recorded in `lib/const.ts` beside `FALLBACK_COLUMNS`, measured\n * under `script -q`, and handled correctly in `useTerminalSize` since it was written. It was *not* handled\n * here, so a caller passing the stream's own measurement clamped to the 40-column floor and laid its rows\n * out for half the terminal. Found in a real capture: the session picker's rows came out 43 characters wide\n * on an 80-column screen, uniformly — which reads as a design choice rather than as a bug.\n *\n * `?? fallback` alone does not cover it, because 0 is not nullish. The same trap, one operator away.\n */\nfunction known(measured: number | undefined, fallback: number): number {\n return measured === undefined || measured <= 0 ? fallback : measured\n}\n\nexport function screenColumns(columns: number | undefined, fallback: number): number {\n return Math.max(MIN_SCREEN_COLUMNS, Math.min(MAX_SCREEN_COLUMNS, known(columns, fallback)))\n}\n\nexport function screenRows(rows: number | undefined, fallback: number): number {\n return Math.max(\n MIN_SCREEN_ROWS,\n Math.min(MAX_SCREEN_ROWS, known(rows, fallback) - SCREEN_CHROME_ROWS),\n )\n}\n"
6
6
  ],
7
7
  "mappings": ";mFAsEA,IAAM,EAAY,MAEZ,EAAiB,EAiBhB,SAAS,EAAW,CAAC,EAAsB,EAAsC,CACpF,IAAM,EAAsB,CAAC,CAAE,KAAM,QAAS,KAAM,EAAK,EAAO,MAAO,CAAK,CAAE,CAAC,EAKzE,EACF,EAAO,QAAU,OACX,EAAO,QACP,CAAC,GAAG,EAAO,MAAM,OAAO,IAAY,EAAO,MAAM,QAAS,EAAO,OAAO,EACnE,OAAO,CAAC,IAAS,IAAS,EAAE,EAC5B,KAAK,CAAS,EAC7B,GAAI,IAAU,GAAI,EAAM,KAAK,CAAE,KAAM,UAAW,KAAM,EAAK,EAAO,CAAK,CAAE,CAAC,EAE1E,IAAM,EAAQ,EAAO,OAAS,CAAC,EAC/B,GAAI,EAAM,OAAS,EACf,EAAM,KAAK,CACP,KAAM,QACN,KAAM,EAAK,EAAM,IAAI,CAAC,IAAS,EAAK,KAAK,EAAE,KAAK,CAAS,EAAG,CAAK,CACrE,CAAC,EAGL,IAAM,EA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AAC,EAGvF,SAAS,EAAU,CAAC,EAA0B,EAA0B,CAC3E,OAAO,KAAK,IACR,GACA,KAAK,IAAI,GAAiB,EAAM,EAAM,CAAQ,EAAI,EAAkB,CACxE",
8
- "debugId": "CCA62814AD4503FC64756E2164756E21",
8
+ "debugId": "7B1D4820D6A9D3AB64756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import{u}from"./index-d4x6yvqh.js";var a=" ",i=2;function l(t){let r=t.filter((n)=>n.value!=="");if(r.length===0)return"";let e=Math.max(...r.map((n)=>n.label.length));return r.map((n)=>{let o=`${a}${n.label.padEnd(e)}${" ".repeat(i)}${n.value}`;return n.note===void 0?o:`${o}${" ".repeat(i)}${n.note}`}).join(`
3
- `)}function p(t,r=!1){return r?t:`
4
- ${t}`}function d(t){return`${a}${u.bullet}${t}`}function c(t,r=2){let e=" ".repeat(r);return t.split(`
2
+ import{I}from"./index-nn3tk25c.js";var u=" ",i=2;function g(t){let r=t.filter((n)=>n.value!=="");if(r.length===0)return"";let e=Math.max(...r.map((n)=>n.label.length));return r.map((n)=>{let o=`${u}${n.label.padEnd(e)}${" ".repeat(i)}${n.value}`;return n.note===void 0?o:`${o}${" ".repeat(i)}${n.note}`}).join(`
3
+ `)}function B(t,r=!1){return r?t:`
4
+ ${t}`}function l(t){return`${u}${I.bullet}${t}`}function c(t,r=2){let e=" ".repeat(r);return t.split(`
5
5
  `).map((n)=>n===""?n:`${e}${n}`).join(`
6
- `)}function bt(t){if(!Number.isFinite(t)||t<0)return"unknown";if(t<1024)return`${Math.round(t)} B`;let r=["KB","MB","GB","TB"],e=t/1024,n=0;while(e>=1024&&n<r.length-1)e/=1024,n+=1;return`${e<10?e.toFixed(1):Math.round(e)} ${r[n]}`}function or(t){if(!Number.isFinite(t)||t<0)return"unknown";let r=Math.floor(t/1000);if(r<60)return`${r}s`;let e=Math.floor(r/60);if(e<60)return`${e}m ${r%60}s`;let n=Math.floor(e/60);if(n<24)return`${n}h ${e%60}m`;return`${Math.floor(n/24)}d ${n%24}h`}function vt(t,r){if(r===""||!t.startsWith(r))return t;let e=t.slice(r.length);return e===""?"~":e.startsWith("/")?`~${e}`:t}var f=60000,s=24;function qe(t,r){let e=r-Date.parse(t);if(Number.isNaN(e))return t;let n=Math.floor(e/f);if(n<1)return"just now";if(n<60)return`${n}m ago`;let o=Math.floor(n/60);if(o<s)return`${o}h ago`;return`${Math.floor(o/s)}d ago`}
7
- export{l,p,d,c,bt,or,vt,qe};
6
+ `)}function iA(t){if(!Number.isFinite(t)||t<0)return"unknown";if(t<1024)return`${Math.round(t)} B`;let r=["KB","MB","GB","TB"],e=t/1024,n=0;while(e>=1024&&n<r.length-1)e/=1024,n+=1;return`${e<10?e.toFixed(1):Math.round(e)} ${r[n]}`}function ZA(t){if(!Number.isFinite(t)||t<0)return"unknown";let r=Math.floor(t/1000);if(r<60)return`${r}s`;let e=Math.floor(r/60);if(e<60)return`${e}m ${r%60}s`;let n=Math.floor(e/60);if(n<24)return`${n}h ${e%60}m`;return`${Math.floor(n/24)}d ${n%24}h`}function rA(t,r){if(r===""||!t.startsWith(r))return t;let e=t.slice(r.length);return e===""?"~":e.startsWith("/")?`~${e}`:t}var a=60000,s=24;function sA(t,r){let e=r-Date.parse(t);if(Number.isNaN(e))return t;let n=Math.floor(e/a);if(n<1)return"just now";if(n<60)return`${n}m ago`;let o=Math.floor(n/60);if(o<s)return`${o}h ago`;return`${Math.floor(o/s)}d ago`}
7
+ export{g,B,l,c,iA,ZA,rA,sA};
8
8
 
9
- //# debugId=346FEC51D619EB9F64756E2164756E21
10
- //# sourceMappingURL=index-j7gyr5nx.js.map
9
+ //# debugId=66EB4F0CCF08662664756E2164756E21
10
+ //# sourceMappingURL=index-wzsmh5j0.js.map
@@ -5,6 +5,6 @@
5
5
  "/**\n * The plain path's shared vocabulary — the half of the house style that never had one.\n *\n * `theme.ts` serves the Ink path. The plain path is most of the binary, and until this file every\n * command that printed a labelled block invented its own: eight hand-rolled `padEnd` widths across\n * seven files (9, 14, `FLAG_COLUMN`, `ENV_COLUMN`, `COMMAND_COLUMN`, and three computed maxima),\n * with `agents.ts` emitting tab-separated columns while everything beside it emitted padded ones.\n * `agents` and `validate` genuinely looked like output from two different products.\n *\n * So this is not a new style — it is the existing one, written down once. A new surface that wants\n * a labelled block, a status word or a byte count reaches here rather than adding a ninth variant.\n *\n * **Pure.** No `node:*`, no `process`, no colour decision. Every function is text in, text out, so\n * it belongs on the boundaries test's `PURE` list and every rendering rule is unit-testable without\n * capturing stdout. Colour is deliberately *not* applied here: the plain path is read as often from\n * a log file as from a terminal, and a module that emitted escape codes would have to know which,\n * which is `resolveMode`'s job and nowhere near a formatter's.\n */\n\nimport { GLYPH } from \"#lib/theme\"\n\n/** Where a labelled block starts, and the space between the widest label and its value. */\nconst INDENT = \" \"\nconst GAP = 2\n\nexport interface Row {\n readonly label: string\n readonly value: string\n /**\n * Trailing text, aligned past the value.\n *\n * Its own field rather than something the caller concatenates, because the interesting rows\n * are the ones carrying a fact *and* its consequence — \"2463 · launchd has restarted this\n * 2463 times\" — and a caller building that by hand loses the alignment on the next row.\n */\n readonly note?: string\n}\n\n/**\n * A labelled block: two-space indent, labels padded to the widest, values aligned.\n *\n * Rows with an empty value are dropped rather than printed blank. A field that does not apply is\n * not the same as a field that is empty, and printing `logs` with nothing after it invites the\n * reader to wonder which one they are looking at.\n */\nexport function keyValue(rows: readonly Row[]): string {\n const shown = rows.filter((row) => row.value !== \"\")\n if (shown.length === 0) return \"\"\n const width = Math.max(...shown.map((row) => row.label.length))\n return shown\n .map((row) => {\n const head = `${INDENT}${row.label.padEnd(width)}${\" \".repeat(GAP)}${row.value}`\n return row.note === undefined ? head : `${head}${\" \".repeat(GAP)}${row.note}`\n })\n .join(\"\\n\")\n}\n\n/** A heading with its own blank line above, unless it opens the output. */\nexport function section(title: string, first = false): string {\n return first ? title : `\\n${title}`\n}\n\nexport function bullet(text: string): string {\n return `${INDENT}${GLYPH.bullet}${text}`\n}\n\n/** Indent a block that was rendered elsewhere — a log tail, a nested report. */\nexport function indent(text: string, depth = 2): string {\n const pad = \" \".repeat(depth)\n return text\n .split(\"\\n\")\n .map((line) => (line === \"\" ? line : `${pad}${line}`))\n .join(\"\\n\")\n}\n\n/**\n * Bytes as a person reads them.\n *\n * Binary units, and the decimal place only below 10 in each unit — `1.2 MB` is worth a digit,\n * `847 MB` is not, and the extra precision only makes a size harder to compare at a glance.\n */\nexport function bytes(count: number): string {\n if (!Number.isFinite(count) || count < 0) return \"unknown\"\n if (count < 1024) return `${Math.round(count)} B`\n const units = [\"KB\", \"MB\", \"GB\", \"TB\"]\n let value = count / 1024\n let unit = 0\n while (value >= 1024 && unit < units.length - 1) {\n value /= 1024\n unit += 1\n }\n return `${value < 10 ? value.toFixed(1) : Math.round(value)} ${units[unit]}`\n}\n\n/**\n * A span, in the largest two units that carry information.\n *\n * \"3h 12m\" rather than \"3.2 hours\" or \"11520 seconds\": an uptime is read to answer \"since roughly\n * when\", and two units is where that question stops getting better answers.\n */\nexport function duration(ms: number): string {\n if (!Number.isFinite(ms) || ms < 0) return \"unknown\"\n const seconds = Math.floor(ms / 1000)\n if (seconds < 60) return `${seconds}s`\n const minutes = Math.floor(seconds / 60)\n if (minutes < 60) return `${minutes}m ${seconds % 60}s`\n const hours = Math.floor(minutes / 60)\n if (hours < 24) return `${hours}h ${minutes % 60}m`\n return `${Math.floor(hours / 24)}d ${hours % 24}h`\n}\n\n/**\n * `~/…` for a path under home, so a block of paths stays readable at a glance.\n *\n * Takes `home` rather than reading it, because this module is pure — and because the daemon's\n * output has to be able to render a path under a *different* home than the current process's when\n * it is describing a service definition it did not write.\n */\nexport function tildify(path: string, home: string): string {\n if (home === \"\" || !path.startsWith(home)) return path\n const rest = path.slice(home.length)\n return rest === \"\" ? \"~\" : rest.startsWith(\"/\") ? `~${rest}` : path\n}\n\nconst MINUTE_MS = 60_000\nconst HOURS_PER_DAY = 24\n\n/**\n * How long ago, in the shortest honest form.\n *\n * `now` is a parameter rather than a `Date.now()` call, which is what lets this live in a pure module and\n * be shared. It was previously private to `sessions.ts` and read the clock itself, so the session picker\n * would have had to reimplement it — and two renderings of \"how old is this conversation\" that disagree\n * is the drift this module exists to end.\n *\n * An unparseable timestamp is returned as itself. A store row with a bad date is a real thing to see, and\n * \"NaNm ago\" says nothing about it.\n */\nexport function ago(iso: string, now: number): string {\n const ms = now - Date.parse(iso)\n if (Number.isNaN(ms)) return iso\n const mins = Math.floor(ms / MINUTE_MS)\n if (mins < 1) return \"just now\"\n if (mins < 60) return `${mins}m ago`\n const hours = Math.floor(mins / 60)\n if (hours < HOURS_PER_DAY) return `${hours}h ago`\n return `${Math.floor(hours / HOURS_PER_DAY)}d ago`\n}\n"
6
6
  ],
7
7
  "mappings": ";mCAsBA,IAAM,EAAS,KACT,EAAM,EAsBL,SAAS,CAAQ,CAAC,EAA8B,CACnD,IAAM,EAAQ,EAAK,OAAO,CAAC,IAAQ,EAAI,QAAU,EAAE,EACnD,GAAI,EAAM,SAAW,EAAG,MAAO,GAC/B,IAAM,EAAQ,KAAK,IAAI,GAAG,EAAM,IAAI,CAAC,IAAQ,EAAI,MAAM,MAAM,CAAC,EAC9D,OAAO,EACF,IAAI,CAAC,IAAQ,CACV,IAAM,EAAO,GAAG,IAAS,EAAI,MAAM,OAAO,CAAK,IAAI,IAAI,OAAO,CAAG,IAAI,EAAI,QACzE,OAAO,EAAI,OAAS,OAAY,EAAO,GAAG,IAAO,IAAI,OAAO,CAAG,IAAI,EAAI,OAC1E,EACA,KAAK;AAAA,CAAI,EAIX,SAAS,CAAO,CAAC,EAAe,EAAQ,GAAe,CAC1D,OAAO,EAAQ,EAAQ;AAAA,EAAK,IAGzB,SAAS,CAAM,CAAC,EAAsB,CACzC,MAAO,GAAG,IAAS,EAAM,SAAS,IAI/B,SAAS,CAAM,CAAC,EAAc,EAAQ,EAAW,CACpD,IAAM,EAAM,IAAI,OAAO,CAAK,EAC5B,OAAO,EACF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,OAAO,MAAM,CAAE,EAAG,OAAO,EAC7B,IAAM,EAAO,KAAK,MAAM,EAAK,CAAS,EACtC,GAAI,EAAO,EAAG,MAAO,WACrB,GAAI,EAAO,GAAI,MAAO,GAAG,SACzB,IAAM,EAAQ,KAAK,MAAM,EAAO,EAAE,EAClC,GAAI,EAAQ,EAAe,MAAO,GAAG,SACrC,MAAO,GAAG,KAAK,MAAM,EAAQ,CAAa",
8
- "debugId": "346FEC51D619EB9F64756E2164756E21",
8
+ "debugId": "66EB4F0CCF08662664756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
- import{zo}from"./index-3g3ny01d.js";import{Wo}from"./index-d4x6yvqh.js";import{ts,Cr}from"./index-vgc3y3rm.js";var D={value:"",cursor:0,history:[],historyOffset:0,draft:"",past:[],future:[],search:void 0,anchor:void 0};function c(r){return[...r]}function u(r,e){return Math.max(0,Math.min(r,e))}function h(r){return{value:r.value,cursor:r.cursor}}function d(r,e){let n=r.past.at(-1);if(e.coalesce&&n!==void 0&&r.future.length===0)return{...r,future:[]};if(n!==void 0&&n.value===r.value)return{...r,future:[]};return{...r,past:[...r.past,h(r)].slice(-Cr),future:[]}}function a(r,e){return{...r,value:e,cursor:c(e).length}}function k(r,e){let n=d(r,{coalesce:!e.includes(`
2
+ import{yi}from"./index-5nwwekk0.js";import{Si}from"./index-nn3tk25c.js";import{Ti,uo}from"./index-2zye08c4.js";var K={value:"",cursor:0,history:[],historyOffset:0,draft:"",past:[],future:[],search:void 0,anchor:void 0};function c(r){return[...r]}function u(r,e){return Math.max(0,Math.min(r,e))}function h(r){return{value:r.value,cursor:r.cursor}}function d(r,e){let n=r.past.at(-1);if(e.coalesce&&n!==void 0&&r.future.length===0)return{...r,future:[]};if(n!==void 0&&n.value===r.value)return{...r,future:[]};return{...r,past:[...r.past,h(r)].slice(-uo),future:[]}}function a(r,e){return{...r,value:e,cursor:c(e).length}}function k(r,e){let n=d(r,{coalesce:!e.includes(`
3
3
  `)}),o=c(n.value),t=u(n.cursor,o.length),i=[...o.slice(0,t),...c(e),...o.slice(t)];return{...n,value:i.join(""),cursor:t+c(e).length}}function E(r){let e=c(r.value),n=u(r.cursor,e.length);if(n===0)return r;let o=d(r,{coalesce:!1}),t=[...e.slice(0,n-1),...e.slice(n)];return{...o,value:t.join(""),cursor:n-1}}function y(r){let e=c(r.value),n=u(r.cursor,e.length);if(n>=e.length)return r;return{...d(r,{coalesce:!1}),value:[...e.slice(0,n),...e.slice(n+1)].join("")}}function f(r){return r===void 0||/\s/.test(r)}function v(r,e){let n=e;while(n>0&&f(r[n-1]))n-=1;while(n>0&&!f(r[n-1]))n-=1;return n}function b(r,e){let n=e;while(n<r.length&&f(r[n]))n+=1;while(n<r.length&&!f(r[n]))n+=1;return n}function x(r){let e=c(r.value),n=v(e,u(r.cursor,e.length));if(n===r.cursor)return r;return{...d(r,{coalesce:!1}),value:[...e.slice(0,n),...e.slice(r.cursor)].join(""),cursor:n}}function A(r){let e=c(r.value),n=u(r.cursor,e.length),o=b(e,n);if(o===n)return r;return{...d(r,{coalesce:!1}),value:[...e.slice(0,n),...e.slice(o)].join("")}}function l(r,e){let n=c(r),o=u(e,n.length),t=o;while(t>0&&n[t-1]!==`
4
4
  `)t-=1;let i=o;while(i<n.length&&n[i]!==`
5
- `)i+=1;return{start:t,end:i}}function ar(r){let e=c(r.value),n=u(r.cursor,e.length),o=e.slice(0,n),{start:t}=l(r.value,n);return{line:o.filter((i)=>i===`
5
+ `)i+=1;return{start:t,end:i}}function Kn(r){let e=c(r.value),n=u(r.cursor,e.length),o=e.slice(0,n),{start:t}=l(r.value,n);return{line:o.filter((i)=>i===`
6
6
  `).length,lines:e.filter((i)=>i===`
7
- `).length+1,column:n-t}}function p(r,e){let n=c(r.value),o=u(r.cursor,n.length),t=l(r.value,o),i=o-t.start;if(e<0){if(t.start===0)return r;let m=l(r.value,t.start-1);return{...r,cursor:Math.min(m.start+i,m.end)}}if(t.end>=n.length)return r;let s=l(r.value,t.end+1);return{...r,cursor:Math.min(s.start+i,s.end)}}function L(r){if(r.history.length===0)return r;let e=Math.min(r.historyOffset+1,r.history.length),n=r.history[r.history.length-e];if(n===void 0)return r;return a({...d(r,{coalesce:!1}),historyOffset:e,draft:r.historyOffset===0?r.value:r.draft},n)}function I(r){if(r.historyOffset===0)return r;let e=r.historyOffset-1,n=d(r,{coalesce:!1});if(e===0)return a({...n,historyOffset:0},r.draft);let o=r.history[r.history.length-e];return o===void 0?r:a({...n,historyOffset:e},o)}function Ut(r){let e=(r.search?.query??"").toLowerCase(),n=new Set,o=[];for(let t=r.history.length-1;t>=0;t-=1){let i=r.history[t];if(i===void 0||n.has(i))continue;if(e===""||i.toLowerCase().includes(e))n.add(i),o.push(i)}return o}function C(r){let e=Ut(r);return e[u(r.search?.index??0,Math.max(0,e.length-1))]}function g(r,e){let n=r.search;if(n===void 0)return r;let o=Ut(r);if(o.length===0)return r;return{...r,search:{...n,index:u(n.index+e,o.length-1)}}}function T(r,e){let n=r.search;if(n===void 0)return r;return{...r,search:{query:n.query+e,index:0}}}function M(r){let e=r.search;if(e===void 0)return r;let n=c(e.query).slice(0,-1).join("");return{...r,search:{query:n,index:0}}}function O(r){let e=C(r);if(e===void 0)return{...r,search:void 0};return a({...d(r,{coalesce:!1}),search:void 0},e)}function K(r){let e=r.past.at(-1);if(e===void 0)return r;return{...r,value:e.value,cursor:u(e.cursor,c(e.value).length),past:r.past.slice(0,-1),future:[h(r),...r.future],historyOffset:0}}function j(r){let e=r.future[0];if(e===void 0)return r;return{...r,value:e.value,cursor:u(e.cursor,c(e.value).length),past:[...r.past,h(r)].slice(-Cr),future:r.future.slice(1)}}function kt(r){if(r.anchor===void 0||r.anchor===r.cursor)return;return r.anchor<r.cursor?{start:r.anchor,end:r.cursor}:{start:r.cursor,end:r.anchor}}function w(r){let e=kt(r);if(e===void 0)return{...r,anchor:void 0};let n=c(r.value);return{...d(r,{coalesce:!1}),value:[...n.slice(0,e.start),...n.slice(e.end)].join(""),cursor:e.start,anchor:void 0}}function R(r){return r.kind==="insert"||r.kind==="newline"||r.kind==="backspace"||r.kind==="delete"}function V(r,e){if(r.search===void 0&&R(e)&&kt(r)!==void 0){let o=w(r);if(e.kind==="backspace"||e.kind==="delete")return o;return V(o,e)}if(e.kind==="extend"){let o=r.anchor??r.cursor;return{...V({...r,anchor:void 0},{kind:e.to}),anchor:o}}if(e.kind==="cutSelection")return w(r);if(e.kind==="copySelection")return r;if(e.kind==="selectAll")return{...r,anchor:0,cursor:c(r.value).length};let n=W(r,e);return n.anchor===void 0?n:{...n,anchor:void 0}}function W(r,e){if(r.search!==void 0)switch(e.kind){case"insert":return T(r,e.text);case"backspace":return M(r);case"historyPrev":case"lineUp":return g(r,1);case"historyNext":case"lineDown":return g(r,-1);case"searchAccept":return O(r);case"searchCancel":return{...r,search:void 0};case"searchOpen":return r;default:return{...r,search:void 0}}switch(e.kind){case"insert":return k(r,e.text);case"newline":return k(r,`
8
- `);case"backspace":return E(r);case"delete":return y(r);case"cursorLeft":return{...r,cursor:u(r.cursor-1,c(r.value).length)};case"cursorRight":return{...r,cursor:u(r.cursor+1,c(r.value).length)};case"cursorHome":return{...r,cursor:l(r.value,r.cursor).start};case"cursorEnd":return{...r,cursor:l(r.value,r.cursor).end};case"bufferStart":return{...r,cursor:0};case"bufferEnd":return{...r,cursor:c(r.value).length};case"wordLeft":return{...r,cursor:v(c(r.value),r.cursor)};case"wordRight":return{...r,cursor:b(c(r.value),r.cursor)};case"lineUp":return p(r,-1);case"lineDown":return p(r,1);case"killToStart":{let{start:n}=l(r.value,r.cursor);if(n===r.cursor)return r;let o=c(r.value);return{...d(r,{coalesce:!1}),value:[...o.slice(0,n),...o.slice(r.cursor)].join(""),cursor:n}}case"killToEnd":{let{end:n}=l(r.value,r.cursor);if(n===r.cursor)return r;let o=c(r.value);return{...d(r,{coalesce:!1}),value:[...o.slice(0,r.cursor),...o.slice(n)].join("")}}case"killWord":return x(r);case"killWordForward":return A(r);case"historyPrev":return L(r);case"historyNext":return I(r);case"undo":return K(r);case"redo":return j(r);case"searchOpen":return{...r,search:{query:"",index:0}};case"searchAccept":case"searchCancel":case"submit":case"cancel":case"exit":case"arm":case"scroll":case"pointer":case"reasoning":case"paste":case"none":return r;case"extend":case"selectAll":case"copySelection":case"cutSelection":return r}}function Uo(r){let e=r.value.trim();if(e==="")return{text:"",state:{...D,history:r.history}};let o=r.history.at(-1)===e?r.history:[...r.history,e].slice(-ts);return{text:e,state:{...D,history:o}}}function kn(r,e,n={}){let{line:o,lines:t}=ar(r);return{busy:e,empty:r.value==="",firstLine:o===0,lastLine:o===t-1,searching:r.search!==void 0,armed:n.armed??!1,scrolled:n.scrolled??!1}}function H(r,e){switch(r){case"c":if(e.searching)return{kind:"searchCancel"};if(e.busy)return{kind:"cancel"};return e.armed?{kind:"exit"}:{kind:"arm"};case"d":return e.empty?{kind:"exit"}:{kind:"delete"};case"a":return{kind:"cursorHome"};case"e":return{kind:"cursorEnd"};case"b":return{kind:"cursorLeft"};case"f":return{kind:"cursorRight"};case"u":return{kind:"killToStart"};case"k":return{kind:"killToEnd"};case"w":return{kind:"killWord"};case"p":return{kind:"historyPrev"};case"n":return{kind:"historyNext"};case"r":return{kind:"searchOpen"};case"o":return{kind:"reasoning"};case"z":return{kind:"undo"};case"y":return{kind:"redo"};default:return{kind:"none"}}}function jt(r,e,n){let o=Wo(r);if(o!==void 0){if(o.rows!==0)return{kind:"scroll",move:o.rows<0?"up":"down",times:Math.abs(o.rows)};if(o.at!==void 0&&o.kind!==void 0&&o.kind!=="wheel")return{kind:"pointer",gesture:o.kind,column:o.at.column,row:o.at.row,shift:o.shift===!0};return{kind:"none"}}if(e.eventType==="release")return{kind:"none"};if(e.shift){let i=B(e);if(i!==void 0)return{kind:"extend",to:i}}if(e.super){if(e.leftArrow)return{kind:"cursorHome"};if(e.rightArrow)return{kind:"cursorEnd"};if(e.upArrow)return{kind:"bufferStart"};if(e.downArrow)return{kind:"bufferEnd"};if(e.backspace)return{kind:"killToStart"};if(e.delete)return{kind:"killToEnd"};if(r==="z")return e.shift?{kind:"redo"}:{kind:"undo"};if(r==="a")return{kind:"selectAll"};if(r==="c")return{kind:"copySelection"};if(r==="x")return{kind:"cutSelection"};return{kind:"none"}}if(zo(r))return{kind:"none"};if(e.ctrl&&e.leftArrow)return{kind:"wordLeft"};if(e.ctrl&&e.rightArrow)return{kind:"wordRight"};if(e.ctrl&&e.backspace)return{kind:"killWord"};if(e.ctrl)return H(r.toLowerCase(),n);if(e.meta){if(e.return)return{kind:"newline"};if(e.pageUp)return{kind:"scroll",move:"top"};if(e.pageDown)return{kind:"scroll",move:"bottom"};if(e.upArrow)return{kind:"scroll",move:"up"};if(e.downArrow)return{kind:"scroll",move:"down"};if(e.leftArrow||r==="b")return{kind:"wordLeft"};if(e.rightArrow||r==="f")return{kind:"wordRight"};if(e.backspace)return{kind:"killWord"};if(r==="d")return{kind:"killWordForward"};if(r==="r")return{kind:"reasoning"};return{kind:"none"}}if(e.return&&e.shift)return{kind:"newline"};if(e.pageUp)return{kind:"scroll",move:"pageUp"};if(e.pageDown)return{kind:"scroll",move:"pageDown"};if(e.home)return{kind:"cursorHome"};if(e.end)return{kind:"cursorEnd"};if(e.return)return n.searching?{kind:"searchAccept"}:{kind:"submit"};if(e.backspace)return{kind:"backspace"};if(e.delete)return{kind:"delete"};if(e.leftArrow)return{kind:"cursorLeft"};if(e.rightArrow)return{kind:"cursorRight"};if(e.upArrow)return n.searching||n.firstLine?{kind:"historyPrev"}:{kind:"lineUp"};if(e.downArrow)return n.searching||n.lastLine?{kind:"historyNext"}:{kind:"lineDown"};if(e.escape){if(n.searching)return{kind:"searchCancel"};return n.scrolled?{kind:"scroll",move:"bottom"}:{kind:"none"}}if(e.tab)return{kind:"none"};if(r==="")return{kind:"none"};if(r==="\x1B[H"||r==="\x1B[1~")return{kind:"cursorHome"};if(r==="\x1B[F"||r==="\x1B[4~")return{kind:"cursorEnd"};if(/[\r\n]/.test(r)){let i=r.split(/\r\n|[\r\n]/).map(S),s=i.at(-1)===""&&i.length>1;return{kind:"paste",lines:s?i.slice(0,-1):i,complete:s}}let t=S(r);return t===""?{kind:"none"}:{kind:"insert",text:t}}function B(r){if(r.super){if(r.leftArrow)return"cursorHome";if(r.rightArrow)return"cursorEnd";if(r.upArrow)return"bufferStart";if(r.downArrow)return"bufferEnd";return}if(r.meta||r.ctrl){if(r.leftArrow)return"wordLeft";if(r.rightArrow)return"wordRight";return}if(r.home)return"cursorHome";if(r.end)return"cursorEnd";if(r.leftArrow)return"cursorLeft";if(r.rightArrow)return"cursorRight";if(r.upArrow)return"lineUp";if(r.downArrow)return"lineDown";return}function S(r){return[...r].filter((e)=>{let n=e.codePointAt(0)??0;return n>=32&&n!==127}).join("")}function zt(r,e){if(e.ctrl)return r.toLowerCase()==="c"||r.toLowerCase()==="d"?{kind:"cancel"}:{kind:"none"};if(e.return)return{kind:"confirm"};if(e.escape)return{kind:"cancel"};if(r===" ")return{kind:"toggle"};if(r==="a")return{kind:"all"};if(r==="n")return{kind:"none-selected"};let n=be(r,e);return n.kind==="move"?n:{kind:"none"}}function be(r,e){if(e.ctrl)return r.toLowerCase()==="c"||r.toLowerCase()==="d"?{kind:"exit"}:{kind:"none"};if(e.return)return{kind:"choose"};if(e.escape)return{kind:"back"};if(e.upArrow)return{kind:"move",move:{kind:"up"}};if(e.downArrow)return{kind:"move",move:{kind:"down"}};switch(r){case"k":return{kind:"move",move:{kind:"up"}};case"j":return{kind:"move",move:{kind:"down"}};case"g":return{kind:"move",move:{kind:"first"}};case"G":return{kind:"move",move:{kind:"last"}};default:break}if(/^[1-9]$/.test(r))return{kind:"move",move:{kind:"jump",index:Number(r)-1}};return{kind:"none"}}function Sn(r,e,n){if(e.ctrl&&r.toLowerCase()==="c")return{kind:"abort"};if(e.escape)return{kind:"back"};if(e.return)return{kind:"commit"};if(n.select)return{kind:"list",intent:be(r,e)};let o=jt(r,e,{busy:!1,empty:n.empty,firstLine:!0,lastLine:!0,searching:!1,armed:!1,scrolled:!1});switch(o.kind){case"submit":return{kind:"commit"};case"exit":return{kind:"abort"};case"arm":case"scroll":return{kind:"edit",intent:{kind:"none"}};case"historyPrev":case"historyNext":return{kind:"edit",intent:{kind:"none"}};case"paste":return{kind:"edit",intent:{kind:"insert",text:o.lines[0]??""}};default:return{kind:"edit",intent:o}}}
9
- export{D,ar,Ut,kt,V,Uo,kn,jt,zt,be,Sn};
7
+ `).length+1,column:n-t}}function p(r,e){let n=c(r.value),o=u(r.cursor,n.length),t=l(r.value,o),i=o-t.start;if(e<0){if(t.start===0)return r;let m=l(r.value,t.start-1);return{...r,cursor:Math.min(m.start+i,m.end)}}if(t.end>=n.length)return r;let s=l(r.value,t.end+1);return{...r,cursor:Math.min(s.start+i,s.end)}}function L(r){if(r.history.length===0)return r;let e=Math.min(r.historyOffset+1,r.history.length),n=r.history[r.history.length-e];if(n===void 0)return r;return a({...d(r,{coalesce:!1}),historyOffset:e,draft:r.historyOffset===0?r.value:r.draft},n)}function I(r){if(r.historyOffset===0)return r;let e=r.historyOffset-1,n=d(r,{coalesce:!1});if(e===0)return a({...n,historyOffset:0},r.draft);let o=r.history[r.history.length-e];return o===void 0?r:a({...n,historyOffset:e},o)}function XA(r){let e=(r.search?.query??"").toLowerCase(),n=new Set,o=[];for(let t=r.history.length-1;t>=0;t-=1){let i=r.history[t];if(i===void 0||n.has(i))continue;if(e===""||i.toLowerCase().includes(e))n.add(i),o.push(i)}return o}function C(r){let e=XA(r);return e[u(r.search?.index??0,Math.max(0,e.length-1))]}function g(r,e){let n=r.search;if(n===void 0)return r;let o=XA(r);if(o.length===0)return r;return{...r,search:{...n,index:u(n.index+e,o.length-1)}}}function T(r,e){let n=r.search;if(n===void 0)return r;return{...r,search:{query:n.query+e,index:0}}}function M(r){let e=r.search;if(e===void 0)return r;let n=c(e.query).slice(0,-1).join("");return{...r,search:{query:n,index:0}}}function O(r){let e=C(r);if(e===void 0)return{...r,search:void 0};return a({...d(r,{coalesce:!1}),search:void 0},e)}function j(r){let e=r.past.at(-1);if(e===void 0)return r;return{...r,value:e.value,cursor:u(e.cursor,c(e.value).length),past:r.past.slice(0,-1),future:[h(r),...r.future],historyOffset:0}}function R(r){let e=r.future[0];if(e===void 0)return r;return{...r,value:e.value,cursor:u(e.cursor,c(e.value).length),past:[...r.past,h(r)].slice(-uo),future:r.future.slice(1)}}function vA(r){if(r.anchor===void 0||r.anchor===r.cursor)return;return r.anchor<r.cursor?{start:r.anchor,end:r.cursor}:{start:r.cursor,end:r.anchor}}function w(r){let e=vA(r);if(e===void 0)return{...r,anchor:void 0};let n=c(r.value);return{...d(r,{coalesce:!1}),value:[...n.slice(0,e.start),...n.slice(e.end)].join(""),cursor:e.start,anchor:void 0}}function W(r){return r.kind==="insert"||r.kind==="newline"||r.kind==="backspace"||r.kind==="delete"}function te(r,e){if(r.search===void 0&&W(e)&&vA(r)!==void 0){let o=w(r);if(e.kind==="backspace"||e.kind==="delete")return o;return te(o,e)}if(e.kind==="extend"){let o=r.anchor??r.cursor;return{...te({...r,anchor:void 0},{kind:e.to}),anchor:o}}if(e.kind==="cutSelection")return w(r);if(e.kind==="copySelection")return r;if(e.kind==="selectAll")return{...r,anchor:0,cursor:c(r.value).length};let n=D(r,e);return n.anchor===void 0?n:{...n,anchor:void 0}}function D(r,e){if(r.search!==void 0)switch(e.kind){case"insert":return T(r,e.text);case"backspace":return M(r);case"historyPrev":case"lineUp":return g(r,1);case"historyNext":case"lineDown":return g(r,-1);case"searchAccept":return O(r);case"searchCancel":return{...r,search:void 0};case"searchOpen":return r;default:return{...r,search:void 0}}switch(e.kind){case"insert":return k(r,e.text);case"newline":return k(r,`
8
+ `);case"backspace":return E(r);case"delete":return y(r);case"cursorLeft":return{...r,cursor:u(r.cursor-1,c(r.value).length)};case"cursorRight":return{...r,cursor:u(r.cursor+1,c(r.value).length)};case"cursorHome":return{...r,cursor:l(r.value,r.cursor).start};case"cursorEnd":return{...r,cursor:l(r.value,r.cursor).end};case"bufferStart":return{...r,cursor:0};case"bufferEnd":return{...r,cursor:c(r.value).length};case"wordLeft":return{...r,cursor:v(c(r.value),r.cursor)};case"wordRight":return{...r,cursor:b(c(r.value),r.cursor)};case"lineUp":return p(r,-1);case"lineDown":return p(r,1);case"killToStart":{let{start:n}=l(r.value,r.cursor);if(n===r.cursor)return r;let o=c(r.value);return{...d(r,{coalesce:!1}),value:[...o.slice(0,n),...o.slice(r.cursor)].join(""),cursor:n}}case"killToEnd":{let{end:n}=l(r.value,r.cursor);if(n===r.cursor)return r;let o=c(r.value);return{...d(r,{coalesce:!1}),value:[...o.slice(0,r.cursor),...o.slice(n)].join("")}}case"killWord":return x(r);case"killWordForward":return A(r);case"historyPrev":return L(r);case"historyNext":return I(r);case"undo":return j(r);case"redo":return R(r);case"searchOpen":return{...r,search:{query:"",index:0}};case"searchAccept":case"searchCancel":case"submit":case"cancel":case"exit":case"arm":case"scroll":case"pointer":case"reasoning":case"paste":case"none":return r;case"extend":case"selectAll":case"copySelection":case"cutSelection":return r}}function Qi(r){let e=r.value.trim();if(e==="")return{text:"",state:{...K,history:r.history}};let o=r.history.at(-1)===e?r.history:[...r.history,e].slice(-Ti);return{text:e,state:{...K,history:o}}}function qt(r,e,n={}){let{line:o,lines:t}=Kn(r);return{busy:e,empty:r.value==="",firstLine:o===0,lastLine:o===t-1,searching:r.search!==void 0,armed:n.armed??!1,scrolled:n.scrolled??!1}}function H(r,e){switch(r){case"c":if(e.searching)return{kind:"searchCancel"};if(e.busy)return{kind:"cancel"};return e.armed?{kind:"exit"}:{kind:"arm"};case"d":return e.empty?{kind:"exit"}:{kind:"delete"};case"a":return{kind:"cursorHome"};case"e":return{kind:"cursorEnd"};case"b":return{kind:"cursorLeft"};case"f":return{kind:"cursorRight"};case"u":return{kind:"killToStart"};case"k":return{kind:"killToEnd"};case"w":return{kind:"killWord"};case"p":return{kind:"historyPrev"};case"n":return{kind:"historyNext"};case"r":return{kind:"searchOpen"};case"o":return{kind:"reasoning"};case"z":return{kind:"undo"};case"y":return{kind:"redo"};default:return{kind:"none"}}}function $A(r,e,n){let o=Si(r);if(o!==void 0){if(o.rows!==0)return{kind:"scroll",move:o.rows<0?"up":"down",times:Math.abs(o.rows)};if(o.at!==void 0&&o.kind!==void 0&&o.kind!=="wheel")return{kind:"pointer",gesture:o.kind,column:o.at.column,row:o.at.row,shift:o.shift===!0};return{kind:"none"}}if(e.eventType==="release")return{kind:"none"};if(e.shift){let i=B(e);if(i!==void 0)return{kind:"extend",to:i}}if(e.super){if(e.leftArrow)return{kind:"cursorHome"};if(e.rightArrow)return{kind:"cursorEnd"};if(e.upArrow)return{kind:"bufferStart"};if(e.downArrow)return{kind:"bufferEnd"};if(e.backspace)return{kind:"killToStart"};if(e.delete)return{kind:"killToEnd"};if(r==="z")return e.shift?{kind:"redo"}:{kind:"undo"};if(r==="a")return{kind:"selectAll"};if(r==="c")return{kind:"copySelection"};if(r==="x")return{kind:"cutSelection"};return{kind:"none"}}if(yi(r))return{kind:"none"};if(e.ctrl&&e.leftArrow)return{kind:"wordLeft"};if(e.ctrl&&e.rightArrow)return{kind:"wordRight"};if(e.ctrl&&e.backspace)return{kind:"killWord"};if(e.ctrl)return H(r.toLowerCase(),n);if(e.meta){if(e.return)return{kind:"newline"};if(e.pageUp)return{kind:"scroll",move:"top"};if(e.pageDown)return{kind:"scroll",move:"bottom"};if(e.upArrow)return{kind:"scroll",move:"up"};if(e.downArrow)return{kind:"scroll",move:"down"};if(e.leftArrow||r==="b")return{kind:"wordLeft"};if(e.rightArrow||r==="f")return{kind:"wordRight"};if(e.backspace)return{kind:"killWord"};if(r==="d")return{kind:"killWordForward"};if(r==="r")return{kind:"reasoning"};return{kind:"none"}}if(e.return&&e.shift)return{kind:"newline"};if(e.pageUp)return{kind:"scroll",move:"pageUp"};if(e.pageDown)return{kind:"scroll",move:"pageDown"};if(e.home)return{kind:"cursorHome"};if(e.end)return{kind:"cursorEnd"};if(e.return)return n.searching?{kind:"searchAccept"}:{kind:"submit"};if(e.backspace)return{kind:"backspace"};if(e.delete)return{kind:"delete"};if(e.leftArrow)return{kind:"cursorLeft"};if(e.rightArrow)return{kind:"cursorRight"};if(e.upArrow)return n.searching||n.firstLine?{kind:"historyPrev"}:{kind:"lineUp"};if(e.downArrow)return n.searching||n.lastLine?{kind:"historyNext"}:{kind:"lineDown"};if(e.escape){if(n.searching)return{kind:"searchCancel"};return n.scrolled?{kind:"scroll",move:"bottom"}:{kind:"none"}}if(e.tab)return{kind:"none"};if(r==="")return{kind:"none"};if(r==="\x1B[H"||r==="\x1B[1~")return{kind:"cursorHome"};if(r==="\x1B[F"||r==="\x1B[4~")return{kind:"cursorEnd"};if(/[\r\n]/.test(r)){let i=r.split(/\r\n|[\r\n]/).map(S),s=i.at(-1)===""&&i.length>1;return{kind:"paste",lines:s?i.slice(0,-1):i,complete:s}}let t=S(r);return t===""?{kind:"none"}:{kind:"insert",text:t}}function B(r){if(r.super){if(r.leftArrow)return"cursorHome";if(r.rightArrow)return"cursorEnd";if(r.upArrow)return"bufferStart";if(r.downArrow)return"bufferEnd";return}if(r.meta||r.ctrl){if(r.leftArrow)return"wordLeft";if(r.rightArrow)return"wordRight";return}if(r.home)return"cursorHome";if(r.end)return"cursorEnd";if(r.leftArrow)return"cursorLeft";if(r.rightArrow)return"cursorRight";if(r.upArrow)return"lineUp";if(r.downArrow)return"lineDown";return}function S(r){return[...r].filter((e)=>{let n=e.codePointAt(0)??0;return n>=32&&n!==127}).join("")}function et(r,e){if(e.ctrl)return r.toLowerCase()==="c"||r.toLowerCase()==="d"?{kind:"cancel"}:{kind:"none"};if(e.return)return{kind:"confirm"};if(e.escape)return{kind:"cancel"};if(r===" ")return{kind:"toggle"};if(r==="a")return{kind:"all"};if(r==="n")return{kind:"none-selected"};let n=Se(r,e);return n.kind==="move"?n:{kind:"none"}}function Se(r,e){if(e.ctrl)return r.toLowerCase()==="c"||r.toLowerCase()==="d"?{kind:"exit"}:{kind:"none"};if(e.return)return{kind:"choose"};if(e.escape)return{kind:"back"};if(e.upArrow)return{kind:"move",move:{kind:"up"}};if(e.downArrow)return{kind:"move",move:{kind:"down"}};switch(r){case"k":return{kind:"move",move:{kind:"up"}};case"j":return{kind:"move",move:{kind:"down"}};case"g":return{kind:"move",move:{kind:"first"}};case"G":return{kind:"move",move:{kind:"last"}};default:break}if(/^[1-9]$/.test(r))return{kind:"move",move:{kind:"jump",index:Number(r)-1}};return{kind:"none"}}function zt(r,e,n){if(e.ctrl&&r.toLowerCase()==="c")return{kind:"abort"};if(e.escape)return{kind:"back"};if(e.return)return{kind:"commit"};if(n.select)return{kind:"list",intent:Se(r,e)};let o=$A(r,e,{busy:!1,empty:n.empty,firstLine:!0,lastLine:!0,searching:!1,armed:!1,scrolled:!1});switch(o.kind){case"submit":return{kind:"commit"};case"exit":return{kind:"abort"};case"arm":case"scroll":return{kind:"edit",intent:{kind:"none"}};case"historyPrev":case"historyNext":return{kind:"edit",intent:{kind:"none"}};case"paste":return{kind:"edit",intent:{kind:"insert",text:o.lines[0]??""}};default:return{kind:"edit",intent:o}}}
9
+ export{K,Kn,XA,vA,te,Qi,qt,$A,et,Se,zt};
10
10
 
11
- //# debugId=D74D8516B55F9B6964756E2164756E21
12
- //# sourceMappingURL=index-j55s3ehk.js.map
11
+ //# debugId=CA7647838F66C2B364756E2164756E21
12
+ //# sourceMappingURL=index-x7v1zq89.js.map
@@ -5,7 +5,7 @@
5
5
  "/**\n * The input buffer, as data. Pure — no Ink, no React, no terminal.\n *\n * Ink gives you keystrokes and nothing else: there is no text field, so cursor movement, word motion,\n * history, undo and line breaks are this file's job. Keeping them here rather than inside a component\n * is what makes them testable, and they are exactly the behaviours that are tedious to check by hand\n * and embarrassing when wrong.\n *\n * **Positions are code points, not UTF-16 units.** `\"👍\".length` is 2, so a cursor counted in string\n * indices lands *inside* the surrogate pair, and one backspace leaves half a character behind that\n * renders as a replacement glyph and gets sent to the model. Every operation here goes through an\n * array of code points for that reason.\n *\n * **The buffer is multi-line.** A message is composed rather than typed on one line, so `value` may\n * contain `\\n` and the line helpers derive bounds on demand. That choice is argued in\n * `EditorState.value`; the consequence here is that \"start of line\" and \"start of buffer\" are now\n * different places, and `cursorHome` means the first.\n *\n * **Undo coalesces.** One snapshot per keystroke makes undo useless — nobody wants to press it forty\n * times to take back a sentence — so a run of plain typing is one step, and anything structural\n * (deletion, a line break, a paste, recalling history) opens a new one. That is the granularity every\n * editor converged on, and it is decided by `remember`'s single argument rather than scattered.\n */\n\nimport { HISTORY_LIMIT, UNDO_LIMIT } from \"#lib/const\"\nimport type { EditorSnapshot, EditorState, Intent } from \"#lib/types\"\n\nexport const EMPTY_EDITOR: EditorState = {\n value: \"\",\n cursor: 0,\n history: [],\n historyOffset: 0,\n draft: \"\",\n past: [],\n future: [],\n search: undefined,\n anchor: undefined,\n}\n\nfunction chars(value: string): string[] {\n return [...value]\n}\n\nfunction clamp(cursor: number, length: number): number {\n return Math.max(0, Math.min(cursor, length))\n}\n\nfunction snapshot(state: EditorState): EditorSnapshot {\n return { value: state.value, cursor: state.cursor }\n}\n\n/**\n * Record the current text as an undo point, unless this edit continues the last one.\n *\n * `coalesce` is true for plain typing: the top of the stack already holds a point before the run\n * started, so extending it needs no new entry. Everything else pushes.\n *\n * Any edit clears `future`, because a redo stack that survives a new edit would replay text that\n * never followed from what is now on screen.\n */\nfunction remember(state: EditorState, options: { readonly coalesce: boolean }): EditorState {\n const top = state.past.at(-1)\n // Nothing to remember when the text has not changed since the last point — repeated arrow keys\n // would otherwise fill the stack with identical entries and make undo appear to do nothing.\n if (options.coalesce && top !== undefined && state.future.length === 0) {\n return { ...state, future: [] }\n }\n if (top !== undefined && top.value === state.value) return { ...state, future: [] }\n return { ...state, past: [...state.past, snapshot(state)].slice(-UNDO_LIMIT), future: [] }\n}\n\n/** Cursor to the end, which is where every whole-buffer replacement leaves it. */\nfunction replaceAll(state: EditorState, value: string): EditorState {\n return { ...state, value, cursor: chars(value).length }\n}\n\nfunction insert(state: EditorState, text: string): EditorState {\n const remembered = remember(state, { coalesce: !text.includes(\"\\n\") })\n const current = chars(remembered.value)\n const at = clamp(remembered.cursor, current.length)\n const next = [...current.slice(0, at), ...chars(text), ...current.slice(at)]\n return { ...remembered, value: next.join(\"\"), cursor: at + chars(text).length }\n}\n\nfunction deleteBack(state: EditorState): EditorState {\n const current = chars(state.value)\n const at = clamp(state.cursor, current.length)\n if (at === 0) return state\n const remembered = remember(state, { coalesce: false })\n const next = [...current.slice(0, at - 1), ...current.slice(at)]\n return { ...remembered, value: next.join(\"\"), cursor: at - 1 }\n}\n\nfunction deleteForward(state: EditorState): EditorState {\n const current = chars(state.value)\n const at = clamp(state.cursor, current.length)\n if (at >= current.length) return state\n const remembered = remember(state, { coalesce: false })\n return {\n ...remembered,\n value: [...current.slice(0, at), ...current.slice(at + 1)].join(\"\"),\n }\n}\n\n// ─── words ───────────────────────────────────────────────────────────────────────────────\n//\n// A newline counts as a separator, so word motion crosses lines the way it does in a text field.\n// Treating it as a boundary that stops the cursor was the other option and is worse: it makes ⌥←\n// silently do nothing at the start of a line, which reads as a dead key.\n\nfunction isSeparator(char: string | undefined): boolean {\n return char === undefined || /\\s/.test(char)\n}\n\n/** The start of the word at or before `at` — separators skipped first, as every shell does. */\nfunction wordStart(current: readonly string[], at: number): number {\n let index = at\n while (index > 0 && isSeparator(current[index - 1])) index -= 1\n while (index > 0 && !isSeparator(current[index - 1])) index -= 1\n return index\n}\n\n/** The end of the word at or after `at`. */\nfunction wordEnd(current: readonly string[], at: number): number {\n let index = at\n while (index < current.length && isSeparator(current[index])) index += 1\n while (index < current.length && !isSeparator(current[index])) index += 1\n return index\n}\n\n/**\n * Delete the word before the cursor, trailing whitespace included — so `^W` after \"hello world \"\n * removes \"world \" rather than only the space, which is what every shell does.\n */\nfunction killWord(state: EditorState): EditorState {\n const current = chars(state.value)\n const at = wordStart(current, clamp(state.cursor, current.length))\n if (at === state.cursor) return state\n const remembered = remember(state, { coalesce: false })\n return {\n ...remembered,\n value: [...current.slice(0, at), ...current.slice(state.cursor)].join(\"\"),\n cursor: at,\n }\n}\n\nfunction killWordForward(state: EditorState): EditorState {\n const current = chars(state.value)\n const at = clamp(state.cursor, current.length)\n const to = wordEnd(current, at)\n if (to === at) return state\n const remembered = remember(state, { coalesce: false })\n return {\n ...remembered,\n value: [...current.slice(0, at), ...current.slice(to)].join(\"\"),\n }\n}\n\n// ─── lines ───────────────────────────────────────────────────────────────────────────────\n\ninterface LineBounds {\n readonly start: number\n readonly end: number\n}\n\n/** The bounds of the line the cursor sits on, in code points. `end` is the newline or the buffer end. */\nexport function lineAt(value: string, cursor: number): LineBounds {\n const current = chars(value)\n const at = clamp(cursor, current.length)\n let start = at\n while (start > 0 && current[start - 1] !== \"\\n\") start -= 1\n let end = at\n while (end < current.length && current[end] !== \"\\n\") end += 1\n return { start, end }\n}\n\n/** Which line the cursor is on, and how many there are. Used to decide what an arrow means. */\nexport function lineInfo(state: EditorState): {\n readonly line: number\n readonly lines: number\n readonly column: number\n} {\n const current = chars(state.value)\n const at = clamp(state.cursor, current.length)\n const before = current.slice(0, at)\n const { start } = lineAt(state.value, at)\n return {\n line: before.filter((char) => char === \"\\n\").length,\n lines: current.filter((char) => char === \"\\n\").length + 1,\n column: at - start,\n }\n}\n\n/**\n * Move a line, keeping the column where possible.\n *\n * A shorter target line clamps to its end rather than wrapping onto the next one — the behaviour every\n * editor has, and the reason the column is recomputed from the line start each time instead of being\n * remembered across moves. Remembering it is what produces a \"sticky\" column, which is nicer in vim and\n * surprising in a message box.\n */\nfunction moveLine(state: EditorState, delta: number): EditorState {\n const current = chars(state.value)\n const at = clamp(state.cursor, current.length)\n const here = lineAt(state.value, at)\n const column = at - here.start\n if (delta < 0) {\n if (here.start === 0) return state\n const previous = lineAt(state.value, here.start - 1)\n return { ...state, cursor: Math.min(previous.start + column, previous.end) }\n }\n if (here.end >= current.length) return state\n const next = lineAt(state.value, here.end + 1)\n return { ...state, cursor: Math.min(next.start + column, next.end) }\n}\n\n// ─── history ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * Walk back through history. The text being edited is saved on the first step and restored on the\n * way back down, so browsing history never destroys what you were typing.\n */\nfunction historyPrev(state: EditorState): EditorState {\n if (state.history.length === 0) return state\n const offset = Math.min(state.historyOffset + 1, state.history.length)\n const entry = state.history[state.history.length - offset]\n if (entry === undefined) return state\n return replaceAll(\n {\n ...remember(state, { coalesce: false }),\n historyOffset: offset,\n draft: state.historyOffset === 0 ? state.value : state.draft,\n },\n entry,\n )\n}\n\nfunction historyNext(state: EditorState): EditorState {\n if (state.historyOffset === 0) return state\n const offset = state.historyOffset - 1\n const remembered = remember(state, { coalesce: false })\n if (offset === 0) return replaceAll({ ...remembered, historyOffset: 0 }, state.draft)\n const entry = state.history[state.history.length - offset]\n return entry === undefined ? state : replaceAll({ ...remembered, historyOffset: offset }, entry)\n}\n\n// ─── reverse search ──────────────────────────────────────────────────────────────────────\n\n/**\n * History entries containing the query, newest first.\n *\n * Substring rather than prefix, and case-insensitive: a message is prose, and remembering how one\n * started is much harder than remembering a word in the middle of it. Deduplicated, because the same\n * question asked twice should not take two presses of ↓ to walk past.\n */\nexport function searchMatches(state: EditorState): readonly string[] {\n const query = (state.search?.query ?? \"\").toLowerCase()\n const seen = new Set<string>()\n const matches: string[] = []\n for (let at = state.history.length - 1; at >= 0; at -= 1) {\n const entry = state.history[at]\n if (entry === undefined || seen.has(entry)) continue\n if (query === \"\" || entry.toLowerCase().includes(query)) {\n seen.add(entry)\n matches.push(entry)\n }\n }\n return matches\n}\n\n/** The entry the search has landed on, or `undefined` when nothing matches. */\nexport function searchSelection(state: EditorState): string | undefined {\n const matches = searchMatches(state)\n return matches[clamp(state.search?.index ?? 0, Math.max(0, matches.length - 1))]\n}\n\nfunction searchStep(state: EditorState, delta: number): EditorState {\n const search = state.search\n if (search === undefined) return state\n const matches = searchMatches(state)\n if (matches.length === 0) return state\n return {\n ...state,\n search: { ...search, index: clamp(search.index + delta, matches.length - 1) },\n }\n}\n\nfunction searchType(state: EditorState, text: string): EditorState {\n const search = state.search\n if (search === undefined) return state\n // The index resets on every keystroke: the match list has changed underneath it, so keeping the\n // old position would silently point at a different entry than the one that was highlighted.\n return { ...state, search: { query: search.query + text, index: 0 } }\n}\n\nfunction searchBackspace(state: EditorState): EditorState {\n const search = state.search\n if (search === undefined) return state\n const query = chars(search.query).slice(0, -1).join(\"\")\n return { ...state, search: { query, index: 0 } }\n}\n\nfunction searchAccept(state: EditorState): EditorState {\n const chosen = searchSelection(state)\n if (chosen === undefined) return { ...state, search: undefined }\n return replaceAll({ ...remember(state, { coalesce: false }), search: undefined }, chosen)\n}\n\n// ─── undo ────────────────────────────────────────────────────────────────────────────────\n\nfunction undo(state: EditorState): EditorState {\n const previous = state.past.at(-1)\n if (previous === undefined) return state\n return {\n ...state,\n value: previous.value,\n cursor: clamp(previous.cursor, chars(previous.value).length),\n past: state.past.slice(0, -1),\n future: [snapshot(state), ...state.future],\n historyOffset: 0,\n }\n}\n\nfunction redo(state: EditorState): EditorState {\n const next = state.future[0]\n if (next === undefined) return state\n return {\n ...state,\n value: next.value,\n cursor: clamp(next.cursor, chars(next.value).length),\n past: [...state.past, snapshot(state)].slice(-UNDO_LIMIT),\n future: state.future.slice(1),\n }\n}\n\n/** The selected range, normalised so `start <= end`. `undefined` when nothing is selected. */\nexport function selectionRange(\n state: EditorState,\n): { readonly start: number; readonly end: number } | undefined {\n if (state.anchor === undefined || state.anchor === state.cursor) return undefined\n return state.anchor < state.cursor\n ? { start: state.anchor, end: state.cursor }\n : { start: state.cursor, end: state.anchor }\n}\n\n/** Cut the selected range out, leaving the caret where it was and no selection behind. */\nfunction deleteRange(state: EditorState): EditorState {\n const range = selectionRange(state)\n if (range === undefined) return { ...state, anchor: undefined }\n const current = chars(state.value)\n return {\n ...remember(state, { coalesce: false }),\n value: [...current.slice(0, range.start), ...current.slice(range.end)].join(\"\"),\n cursor: range.start,\n anchor: undefined,\n }\n}\n\n/**\n * Which intents replace a selection rather than acting beside it.\n *\n * Typing over a selection replaces it and backspace removes it — that is what every editor does and what\n * makes a selection worth having. A *motion* does not: it collapses the selection and moves, which is the\n * `anchor: undefined` at the end of `applyIntent` rather than a deletion here.\n */\nfunction replacesSelection(intent: Intent): boolean {\n return (\n intent.kind === \"insert\" ||\n intent.kind === \"newline\" ||\n intent.kind === \"backspace\" ||\n intent.kind === \"delete\"\n )\n}\n\nexport function applyIntent(state: EditorState, intent: Intent): EditorState {\n // A selection is replaced before the intent is applied, and for backspace and delete that *is* the\n // whole edit — pressing ⌫ with three words selected removes the three words, it does not remove them\n // and then eat a fourth character. Ordered before the search branch below because a search has no\n // selection to replace: `searchType` writes to the query, never to the line.\n if (\n state.search === undefined &&\n replacesSelection(intent) &&\n selectionRange(state) !== undefined\n ) {\n const cut = deleteRange(state)\n if (intent.kind === \"backspace\" || intent.kind === \"delete\") return cut\n return applyIntent(cut, intent)\n }\n\n if (intent.kind === \"extend\") {\n // The motion is applied by the same code the unshifted chord uses, on a copy with no anchor, so a\n // selection cannot disagree with the plain move about where the cursor lands. The anchor is\n // whichever one already existed — extending twice grows one selection rather than starting a\n // second — and falls back to where the caret was when the first shift chord arrived.\n const anchor = state.anchor ?? state.cursor\n const moved = applyIntent({ ...state, anchor: undefined }, { kind: intent.to })\n return { ...moved, anchor }\n }\n\n // Cut is a deletion; copy touches nothing. Both leave the clipboard to the caller — a pure reducer\n // cannot spawn `pbcopy`, and a reducer that could would be untestable for the sake of one line.\n if (intent.kind === \"cutSelection\") return deleteRange(state)\n if (intent.kind === \"copySelection\") return state\n\n if (intent.kind === \"selectAll\") {\n return { ...state, anchor: 0, cursor: chars(state.value).length }\n }\n\n const next = applyToLine(state, intent)\n // Every other intent collapses the selection. Written once here rather than in each motion case: ten\n // cases each remembering to clear a field is ten chances for one of them not to, and the one that\n // forgot would leave a highlight on screen with nothing selecting it.\n return next.anchor === undefined ? next : { ...next, anchor: undefined }\n}\n\nfunction applyToLine(state: EditorState, intent: Intent): EditorState {\n // While the search is open, the keys that would edit the line extend the query instead. Routed\n // here rather than by emitting a parallel set of search intents from the keymap: the keys mean the\n // same thing to a reader — type, rub out, move, choose — and only the target changes.\n if (state.search !== undefined) {\n switch (intent.kind) {\n case \"insert\":\n return searchType(state, intent.text)\n case \"backspace\":\n return searchBackspace(state)\n case \"historyPrev\":\n case \"lineUp\":\n return searchStep(state, 1)\n case \"historyNext\":\n case \"lineDown\":\n return searchStep(state, -1)\n case \"searchAccept\":\n return searchAccept(state)\n case \"searchCancel\":\n return { ...state, search: undefined }\n case \"searchOpen\":\n return state\n default:\n // Anything else closes the search and is *not* applied to the line. Applying it would\n // mean a ^K pressed to dismiss the search also truncated the message behind it.\n return { ...state, search: undefined }\n }\n }\n\n switch (intent.kind) {\n case \"insert\":\n return insert(state, intent.text)\n case \"newline\":\n return insert(state, \"\\n\")\n case \"backspace\":\n return deleteBack(state)\n case \"delete\":\n return deleteForward(state)\n case \"cursorLeft\":\n return { ...state, cursor: clamp(state.cursor - 1, chars(state.value).length) }\n case \"cursorRight\":\n return { ...state, cursor: clamp(state.cursor + 1, chars(state.value).length) }\n case \"cursorHome\":\n // The start of the *line*, not of the buffer: `^A` on the third line of a message means\n // that line's start, which is what it means in every shell and every editor.\n return { ...state, cursor: lineAt(state.value, state.cursor).start }\n case \"cursorEnd\":\n return { ...state, cursor: lineAt(state.value, state.cursor).end }\n case \"bufferStart\":\n return { ...state, cursor: 0 }\n case \"bufferEnd\":\n return { ...state, cursor: chars(state.value).length }\n case \"wordLeft\":\n return { ...state, cursor: wordStart(chars(state.value), state.cursor) }\n case \"wordRight\":\n return { ...state, cursor: wordEnd(chars(state.value), state.cursor) }\n case \"lineUp\":\n return moveLine(state, -1)\n case \"lineDown\":\n return moveLine(state, 1)\n case \"killToStart\": {\n const { start } = lineAt(state.value, state.cursor)\n if (start === state.cursor) return state\n const current = chars(state.value)\n return {\n ...remember(state, { coalesce: false }),\n value: [...current.slice(0, start), ...current.slice(state.cursor)].join(\"\"),\n cursor: start,\n }\n }\n case \"killToEnd\": {\n const { end } = lineAt(state.value, state.cursor)\n if (end === state.cursor) return state\n const current = chars(state.value)\n return {\n ...remember(state, { coalesce: false }),\n value: [...current.slice(0, state.cursor), ...current.slice(end)].join(\"\"),\n }\n }\n case \"killWord\":\n return killWord(state)\n case \"killWordForward\":\n return killWordForward(state)\n case \"historyPrev\":\n return historyPrev(state)\n case \"historyNext\":\n return historyNext(state)\n case \"undo\":\n return undo(state)\n case \"redo\":\n return redo(state)\n case \"searchOpen\":\n return { ...state, search: { query: \"\", index: 0 } }\n // Submit, cancel, exit and none are the caller's business — they change the session, not the\n // buffer. A paste is the caller's too: it can carry several finished lines, and only the caller\n // can send them. Search accept and cancel are unreachable with no search open, and are listed\n // rather than defaulted so a new intent has to be considered.\n case \"searchAccept\":\n case \"searchCancel\":\n case \"submit\":\n case \"cancel\":\n case \"exit\":\n // The session's, not the line's: arming ^C and moving the transcript window change what is on\n // screen and nothing about what is being typed. The exhaustive switch is what surfaced them —\n // added to `Intent` for the keymap's benefit, they made this function stop returning, which is a\n // compile error rather than a silent edit applied to somebody's message.\n case \"arm\":\n case \"scroll\":\n case \"pointer\":\n case \"reasoning\":\n case \"paste\":\n case \"none\":\n return state\n // Handled by `applyIntent` before it delegates here, and listed rather than defaulted so the\n // exhaustive switch keeps doing its job: a new intent has to be considered, not absorbed.\n case \"extend\":\n case \"selectAll\":\n case \"copySelection\":\n case \"cutSelection\":\n return state\n }\n}\n\n/**\n * Does enter send the message, or continue it on a new line?\n *\n * A trailing backslash means continue — the shell's convention, and the fallback for terminals where\n * shift+enter is indistinguishable from enter. Counted rather than tested for one character, so an\n * escaped backslash (`a\\\\`) sends and does not silently swallow the pair.\n *\n * Only at the very end of the buffer. Mid-message a backslash is ordinary text, and a message about\n * Windows paths should not become unsendable.\n */\nexport function submitIntent(state: EditorState): \"send\" | \"newline\" {\n const current = chars(state.value)\n if (clamp(state.cursor, current.length) !== current.length) return \"send\"\n let backslashes = 0\n for (let at = current.length - 1; at >= 0 && current[at] === \"\\\\\"; at -= 1) backslashes += 1\n return backslashes % 2 === 1 ? \"newline\" : \"send\"\n}\n\n/** Drop the trailing continuation backslash and break the line. Paired with `submitIntent`. */\nexport function continueLine(state: EditorState): EditorState {\n const current = chars(state.value)\n const trimmed = current.slice(0, -1).join(\"\")\n return applyIntent(\n { ...state, value: trimmed, cursor: chars(trimmed).length },\n { kind: \"newline\" },\n )\n}\n\n/**\n * Commit the message. Returns the text to send and the state to keep.\n *\n * Empty submits nothing, and a repeat of the previous entry is not added to history — otherwise\n * pressing Enter twice fills history with duplicates that the arrows then have to walk.\n *\n * The undo stack does not survive: it describes a message that has been sent, and offering to undo\n * into text that is already in the transcript would be a lie about what the buffer is.\n */\nexport function submit(state: EditorState): { readonly text: string; readonly state: EditorState } {\n const text = state.value.trim()\n if (text === \"\") {\n return { text: \"\", state: { ...EMPTY_EDITOR, history: state.history } }\n }\n const last = state.history.at(-1)\n const history = last === text ? state.history : [...state.history, text].slice(-HISTORY_LIMIT)\n return { text, state: { ...EMPTY_EDITOR, history } }\n}\n",
6
6
  "/**\n * Keystrokes in, intents out. Pure, and free of any Ink import.\n *\n * The one contract worth stating explicitly, because Phase 1 established and measured it:\n * **Ctrl-C cancels the turn, not the process.** Whether a keystroke means \"cancel\" or \"exit\"\n * depends on whether a turn is in flight, so that decision belongs here — in a function that can be\n * tested against both states — rather than in a component where it can only be tested by hand.\n */\n\nimport { lineInfo } from \"#editor\"\nimport { isTerminalReply } from \"#lib/csi\"\nimport { mouseInput } from \"#lib/mouse\"\nimport type { EditorState, Intent, KeyState, MotionKind } from \"#lib/types\"\n\nexport interface KeyContext {\n /** A turn is in flight. */\n readonly busy: boolean\n /** The input buffer is empty. */\n readonly empty: boolean\n /**\n * The cursor is on the first line, so ↑ means history rather than a line up.\n *\n * Position decides, because a multi-line buffer wants both and every editor resolves it this way:\n * at the top of what you are composing there is nothing above to move to, so the arrow is free to\n * mean the other thing. `^P`/`^N` stay unconditional history for anyone who would rather not think\n * about where the cursor is.\n */\n readonly firstLine: boolean\n readonly lastLine: boolean\n /** `^R` is open, so enter accepts a match and escape closes it. */\n readonly searching: boolean\n /**\n * A first ^C has already been pressed at an idle prompt, so the next one leaves.\n *\n * Held by the caller rather than derived, because it is the one piece of keyboard state with a\n * *clock* attached — it expires — and a pure function cannot own that. What it must not do is\n * decide what an armed ^C means, which is why the flag comes in here and the decision stays below.\n */\n readonly armed: boolean\n /**\n * The transcript window is parked above the newest row, so escape means \"come back down\".\n *\n * Escape had nothing to do at an idle prompt and was claimed as `none` to keep control characters\n * out of the buffer. A scrolled-away view is the one state where a reader plainly wants a way out\n * of where they are, and escape is the key they will press.\n */\n readonly scrolled: boolean\n}\n\n/**\n * The context for a given editor state.\n *\n * Exported and derived in one place so no renderer computes it by hand. `empty` was already this shape\n * — editor state passed to the keymap as context — and the two line flags are the same idea; a caller\n * that got `firstLine` wrong would make the arrows misbehave in a way no test of this module would see.\n */\nexport function keyContext(\n editor: EditorState,\n busy: boolean,\n session: { readonly armed?: boolean; readonly scrolled?: boolean } = {},\n): KeyContext {\n const { line, lines } = lineInfo(editor)\n return {\n busy,\n empty: editor.value === \"\",\n firstLine: line === 0,\n lastLine: line === lines - 1,\n searching: editor.search !== undefined,\n armed: session.armed ?? false,\n scrolled: session.scrolled ?? false,\n }\n}\n\n/** Ctrl-key chords arrive as `key.ctrl` plus the letter in `input`. */\nfunction ctrlIntent(letter: string, context: KeyContext): Intent {\n switch (letter) {\n case \"c\":\n // While a search is open, ^C dismisses it rather than the session: the search is the\n // foreground thing, and quitting the whole session from it would lose a message somebody\n // is part-way through composing.\n if (context.searching) return { kind: \"searchCancel\" }\n // The whole point. Busy means a turn is generating; interrupting it must leave the\n // prompt behind, not the shell.\n if (context.busy) return { kind: \"cancel\" }\n // At an idle prompt it takes two, and the first one says so.\n //\n // One press used to exit, which was defensible while the session left its conversation in\n // the scrollback: ^C landed you back in a shell with the transcript still above it. On the\n // alternate screen the buffer is discarded on the way out, so the same keystroke now throws\n // the visible conversation away — and it is one press away from the chord that means\n // \"cancel this turn\", pressed reflexively when a reply runs long. ^D still leaves in one,\n // for anyone who wants that, and the status line names whichever is live.\n return context.armed ? { kind: \"exit\" } : { kind: \"arm\" }\n case \"d\":\n // Ctrl-D is end-of-input, so it only ends the session when there is nothing to submit.\n // On a line with text it is a forward delete, as in a shell.\n return context.empty ? { kind: \"exit\" } : { kind: \"delete\" }\n case \"a\":\n return { kind: \"cursorHome\" }\n case \"e\":\n return { kind: \"cursorEnd\" }\n case \"b\":\n return { kind: \"cursorLeft\" }\n case \"f\":\n return { kind: \"cursorRight\" }\n case \"u\":\n return { kind: \"killToStart\" }\n case \"k\":\n return { kind: \"killToEnd\" }\n case \"w\":\n return { kind: \"killWord\" }\n case \"p\":\n return { kind: \"historyPrev\" }\n case \"n\":\n return { kind: \"historyNext\" }\n case \"r\":\n return { kind: \"searchOpen\" }\n case \"o\":\n // The same thing ⌥r does, on a chord that cannot fail to arrive.\n //\n // ⌥r needs either the kitty protocol or the terminal's option-as-meta setting; a ctrl letter\n // needs neither, because it is a single control byte every terminal has always sent. Reported\n // as \"⌥r doesn't do anything\", and while the immediate cause was a fold with nothing in it,\n // the standing cause is that a view toggle should not depend on a terminal handshake at all.\n // ^O is what the reference CLI binds its own transcript toggle to, so the habit transfers.\n return { kind: \"reasoning\" }\n case \"z\":\n // Undo, not SIGTSTP. Ink puts stdin in raw mode, so the terminal never generates the\n // signal and the byte arrives here — which makes this a choice rather than an accident.\n // Suspending a chat you can leave with ^D is worth little; undo is worth a lot, and the\n // footer says so, which is what keeps the trade visible.\n return { kind: \"undo\" }\n case \"y\":\n return { kind: \"redo\" }\n default:\n return { kind: \"none\" }\n }\n}\n\nexport function keyToIntent(input: string, key: KeyState, context: KeyContext): Intent {\n // The mouse, before anything else, and unconditionally.\n //\n // Ink has no idea what a mouse report is and hands it over as text: with tracking on, one wheel notch\n // reached the insert branch and typed the report into the message. So every report is claimed here —\n // the wheel becomes a scroll and everything else becomes nothing at all, because a click that falls\n // through is the same bug with a different button.\n const mouse = mouseInput(input)\n if (mouse !== undefined) {\n if (mouse.rows !== 0) {\n return {\n kind: \"scroll\",\n move: mouse.rows < 0 ? \"up\" : \"down\",\n times: Math.abs(mouse.rows),\n }\n }\n // A press, drag or release. Reported rather than resolved: which row of the conversation a cell\n // sits on is a question about the frame, and this function has no frame. Still claimed either way —\n // a report that fell through would be typed into the message, which is the bug this branch exists\n // for and does not stop being one because the gesture is now useful.\n if (mouse.at !== undefined && mouse.kind !== undefined && mouse.kind !== \"wheel\") {\n return {\n kind: \"pointer\",\n gesture: mouse.kind,\n column: mouse.at.column,\n row: mouse.at.row,\n shift: mouse.shift === true,\n }\n }\n return { kind: \"none\" }\n }\n\n // A key *release* is not a keystroke. `reportEventTypes` is on so that `super` survives on an arrow\n // key (Ink's kitty branch requires the `:eventType` field), and the cost is that Ink hands the type\n // through without filtering — so every enhanced key arrives twice, down and up, and every chord would\n // fire twice. Repeats are kept: holding a key down is a real thing to do.\n if (key.eventType === \"release\") return { kind: \"none\" }\n\n // ─── shift extends a selection ───────────────────────────────────────────────────────\n //\n // Before the cmd, ctrl and option blocks, because every one of them would otherwise claim the chord\n // and drop the shift: `cmd+shift+←` arrives as `CSI 1;10D` — one plus shift plus super — and the\n // super block below matches on `key.super` without looking at shift at all.\n //\n // Only the motion keys are recognised, which is what keeps this from swallowing ordinary typing:\n // `key.shift` is true for every capital letter, and a letter matches none of the tests in\n // `shiftMotion`. Return is not a motion either, so `⇧⏎` still reaches the newline branch.\n if (key.shift) {\n const to = shiftMotion(key)\n if (to !== undefined) return { kind: \"extend\", to }\n }\n\n // ─── command chords ──────────────────────────────────────────────────────────────────\n //\n // `super` is Cmd, and it is only ever true once the kitty keyboard protocol has been negotiated —\n // no legacy sequence can express it, and Ink's legacy path folds it into `meta`, which is why\n // `cmd+←` used to word-move like `⌥←` instead of jumping to the start of the line.\n //\n // Horizontal is the line, vertical is the whole message: that is what macOS binds and what every\n // editor on the platform does. Before the ctrl and meta blocks because a chord can carry more than\n // one modifier, and cmd is the most specific claim.\n if (key.super) {\n if (key.leftArrow) return { kind: \"cursorHome\" }\n if (key.rightArrow) return { kind: \"cursorEnd\" }\n if (key.upArrow) return { kind: \"bufferStart\" }\n if (key.downArrow) return { kind: \"bufferEnd\" }\n if (key.backspace) return { kind: \"killToStart\" }\n if (key.delete) return { kind: \"killToEnd\" }\n if (input === \"z\") return key.shift ? { kind: \"redo\" } : { kind: \"undo\" }\n if (input === \"a\") return { kind: \"selectAll\" }\n // Reachable only where the protocol delivers `super`, and the terminal may claim them first for\n // its own copy — which is exactly why a *selection* in the composer does not auto-copy: the\n // fallback for a chord that may not arrive is retyping, not a surprise clipboard write.\n if (input === \"c\") return { kind: \"copySelection\" }\n if (input === \"x\") return { kind: \"cutSelection\" }\n // Unclaimed, and deliberately swallowed for the same reason an unclaimed option chord is: the\n // insert branch would type the bare letter, so cmd+s would put an \"s\" in the message.\n return { kind: \"none\" }\n }\n\n // Ctrl with an arrow or a backspace is the other spelling of a word operation — Linux and Windows\n // convention, and the reference honours `ctrl || meta || fn` for exactly one action because a\n // physical chord reaches a terminal in more than one encoding. Before `ctrlIntent`, which dispatches\n // on a *letter* and would see an empty string here.\n // A terminal's answer to a question this process asked is not a keystroke. Claimed next to the mouse\n // for the same reason: Ink hands it over as text, and text reaches the insert branch.\n if (isTerminalReply(input)) return { kind: \"none\" }\n\n if (key.ctrl && key.leftArrow) return { kind: \"wordLeft\" }\n if (key.ctrl && key.rightArrow) return { kind: \"wordRight\" }\n if (key.ctrl && key.backspace) return { kind: \"killWord\" }\n\n if (key.ctrl) return ctrlIntent(input.toLowerCase(), context)\n\n // ─── option chords ───────────────────────────────────────────────────────────────────\n //\n // Every one of these is measured against Ink's parser rather than assumed, because a terminal has\n // more than one way to send them and the parser reporting *a* key says nothing about which:\n //\n // ⌥← Apple Terminal `ESC b` → input \"b\" + meta iTerm2 `CSI 1;3D` → leftArrow + meta\n // ⌥→ Apple Terminal `ESC f` → input \"f\" + meta iTerm2 `CSI 1;3C` → rightArrow + meta\n // ⌥⌫ `ESC DEL` → backspace + meta\n // ⌥d `ESC d` → input \"d\" + meta\n // ⌥r `ESC r` → input \"r\" + meta\n // ⌥⏎ `ESC CR` → return + meta\n // ⇧⏎ kitty protocol `CSI 13;2u` → return + shift (only once the terminal is taught)\n //\n // Both spellings of each are honoured, so the same binding works in both families of terminal.\n //\n // Under the kitty protocol these arrive as `CSI <codepoint>;3u` instead — `⌥r` is `CSI 114;3u`, and\n // Ink reports it as `input \"r\"` with `meta` set, which is the same shape the table above describes.\n // That is why negotiating the protocol needed no change here: these bindings were always right and\n // simply never arrived, because Warp's Option-as-Meta setting is off by default and `⌥r` was\n // reaching us as the composed character `®`.\n if (key.meta) {\n if (key.return) return { kind: \"newline\" }\n // ⌥↑/⌥↓ walk the conversation a row at a time, and ⌥PgUp/⌥PgDn go to its ends. Bare ↑/↓ cannot\n // do this: they already mean line movement inside a message and history at its edges, and a\n // third meaning on one key is how a keyboard stops being predictable.\n if (key.pageUp) return { kind: \"scroll\", move: \"top\" }\n if (key.pageDown) return { kind: \"scroll\", move: \"bottom\" }\n if (key.upArrow) return { kind: \"scroll\", move: \"up\" }\n if (key.downArrow) return { kind: \"scroll\", move: \"down\" }\n if (key.leftArrow || input === \"b\") return { kind: \"wordLeft\" }\n if (key.rightArrow || input === \"f\") return { kind: \"wordRight\" }\n if (key.backspace) return { kind: \"killWord\" }\n if (input === \"d\") return { kind: \"killWordForward\" }\n // Reasoning is folded to a few rows by default, and this is how the rest of it is read. Same\n // shape as ⌥d — a letter with meta — so it works wherever the chords above already do.\n if (input === \"r\") return { kind: \"reasoning\" }\n // An unclaimed option chord does nothing. Falling through would reach the insert branch and\n // type the bare letter, so ⌥s would silently put an \"s\" in the message. Composed characters\n // (é, ∆) are unaffected: macOS sends those as the character itself, with no meta flag.\n return { kind: \"none\" }\n }\n\n // Shift+enter is a newline where the terminal can express it — `terminal-setup` is what teaches\n // iTerm2, VS Code, Ghostty and Kitty to send the sequence Ink already understands. Where it\n // cannot, this is never true and ⏎ submits, which is why ⌥⏎ is the documented chord.\n if (key.return && key.shift) return { kind: \"newline\" }\n\n // Paging the conversation, unmodified.\n //\n // Deliberately not ^U/^D, which the plan named: both are already taken by the editor — ^U deletes to\n // the start of the line and ^D leaves an empty one — and they are documented, shell-standard, and\n // reached by muscle memory. A scroll key that silently deleted half a message would be a worse bug\n // than no scroll key.\n if (key.pageUp) return { kind: \"scroll\", move: \"pageUp\" }\n if (key.pageDown) return { kind: \"scroll\", move: \"pageDown\" }\n\n // Home and End. Ink has always parsed them; `KeyState` never declared the fields, so both keys did\n // nothing whatsoever until now. The raw-sequence fallback further down catches the terminals that\n // send a spelling Ink does not flag.\n if (key.home) return { kind: \"cursorHome\" }\n if (key.end) return { kind: \"cursorEnd\" }\n\n if (key.return) return context.searching ? { kind: \"searchAccept\" } : { kind: \"submit\" }\n if (key.backspace) return { kind: \"backspace\" }\n if (key.delete) return { kind: \"delete\" }\n if (key.leftArrow) return { kind: \"cursorLeft\" }\n if (key.rightArrow) return { kind: \"cursorRight\" }\n // History at the edges of the buffer, line movement inside it. While searching both walk the match\n // list, which the reducer routes — the arrows mean \"previous\" and \"next\" either way.\n if (key.upArrow) {\n return context.searching || context.firstLine ? { kind: \"historyPrev\" } : { kind: \"lineUp\" }\n }\n if (key.downArrow) {\n return context.searching || context.lastLine\n ? { kind: \"historyNext\" }\n : { kind: \"lineDown\" }\n }\n\n // Escape closes a search; otherwise it is claimed deliberately and does nothing, rather than\n // falling through to the insert branch where it would put a control character into the buffer and\n // be sent to a model. Tab is claimed for the same reason.\n if (key.escape) {\n if (context.searching) return { kind: \"searchCancel\" }\n return context.scrolled ? { kind: \"scroll\", move: \"bottom\" } : { kind: \"none\" }\n }\n if (key.tab) return { kind: \"none\" }\n\n // A paste arrives as one large `input` with no key flags, so insert has to accept many\n // characters at once rather than assuming a single keypress.\n if (input === \"\") return { kind: \"none\" }\n\n // Home and End again, by raw sequence. There are four spellings in the wild and Ink flags only some\n // of them — the reference keeps the same fallback for the same reason (`useTextInput.ts:385-389`).\n // After the empty-input check and before the printable filter, which would otherwise strip the\n // escape and insert `[H` into the message.\n if (input === \"\\u001B[H\" || input === \"\\u001B[1~\") return { kind: \"cursorHome\" }\n if (input === \"\\u001B[F\" || input === \"\\u001B[4~\") return { kind: \"cursorEnd\" }\n\n // Newlines inside that chunk are line breaks, not control noise. Stripping them — which the\n // printable filter below would do — silently joins the last word of one line to the first word\n // of the next and submits nothing, so a pasted multi-line prompt arrives mangled with no error.\n if (/[\\r\\n]/.test(input)) {\n const lines = input.split(/\\r\\n|[\\r\\n]/).map(printableOnly)\n // A trailing newline means the final line is finished too; without one, the tail is still\n // being typed.\n const complete = lines.at(-1) === \"\" && lines.length > 1\n return { kind: \"paste\", lines: complete ? lines.slice(0, -1) : lines, complete }\n }\n\n const printable = printableOnly(input)\n return printable === \"\" ? { kind: \"none\" } : { kind: \"insert\", text: printable }\n}\n\n/**\n * Which motion a shift chord extends by, or `undefined` when the key is not a motion at all.\n *\n * Modifier first, then the bare keys, so `shift+cmd+←` is a line and `shift+⌥←` is a word rather than both\n * being a character. `shift+↑` extends a line up even on the first line, where the unshifted arrow means\n * history: selecting upward is unambiguous, and a history chord that also grew a selection would be one\n * key doing two unrelated things.\n *\n * `input` is deliberately not consulted. The `ESC b` spelling of `⌥←` would arrive shifted as `ESC B`, and\n * matching a capital letter here is how `shift+B` would start selecting words. Terminals send the CSI form\n * for a shifted arrow, which carries the flags this reads.\n */\nfunction shiftMotion(key: KeyState): MotionKind | undefined {\n if (key.super) {\n if (key.leftArrow) return \"cursorHome\"\n if (key.rightArrow) return \"cursorEnd\"\n if (key.upArrow) return \"bufferStart\"\n if (key.downArrow) return \"bufferEnd\"\n return undefined\n }\n if (key.meta || key.ctrl) {\n if (key.leftArrow) return \"wordLeft\"\n if (key.rightArrow) return \"wordRight\"\n return undefined\n }\n if (key.home) return \"cursorHome\"\n if (key.end) return \"cursorEnd\"\n if (key.leftArrow) return \"cursorLeft\"\n if (key.rightArrow) return \"cursorRight\"\n if (key.upArrow) return \"lineUp\"\n if (key.downArrow) return \"lineDown\"\n return undefined\n}\n\n/**\n * Drop C0 controls and DEL. A bracketed-paste marker or a stray escape sequence reaching the buffer\n * would be invisible on screen and sent to the model as if it had been typed.\n */\nfunction printableOnly(text: string): string {\n return [...text]\n .filter((char) => {\n const code = char.codePointAt(0) ?? 0\n return code >= 0x20 && code !== 0x7f\n })\n .join(\"\")\n}\n\n// ─── screen keymaps ──────────────────────────────────────────────────────────────────────\n//\n// The wizard and picker differ from the chat input in what Esc means — a *context*, not a new\n// module, which is why they live here beside `keyToIntent` rather than in per-screen files: one\n// keyboard home, closed by the same drift tests.\n\nimport type { SelectMove } from \"#lib/select\"\n\nexport type ListIntent =\n | { readonly kind: \"move\"; readonly move: SelectMove }\n | { readonly kind: \"choose\" }\n | { readonly kind: \"back\" }\n | { readonly kind: \"exit\" }\n | { readonly kind: \"none\" }\n\n/**\n * A checklist adds two verbs a single-select list does not have: tick a row, and finish.\n *\n * Space ticks and enter finishes, which is the convention every multi-select in a terminal uses — and\n * getting it the other way round is the mistake that makes a picker feel broken, because enter on a\n * highlighted row is such a strong habit that people submit with one thing ticked and never see the rest.\n * `a` and `n` are all/none, worth having when the list is fifty rows long.\n */\nexport type CheckIntent =\n | { readonly kind: \"move\"; readonly move: SelectMove }\n | { readonly kind: \"toggle\" }\n | { readonly kind: \"all\" }\n | { readonly kind: \"none-selected\" }\n | { readonly kind: \"confirm\" }\n | { readonly kind: \"cancel\" }\n | { readonly kind: \"none\" }\n\nexport function keyToCheckIntent(input: string, key: KeyState): CheckIntent {\n if (key.ctrl) {\n return input.toLowerCase() === \"c\" || input.toLowerCase() === \"d\"\n ? { kind: \"cancel\" }\n : { kind: \"none\" }\n }\n if (key.return) return { kind: \"confirm\" }\n if (key.escape) return { kind: \"cancel\" }\n // Ink reports the space bar as the input string \" \" with no flag of its own.\n if (input === \" \") return { kind: \"toggle\" }\n if (input === \"a\") return { kind: \"all\" }\n if (input === \"n\") return { kind: \"none-selected\" }\n\n const list = keyToListIntent(input, key)\n // Movement is shared so the two lists cannot drift apart; `choose` cannot arrive, because `key.return`\n // is handled above, and the remaining kinds are not this screen's.\n return list.kind === \"move\" ? list : { kind: \"none\" }\n}\n\n/**\n * List navigation: arrows or j/k, g/G for ends, enter chooses, esc backs out, ^C/^D leave.\n *\n * A digit jumps the cursor — visibly and reversibly — and deliberately does not choose: a stray\n * number must never launch an agent.\n */\nexport function keyToListIntent(input: string, key: KeyState): ListIntent {\n if (key.ctrl) {\n return input.toLowerCase() === \"c\" || input.toLowerCase() === \"d\"\n ? { kind: \"exit\" }\n : { kind: \"none\" }\n }\n if (key.return) return { kind: \"choose\" }\n if (key.escape) return { kind: \"back\" }\n if (key.upArrow) return { kind: \"move\", move: { kind: \"up\" } }\n if (key.downArrow) return { kind: \"move\", move: { kind: \"down\" } }\n\n switch (input) {\n case \"k\":\n return { kind: \"move\", move: { kind: \"up\" } }\n case \"j\":\n return { kind: \"move\", move: { kind: \"down\" } }\n case \"g\":\n return { kind: \"move\", move: { kind: \"first\" } }\n case \"G\":\n return { kind: \"move\", move: { kind: \"last\" } }\n default:\n break\n }\n if (/^[1-9]$/.test(input)) {\n return { kind: \"move\", move: { kind: \"jump\", index: Number(input) - 1 } }\n }\n return { kind: \"none\" }\n}\n\nexport type WizardKeyIntent =\n | { readonly kind: \"back\" }\n | { readonly kind: \"abort\" }\n | { readonly kind: \"commit\" }\n | { readonly kind: \"list\"; readonly intent: ListIntent }\n | { readonly kind: \"edit\"; readonly intent: Intent }\n\n/**\n * The wizard's chrome keys are checked before delegation — Esc means \"back a question\" here,\n * which is exactly why chat's `keyToIntent` (which claims Esc as none) is not reused raw.\n *\n * Text steps then get the full chat editor treatment (^A/^E, ^W, code-point cursor); select steps\n * get the list navigation. A pasted blob collapses to its first line — a wizard answer is one\n * line — and history chords mean nothing inside a question.\n */\nexport function keyToWizardIntent(\n input: string,\n key: KeyState,\n context: { readonly select: boolean; readonly empty: boolean },\n): WizardKeyIntent {\n if (key.ctrl && input.toLowerCase() === \"c\") return { kind: \"abort\" }\n if (key.escape) return { kind: \"back\" }\n if (key.return) return { kind: \"commit\" }\n\n if (context.select) {\n return { kind: \"list\", intent: keyToListIntent(input, key) }\n }\n\n // A wizard answer is one line — a pasted blob collapses to its first — so the cursor is always on\n // both the first and the last line, and ↑/↓ mean history rather than line movement. There is no\n // search here either.\n const intent = keyToIntent(input, key, {\n busy: false,\n empty: context.empty,\n firstLine: true,\n lastLine: true,\n searching: false,\n // A question is not a conversation: there is nothing to scroll and nothing to arm, and Esc is\n // claimed above as \"back a question\" before this is ever reached.\n armed: false,\n scrolled: false,\n })\n switch (intent.kind) {\n case \"submit\":\n return { kind: \"commit\" }\n case \"exit\":\n // ^D on an empty question line reads as \"get me out\", same as ^C.\n return { kind: \"abort\" }\n case \"arm\":\n case \"scroll\":\n // Unreachable in practice — ^C is claimed as `abort` above and there is nothing to scroll —\n // and listed rather than left to the default, so adding a session-only intent cannot\n // silently become an edit the wizard applies to a field.\n return { kind: \"edit\", intent: { kind: \"none\" } }\n case \"historyPrev\":\n case \"historyNext\":\n return { kind: \"edit\", intent: { kind: \"none\" } }\n case \"paste\":\n return {\n kind: \"edit\",\n intent: { kind: \"insert\", text: intent.lines[0] ?? \"\" },\n }\n default:\n return { kind: \"edit\", intent }\n }\n}\n"
7
7
  ],
8
- "mappings": ";+GA2BO,IAAM,EAA4B,CACrC,MAAO,GACP,OAAQ,EACR,QAAS,CAAC,EACV,cAAe,EACf,MAAO,GACP,KAAM,CAAC,EACP,OAAQ,CAAC,EACT,OAAQ,OACR,OAAQ,MACZ,EAEA,SAAS,CAAK,CAAC,EAAyB,CACpC,MAAO,CAAC,GAAG,CAAK,EAGpB,SAAS,CAAK,CAAC,EAAgB,EAAwB,CACnD,OAAO,KAAK,IAAI,EAAG,KAAK,IAAI,EAAQ,CAAM,CAAC,EAG/C,SAAS,CAA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