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
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/components/App.tsx", "../src/components/CommandOutput.tsx", "../src/components/HistorySearch.tsx", "../src/components/Live.tsx", "../src/components/Palette.tsx", "../src/components/Prompt.tsx", "../src/components/StatusBar.tsx", "../src/components/Transcript.tsx", "../src/lib/scroll.ts", "../src/lib/text-selection.ts", "../src/hooks/useElapsed.ts", "../src/hooks/useTurn.ts", "../src/lib/chat-frame.ts", "../src/lib/clipboard.ts", "../src/lib/palette.ts", "../src/lib/subcommand.ts"],
3
+ "sources": ["../src/components/App.tsx", "../src/components/CommandOutput.tsx", "../src/components/HistorySearch.tsx", "../src/components/Live.tsx", "../src/components/Palette.tsx", "../src/components/Prompt.tsx", "../src/components/StatusBar.tsx", "../src/components/Transcript.tsx", "../src/lib/scroll.ts", "../src/lib/text-selection.ts", "../src/hooks/useElapsed.ts", "../src/hooks/useTurn.ts", "../src/lib/chat-frame.ts", "../src/lib/clipboard.ts", "../src/lib/subcommand.ts"],
4
4
  "sourcesContent": [
5
- "/**\n * The chat surface — a full-screen session on the alternate buffer.\n *\n * Thin on purpose. Everything worth testing lives in pure modules — `keymap.ts` decides what a keystroke\n * means, `editor.ts` applies it to the line, `transcript.ts` turns bus events into rows, `lib/scroll.ts`\n * moves the window, `lib/chat-frame.ts` decides how many rows each part of the frame may have — so this\n * file is composition plus the decisions that need Ink itself: when to unmount, what to do about a\n * submission arriving mid-turn, and which surface currently owns the keyboard.\n *\n * ## What Phase 5.5 changed here\n *\n * The conversation is no longer in `<Static>`. It is a buffer of rows with a window over it, because\n * `<Static>` writes to the scrollback and the alternate screen discards its buffer on the way out — the\n * two cannot both be true. That has two consequences worth stating before editing:\n *\n * - **The frame has a hard height.** Everything visible must add up to at most the terminal's rows, or\n * Ink's own output scrolls the buffer and the layout comes apart. `chatFrame` owns that arithmetic; no\n * row count is invented in this file.\n * - **^C at an idle prompt takes two presses.** With the buffer discarded on exit, a single reflexive ^C\n * during a long reply would throw the visible conversation away. `keymap.ts` owns the decision; the\n * timer that expires it lives here, because a pure function cannot hold a clock.\n *\n * The Ctrl-C contract from Phase 1 is otherwise unchanged: during a turn it cancels the turn and the\n * prompt comes back.\n */\n\nimport { BRAND, VERSION } from \"@dispach/core\"\nimport { Box, Text, useApp, useInput } from \"ink\"\nimport { type ComponentType, useCallback, useEffect, useMemo, useRef, useState } from \"react\"\nimport { BRAND_INDENT, Brandmark } from \"#components/Brandmark\"\nimport { CommandOutput } from \"#components/CommandOutput\"\nimport type { ConfigEditorProps } from \"#components/ConfigEditor\"\nimport { HistorySearch } from \"#components/HistorySearch\"\nimport { Live } from \"#components/Live\"\nimport { Palette } from \"#components/Palette\"\nimport { Prompt } from \"#components/Prompt\"\nimport type { SessionPickerProps } from \"#components/SessionPicker\"\nimport type { SkillBrowserProps } from \"#components/SkillBrowser\"\nimport { Spinner } from \"#components/Spinner\"\nimport { StatusBar } from \"#components/StatusBar\"\nimport { Transcript } from \"#components/Transcript\"\nimport { applyIntent, EMPTY_EDITOR, selectionRange, submit } from \"#editor\"\nimport { useElapsed } from \"#hooks/useElapsed\"\nimport { useTerminalSize } from \"#hooks/useTerminalSize\"\nimport { useTurn } from \"#hooks/useTurn\"\nimport { keyContext, keyToIntent } from \"#keymap\"\nimport { chatFrame, composerHit, transcriptHit, transcriptRowsAfterBrand } from \"#lib/chat-frame\"\nimport { copyToClipboard } from \"#lib/clipboard\"\nimport type { EditorRow } from \"#lib/config-editor\"\nimport { applyEditorRow, editorRowsFor } from \"#lib/config-rows\"\nimport {\n EXIT_ARM_MS,\n FALLBACK_COLUMNS,\n LANDING_LIST_ROWS,\n MULTI_CLICK_MS,\n SEARCH_ROWS,\n SESSION_PICKER_ROWS,\n} from \"#lib/const\"\nimport { offeredCommands, paletteEntries, paletteFor, paletteSelection } from \"#lib/palette\"\nimport type { AppProps } from \"#lib/schema\"\nimport { screenColumns, titleLine } from \"#lib/screen\"\nimport { FOLLOWING, scroll, slice } from \"#lib/scroll\"\nimport {\n NEW_SESSION_HINT,\n resolveSessionCommand,\n sessionHelpText,\n type ToolsView,\n toolsReport,\n unknownCommandText,\n} from \"#lib/session-commands\"\nimport type { SessionRowSource } from \"#lib/sessions-view\"\nimport { runSubcommand } from \"#lib/subcommand\"\nimport {\n beginSelection,\n dragSelection,\n endSelection,\n extendSelection,\n lineAt,\n selectedText,\n type TextPoint,\n type TextSelection,\n wordAt,\n} from \"#lib/text-selection\"\nimport { THEME } from \"#lib/theme\"\nimport { wordmark } from \"#lib/wordmark\"\nimport { lastStats, transcriptRows } from \"#transcript\"\n\n/**\n * What is layered over the conversation.\n *\n * `output` is a command's captured text; `skills` is the one bespoke view a session hosts so far. Both\n * take the keyboard while open and both *replace* the transcript rather than sitting under it — sharing\n * the screen pushed the conversation off the top of a full-screen frame, which on a surface with no\n * scrollback means gone. Closing either returns to the prompt with the draft untouched, which is what\n * makes a pane an interlude rather than a detour.\n */\ntype Pane =\n | { readonly kind: \"none\" }\n | {\n readonly kind: \"output\"\n readonly label: string\n readonly lines: readonly string[] | undefined\n readonly code?: number\n readonly offset: number\n }\n | { readonly kind: \"skills\" }\n /**\n * The conversation switcher. `undefined` while the store is being read.\n *\n * Loaded when the pane opens rather than kept current, because the list changes only when a turn ends\n * and re-reading it on every frame would put a database query in the render path.\n */\n | { readonly kind: \"sessions\"; readonly stored: readonly SessionRowSource[] | undefined }\n /**\n * The settings editor. `rows` is read when the pane opens, not kept current.\n *\n * Read once because the editor re-reads after each write of its own — keeping it live here would put\n * a file read in the render path for a surface that already knows when it has changed something.\n */\n | { readonly kind: \"config\"; readonly rows: readonly EditorRow[] }\n\nexport function App({\n source,\n sessionKey,\n model,\n agentName,\n warnings,\n freshSession,\n initial,\n correctKeys,\n showReasoning,\n quiet,\n onRestart,\n onSwitch,\n onNew,\n sessions,\n initialDraft,\n manifestPath,\n catalogue,\n status,\n contextView,\n}: AppProps) {\n const { exit } = useApp()\n const size = useTerminalSize()\n const columns = screenColumns(size.columns, FALLBACK_COLUMNS)\n const { state, busy, send, cancel, note, trim } = useTurn({ source, sessionKey, initial })\n // A draft handed in by a `/restart` opens the prompt with the cursor at its end, which is where the\n // person left it. Only the initial value — a later prop change must not overwrite what is being\n // typed now, which is exactly what `useState`'s initialiser semantics give for free.\n const [editor, setEditor] = useState(() =>\n initialDraft === undefined || initialDraft === \"\"\n ? EMPTY_EDITOR\n : { ...EMPTY_EDITOR, value: initialDraft, cursor: [...initialDraft].length },\n )\n\n /**\n * What is on top of the conversation, if anything.\n *\n * A pane is *focused* while it is open, so the prompt's `useInput` stands down — Ink fires every\n * active hook, and two surfaces reading one keystroke is the bug the focus rule exists to prevent.\n */\n const [pane, setPane] = useState<Pane>({ kind: \"none\" })\n /**\n * The skills view's implementation, loaded when it is first opened.\n *\n * Dynamically, and that is not an optimisation. `browse.ts` also imports this component dynamically,\n * and bun's `--splitting` emits a module's exports **twice** when one importer is static and another is\n * dynamic — producing a bundle that dies at parse time with `Duplicate export of 'SkillBrowser'`, which\n * no test that imports source can see. The props come in as a type, which is erased and creates no\n * edge. `boundaries.test.ts` bans the mixing outright.\n */\n const [Browser, setBrowser] = useState<ComponentType<SkillBrowserProps> | undefined>(undefined)\n /**\n * The session switcher's implementation, loaded when the pane first opens.\n *\n * Dynamically for the same reason `Browser` is, and it was caught by the boundaries test rather than\n * remembered: `run.ts` mounts this component too, for a bare `--session` before any chat exists. One\n * static importer and one dynamic one makes bun's `--splitting` emit its exports **twice**, and the\n * built binary then dies at parse time with `Duplicate export of 'SessionPicker'` while every test —\n * which imports source — passes. Both edges dynamic, no duplicate.\n */\n const [Editor, setEditor_] = useState<ComponentType<ConfigEditorProps> | undefined>(undefined)\n const [Sessions, setSessions] = useState<ComponentType<SessionPickerProps> | undefined>(\n undefined,\n )\n /** Where the conversation window sits. Starts and returns to following the newest row. */\n const [view, setView] = useState(FOLLOWING)\n /** A first ^C has landed. Expires, which is why it is here and not in the keymap. */\n const [armed, setArmed] = useState(false)\n /** `/exit` asked; the next keystroke answers. `undefined` means nothing is being confirmed. */\n const [confirming, setConfirming] = useState(false)\n /**\n * Reasoning shown whole rather than folded to a count. Session-wide, and `⌥r` toggles it.\n *\n * Folded is the default because a real turn produced a twenty-three-row block for a one-sentence\n * answer, which filled the terminal and left the reply itself somewhere above the fold.\n */\n const [expandReasoning, setExpandReasoning] = useState(false)\n /**\n * The mouse selection over the transcript, in buffer coordinates.\n *\n * Cleared by eviction below rather than re-keyed: rows are addressed by position, so dropping any from\n * the front shifts every index — a selection kept across a trim would silently start covering different\n * text, which is the \"looks live and is not\" failure `pinned` exists to prevent. There is also nothing\n * to copy from rows that no longer exist.\n */\n const [selection, setSelection] = useState<TextSelection | undefined>(undefined)\n /**\n * The previous press, for counting clicks.\n *\n * A ref rather than state: nothing renders from it, and putting it in state would redraw the whole tree\n * on every press. Multi-click has to be inferred from time and position because a terminal reports\n * three presses and never a \"double click\" — the same reason the reference CLI keeps its own window.\n */\n const lastPress = useRef<{ at: TextPoint; when: number; clicks: number } | undefined>(undefined)\n // Derived from the buffer rather than stored, so the only palette state is where the cursor is.\n const palette = pane.kind === \"none\" ? paletteFor(editor.value) : undefined\n const [paletteIndex, setPaletteIndex] = useState(0)\n\n const elapsed = useElapsed(busy)\n const last = useMemo(() => lastStats(state.items), [state.items])\n\n /**\n * The conversation, wrapped to the width and flattened to rows.\n *\n * Memoised on the three things it depends on. Without that it would re-flatten and re-wrap the whole\n * history on every streamed token, which is the cost `<Static>` used to remove for free.\n */\n const rows = useMemo(\n () => transcriptRows(state.items, { showReasoning, quiet, columns, expandReasoning }),\n [state.items, showReasoning, quiet, columns, expandReasoning],\n )\n\n /**\n * The landing state: a new conversation with nothing sent into it yet.\n *\n * It is a *state of the one frame*, not a screen of its own, and that is the whole design. As a separate\n * screen it was swapped out the moment anything reached the transcript — which `/help`, `/tools` and\n * `/restart` all do — so the landing screen \"disappeared\" for almost every command. And anything added to\n * the other layout was silently missing from it: the palette drew nothing there for a day, and `/exit`'s\n * \"press y\" prompt was invisible, because both live in the layout that was not on screen. One frame\n * removes that class of bug rather than fixing instances of it.\n *\n * `freshSession` is the host's answer to \"is this conversation new\". It used to be load-bearing for a\n * second reason — the chat did not render stored messages, so an empty transcript was equally true of a\n * resumed session — and that is no longer the case: `seedHistory` paints the conversation, so the `user`\n * clause below is now true on its own for anything resumed. Both are kept because they answer different\n * questions, and the remaining job of `freshSession` is the genuinely new session, where there is no\n * history for the second clause to find. The second half is what the owner chose: slash commands, notes\n * and the banner all keep the brand mark, because they are setup rather than conversation. It goes when\n * you actually start talking, and does not come back.\n */\n const landing = freshSession === true && !state.items.some((item) => item.role === \"user\")\n\n // A longer list while landing: there is no conversation to hide behind it, and the screen somebody opens\n // before they know the commands should show all of them rather than six and a counter.\n const listRows = landing ? LANDING_LIST_ROWS : SEARCH_ROWS\n const frame = chatFrame({\n rows: size.rows,\n columns,\n editor,\n live: state.live,\n showReasoning,\n palette,\n paletteMaxRows: listRows,\n searchMaxRows: listRows,\n confirming,\n landing,\n hint: landing,\n })\n /**\n * The brand mark, rendered here so the conversation is charged what it actually draws.\n *\n * `frame.brand` is an allowance and `wordmark` usually takes far less of it — charging the allowance\n * wasted eleven rows on a thirty-row terminal, and the banner ended up scrolled to a mid-wrap fragment of\n * a store path with a third of the screen blank. Computed once and handed to `Brandmark` as lines, so\n * there is no second derivation that could disagree about how tall the frame is.\n */\n const mark =\n frame.brand > 0\n ? wordmark(BRAND.name, { columns: columns - BRAND_INDENT, rows: frame.brand })\n : undefined\n const window = slice(\n view,\n rows.length,\n transcriptRowsAfterBrand(frame, mark?.lines.length ?? 0),\n )\n\n /**\n * Bound the transcript, but only while following the tail.\n *\n * Every item is re-derived and re-wrapped on each frame now that the conversation is a windowed buffer\n * rather than `<Static>` output, so an unbounded one is unbounded work per keystroke. The gate is the\n * point: rows are addressed by position, so dropping any from the front shifts every offset below\n * them — evicting while somebody is parked twelve turns back would leave their offset untouched and\n * the text under it different, which is a session that looks live and is not. Deferring costs nothing,\n * because `esc` returns to the tail and the next append trims then.\n *\n * Called on every change with no check of its own: a buffer under the cap reduces to identical state,\n * so React bails out of the render.\n */\n // `state.items.length` below is a *trigger*, not a read: the body never looks at it, and it is there\n // so a growing conversation re-runs the check. The lint rule offers to remove it, and taking that\n // offer would leave the cap enforced once at mount and never again — a fix that lints clean and does\n // nothing, which is why the suppression carries a reason rather than the dependency being dropped.\n // biome-ignore lint/correctness/useExhaustiveDependencies: a deliberate trigger dependency; see above\n useEffect(() => {\n if (!view.pinned) return\n // Eviction shifts every row index, so a selection made before a trim would afterwards cover\n // different text — the same hazard `pinned` exists for, applied to a highlight. Cleared rather\n // than re-keyed: there is nothing to copy from rows that are gone, and a highlight that quietly\n // slid onto another reply is worse than one that disappeared.\n setSelection(undefined)\n trim()\n }, [view.pinned, state.items.length, trim])\n\n // The armed ^C expires on its own. A prompt that stayed armed indefinitely would turn a ^C pressed\n // minutes ago into the reason a later one ended the session.\n useEffect(() => {\n if (!armed) return\n const timer = setTimeout(() => setArmed(false), EXIT_ARM_MS)\n return () => clearTimeout(timer)\n }, [armed])\n\n /**\n * A submitted line: a slash command, or a message for the model.\n *\n * `draft` is what is *left in the buffer* afterwards, and it has to be passed in rather than read from\n * `editor` here. This closure captures the editor as it was when the frame rendered — before the submit\n * cleared it — so reading `editor.value` returned the command that was just consumed. `/restart` then\n * carried `/restart` across as the draft, which re-opened the palette on top of the new banner: the\n * screen came back identical to before enter was pressed, with the message hidden behind the list, and\n * the restart looked like it had done nothing at all.\n *\n * For a typed command the residual is always empty — `COMMAND_SHAPE` matches the whole trimmed line, so\n * a command cannot share the buffer with a draft. It stays a parameter because a restart offered by a\n * *pane* could, and that is what the carry-across exists for.\n */\n const onSubmit = (text: string, draft: string): void => {\n // Both renderers dispatch through the same table, so `--plain` and the rich path cannot\n // answer the same typed command differently.\n // `offered` is what turns a typed `/config get x` into a command rather than a message. Without\n // it the list defaults to empty, so **no** CLI command resolved when typed with arguments: the\n // palette ran them and typing the same thing sent it to the model as prose, which then answered\n // about it. Selecting `/config` from the list worked, and typing `/config get model.main.id` cost\n // a turn — the same command, two answers, which is exactly what `resolveSessionCommand` living in\n // one place is supposed to prevent.\n const command = resolveSessionCommand(text, offeredCommands())\n if (command !== undefined) {\n switch (command.kind) {\n case \"exit\":\n // Asked, not done. `/exit` is typed deliberately, but so is every other slash command,\n // and the one that discards the visible conversation is worth one keystroke of\n // confirmation on a surface where leaving takes the screen with it.\n setConfirming(true)\n return\n case \"restart\": {\n // The settings an agent booted with are fixed for its lifetime, so a\n // configuration change needs a new one. Nothing is lost either way: the\n // conversation lives in the store and the same session key resumes it.\n //\n // **Attached, the screen does not come down.** The host owns the agent, so this\n // is a request to replace it — and there is nothing in this process to rebuild,\n // so tearing the frame down would be a teardown for its own sake. Embedded,\n // `onRestart` unmounts and the loop builds a new runtime; the unsent draft\n // rides across, because throwing away a half-written message is a second,\n // unasked-for consequence of asking for the first.\n const reload = source.reload\n if (reload === undefined) {\n onRestart?.(draft)\n exit()\n return\n }\n note(\"asking the host to reload this agent…\")\n reload()\n .then((adopted: readonly string[]) =>\n note(\n // Named rather than counted: replacing a supervisor replaces its\n // team, and \"3 agents reloaded\" would leave somebody guessing which.\n `reloaded ${adopted.join(\", \")} — this conversation continues`,\n ),\n )\n .catch((error: unknown) =>\n note(\n `could not reload: ${error instanceof Error ? error.message : String(error)}`,\n ),\n )\n return\n }\n case \"new\":\n // The same unmount-and-reopen route `/restart` and `/sessions` take, for the same\n // reason: a transcript cannot be re-keyed in place. Nothing is destroyed — the\n // conversation being left keeps its key, and the next banner names it.\n onNew?.(draft)\n exit()\n return\n case \"help\":\n note(sessionHelpText())\n return\n case \"tools\":\n // Fire-and-report, like `/status` and `/context` beside it: a component cannot\n // block, so the note is the acknowledgement. Embedded this resolves off the\n // live registry with no await worth mentioning; attached it is a request, and\n // the two must not read differently to whoever typed it.\n source\n .tools()\n .then((view: ToolsView) => note(toolsReport(view)))\n .catch((error: unknown) =>\n note(\n `could not read the tools: ${error instanceof Error ? error.message : String(error)}`,\n ),\n )\n return\n case \"context\":\n // Same shape as `status` below: a component cannot block, so the note is the\n // acknowledgement. Absent means the surface is not offered rather than accepted\n // and silently billed to the model, which is what `/status` did for three phases.\n if (contextView === undefined) {\n note(\"context is unavailable in this session\")\n return\n }\n contextView()\n .then(note)\n .catch((error: unknown) =>\n note(\n `could not read the context: ${error instanceof Error ? error.message : String(error)}`,\n ),\n )\n return\n case \"status\":\n // Declared in `SESSION_COMMANDS`, advertised in `/help` and generated into the\n // palette — and unhandled here, so it fell out of this switch and was sent to the\n // model as prose. Not a type error: the union's first member is\n // `{kind: SessionCommandKind}` and this switch has no exhaustiveness guard, which\n // is why `boundaries.test.ts` now walks every kind. Seventh instance in this repo\n // of every layer being right and one not being connected.\n //\n // Awaited through `.then` rather than inline: a component cannot block, and the\n // note *is* the acknowledgement — the same shape `reset` below uses.\n if (status === undefined) {\n note(\"status is unavailable in this session\")\n return\n }\n status()\n .then(note)\n .catch((error: unknown) =>\n note(\n `could not read the status: ${error instanceof Error ? error.message : String(error)}`,\n ),\n )\n return\n case \"reset\":\n // Fire-and-report rather than awaited: a component cannot block, and the note is\n // the acknowledgement. A failure surfaces as a rejected promise, so it is caught.\n source\n .clearSession(sessionKey)\n .then(() => note(\"session cleared — memory files on disk are untouched\"))\n .catch((error: unknown) =>\n note(\n `could not clear the session: ${error instanceof Error ? error.message : String(error)}`,\n ),\n )\n return\n case \"command\":\n // Through `dispatch`, which is the palette's path too — its own comment says it is\n // shared \"so the two cannot diverge\", and until now only one of the two reached it.\n if (dispatch(`/${command.name}`, command.rest)) return\n note(unknownCommandText({ word: `/${command.name}` }))\n return\n case \"unknown\":\n note(unknownCommandText(command))\n return\n }\n }\n if (busy) {\n // Two turns on one session would interleave in the history the next turn is conditioned\n // on. Refusing is honest; queueing silently would make the reply order unpredictable.\n note(\"a turn is still running — ^C cancels it, then send again\")\n return\n }\n send(text)\n }\n\n /**\n * Run a command and show what it printed.\n *\n * The pane opens *before* the command starts, with a spinner, for the same reason the skills browser\n * mounts before it fetches: a command that takes a second with nothing on screen is indistinguishable\n * from a keystroke that did nothing.\n */\n const openCommand = useCallback(\n (name: string, rest: string) => {\n setPane({ kind: \"output\", label: `/${name}`, lines: undefined, offset: 0 })\n void runSubcommand({ name, rest, manifestPath: manifestPath ?? \"\" })\n .then((result) =>\n setPane({\n kind: \"output\",\n label: `/${name}`,\n lines: result.lines,\n code: result.code,\n offset: 0,\n }),\n )\n .catch((error: unknown) =>\n setPane({\n kind: \"output\",\n label: `/${name}`,\n lines: [error instanceof Error ? error.message : String(error)],\n code: 1,\n offset: 0,\n }),\n )\n },\n [manifestPath],\n )\n\n /** A slash command, from the palette or from a typed line. Shared so the two cannot diverge. */\n const dispatch = useCallback(\n (word: string, rest: string) => {\n const entry = paletteEntries().find((candidate) => candidate.word === word)\n if (entry === undefined) return false\n if (entry.kind === \"view\") {\n if (\n entry.word === \"/sessions\" &&\n sessions !== undefined &&\n onSwitch !== undefined\n ) {\n // Opened before the read finishes, with the spinner the pane draws for an undefined\n // list — the same reason the catalogue mounts before it fetches: a keystroke followed\n // by nothing is indistinguishable from a keystroke that did nothing.\n setPane({ kind: \"sessions\", stored: undefined })\n void import(\"#components/SessionPicker\").then((module) =>\n // Wrapped in a function, or `useState` would call the component as an updater.\n setSessions(() => module.SessionPicker),\n )\n void sessions()\n .then((stored) => setPane({ kind: \"sessions\", stored }))\n .catch((error: unknown) => {\n setPane({ kind: \"none\" })\n note(\n `could not read the stored conversations: ${error instanceof Error ? error.message : String(error)}`,\n )\n })\n return true\n }\n if (entry.word === \"/config\" && (rest.trim() === \"\" || rest.trim() === \"edit\")) {\n // Bare `/config` is the editor; `/config list` and the rest are still the plain\n // command in an output pane, which the fallthrough below handles.\n if (manifestPath === undefined) {\n note(\"this session has no manifest path, so there is nothing to edit\")\n return true\n }\n setPane({ kind: \"config\", rows: editorRowsFor(manifestPath) })\n void import(\"#components/ConfigEditor\").then((module) =>\n // Wrapped in a function, or `useState` would call the component as an updater.\n setEditor_(() => module.ConfigEditor),\n )\n return true\n }\n if (entry.word === \"/skills\" && catalogue !== undefined) {\n setPane({ kind: \"skills\" })\n void import(\"#components/SkillBrowser\").then((module) =>\n // Wrapped in a function, or `useState` would call the component as an updater.\n setBrowser(() => module.SkillBrowser),\n )\n return true\n }\n // A view named in the table with nothing built yet falls back to its own output, which is\n // still the command doing its job — better than a palette entry that does nothing.\n openCommand(entry.word.slice(1), rest)\n return true\n }\n if (entry.kind === \"output\") {\n openCommand(entry.word.slice(1), rest)\n return true\n }\n return false\n },\n // `manifestPath` is read by the `/config` branch. A prop that does not change in practice, and\n // listing it is what stops a later change from being captured stale — the same reason the rule\n // exists rather than a suppression here.\n [openCommand, catalogue, sessions, onSwitch, note, manifestPath],\n )\n\n // ── the pane has the keyboard while it is open ────────────────────────────────────────\n useInput(\n (input, key) => {\n if (pane.kind !== \"output\") return\n if (key.escape || input === \"q\") {\n setPane({ kind: \"none\" })\n return\n }\n const total = pane.lines?.length ?? 0\n const step = key.pageDown || key.pageUp ? frame.pane : 1\n const delta =\n key.downArrow || key.pageDown ? step : key.upArrow || key.pageUp ? -step : 0\n if (delta !== 0) {\n setPane({\n ...pane,\n offset: Math.max(0, Math.min(pane.offset + delta, Math.max(0, total - 1))),\n })\n }\n },\n { isActive: pane.kind === \"output\" },\n )\n\n useInput(\n (input, reported) => {\n // Modifiers off the wire where they can be had, before anything reads one.\n //\n // Ink folds the super bit into `meta` on its legacy path (`modifier & 10`), so `cmd+←` and\n // `⌥←` arrive as the same keystroke and both word-move — measured in a real Warp session.\n // First line of the handler rather than beside `keyToIntent`, because the palette branch below\n // reads `key.escape` and `key.upArrow` too, and a correction applied after it would be one\n // that two of the three branches never got.\n const key = correctKeys === undefined ? reported : correctKeys(reported, input)\n\n // A pending confirmation owns the keyboard for exactly one keystroke. Anything other than a\n // yes is a no — including a stray arrow, because the safe answer to an unclear one is to stay.\n if (confirming) {\n setConfirming(false)\n if (input.toLowerCase() === \"y\" || key.return) exit()\n return\n }\n\n // The palette owns the keys it needs while it is open, and hands everything else to the editor —\n // so typing continues to narrow the list rather than being swallowed by it.\n if (palette !== undefined) {\n if (key.escape) {\n setEditor((current) => applyIntent(current, { kind: \"killToStart\" }))\n setPaletteIndex(0)\n return\n }\n if (key.upArrow || key.downArrow) {\n setPaletteIndex((at) =>\n Math.max(\n 0,\n Math.min(at + (key.downArrow ? 1 : -1), palette.matches.length - 1),\n ),\n )\n return\n }\n if (key.tab) {\n const chosen = paletteSelection(palette, paletteIndex)\n if (chosen !== undefined) {\n setEditor((current) =>\n applyIntent(\n { ...current, value: \"\", cursor: 0 },\n {\n kind: \"insert\",\n text: chosen.word,\n },\n ),\n )\n }\n return\n }\n const selected = paletteSelection(palette, paletteIndex)\n // Only intercepted when something is selected. With no match, enter falls through to the\n // ordinary submit path, which reports `/skils is not a command` and suggests the nearest\n // one — swallowing it here made a mistyped command do nothing at all, which is worse.\n if (key.return && selected !== undefined) {\n const chosen = selected\n setPaletteIndex(0)\n setEditor((current) => ({ ...current, value: \"\", cursor: 0 }))\n // A session verb goes through the same submit path a typed line takes, so `/help` and\n // `/reset` behave identically whether they were completed or typed out.\n // The buffer was cleared in the same handler, so nothing is left behind.\n if (chosen.kind === \"session\") onSubmit(chosen.word, \"\")\n else dispatch(chosen.word, \"\")\n return\n }\n }\n\n const intent = keyToIntent(\n input,\n key,\n keyContext(editor, busy, { armed, scrolled: !view.pinned }),\n )\n\n // Any keystroke that is not the second ^C disarms. Without this the warning would stay true\n // while somebody typed a whole message, and the ^C they pressed at the end of it — meaning\n // \"cancel that\" — would end the session instead.\n if (armed && intent.kind !== \"exit\") setArmed(false)\n\n if (intent.kind === \"arm\") {\n setArmed(true)\n return\n }\n if (intent.kind === \"scroll\") {\n // `times` is the wheel: one chunk can carry several notches, and applying one of them makes\n // a flick of the wheel move a single row. Folded rather than given its own move, so the\n // clamping at both ends stays in one function.\n const times = Math.max(1, intent.times ?? 1)\n setView((current) => {\n let next = current\n for (let step = 0; step < times; step += 1) {\n next = scroll(next, intent.move, rows.length, frame.transcript)\n }\n return next\n })\n return\n }\n if (intent.kind === \"pointer\") {\n // Screen cell to buffer row, through the one function that owns the frame's vertical\n // arithmetic. `undefined` means the cell was chrome — the header, the composer, the status\n // line — and a click there clears the selection rather than selecting the nearest row,\n // because clamping would make clicking the status bar highlight the last reply.\n const hit = transcriptHit(\n { column: intent.column, row: intent.row },\n { brandLines: mark?.lines.length ?? 0, from: window.from, to: window.to },\n )\n if (hit === undefined) {\n // Not the transcript — try the composer. Selecting your own draft with the mouse is\n // the same gesture and a different target, so it is the same branch rather than a\n // second handler that would have to re-derive which cell belongs to whom.\n const offset = composerHit(\n { column: intent.column, row: intent.row },\n { editor, columns, rows: size.rows, hint: landing },\n )\n if (offset === undefined) {\n // Genuine chrome. A press clears both selections rather than clamping to whatever\n // is nearest, because a click on the status line that highlighted the last reply\n // would look deliberate.\n if (intent.gesture === \"press\") {\n setSelection(undefined)\n setEditor((current) => ({ ...current, anchor: undefined }))\n }\n return\n }\n setSelection(undefined)\n setEditor((current) =>\n intent.gesture === \"press\" && !intent.shift\n ? // A press places the caret and starts a possible selection from it; the\n // anchor is set now so the first drag report has something to extend from.\n { ...current, cursor: offset, anchor: offset }\n : // A drag, or a shift-click, moves the cursor and keeps the anchor — which is\n // exactly what `extend` does for a shifted motion, expressed directly\n // because there is no motion here, only a destination.\n {\n ...current,\n cursor: offset,\n anchor: current.anchor ?? current.cursor,\n },\n )\n return\n }\n if (intent.gesture === \"press\") {\n // Shift extends whatever is already there, which is the gesture for correcting a\n // selection that stopped a word short. Checked before the click count, because a\n // shift-click is a deliberate second gesture rather than a fast repeat of the first.\n if (intent.shift && selection !== undefined) {\n setSelection(extendSelection(selection, hit))\n lastPress.current = undefined\n return\n }\n const previous = lastPress.current\n const repeat =\n previous !== undefined &&\n Date.now() - previous.when <= MULTI_CLICK_MS &&\n previous.at.row === hit.row &&\n previous.at.column === hit.column\n // Third click wraps back to one, so a fourth starts a fresh drag rather than doing\n // nothing — a count that only grew would leave rapid clicking permanently stuck on\n // \"line\".\n const clicks = repeat ? (previous.clicks % 3) + 1 : 1\n lastPress.current = { at: hit, when: Date.now(), clicks }\n // One selection at a time. Two visible highlights with one clipboard between them is\n // a screen that cannot say what ⌘C would copy.\n setEditor((current) => ({ ...current, anchor: undefined }))\n setSelection(\n clicks === 3\n ? lineAt(rows, hit)\n : clicks === 2\n ? wordAt(rows, hit)\n : beginSelection(hit),\n )\n return\n }\n if (intent.gesture === \"drag\") {\n setSelection((current) =>\n current === undefined ? undefined : dragSelection(current, hit),\n )\n return\n }\n // Release. The clipboard is written here and nowhere else, because `cmd+c` cannot reach a\n // terminal app — the terminal claims it and finds no native selection, mouse tracking\n // having disabled the one it would have used. Copying on mouse-up is what makes `cmd+v`\n // work, and a copy that failed says so rather than leaving the previous clipboard in place\n // looking like the wrong text was selected.\n // Derived from *this* report rather than from the state in the closure. A release carries\n // its own final position, and `selection` here is whatever the last render saw — which on\n // a fast drag-and-release is one motion behind, so copying from it would drop the last few\n // characters somebody deliberately included.\n const finished =\n selection === undefined\n ? undefined\n : endSelection(dragSelection(selection, hit))\n setSelection(finished)\n const text = selectedText(rows, finished)\n if (text !== \"\") {\n void copyToClipboard(text).then((result) => {\n if (!result.copied && result.problem !== \"nothing selected\") {\n note(`could not copy: ${result.problem ?? \"unknown\"}`)\n }\n })\n }\n return\n }\n if (intent.kind === \"copySelection\" || intent.kind === \"cutSelection\") {\n const range = selectionRange(editor)\n if (range === undefined) {\n note(\"nothing selected — hold shift with a motion, or drag in the box\")\n return\n }\n const text = [...editor.value].slice(range.start, range.end).join(\"\")\n if (intent.kind === \"cutSelection\")\n setEditor((current) => applyIntent(current, intent))\n void copyToClipboard(text).then((result) => {\n if (!result.copied) note(`could not copy: ${result.problem ?? \"unknown\"}`)\n })\n return\n }\n if (intent.kind === \"reasoning\") {\n // A chord with nothing to act on has to say so.\n //\n // Reported as \"⌥r doesn't do anything\", and it was arriving and resolving correctly the\n // whole time: it toggles a fold, and a fold with nothing in it looks exactly like a dead\n // key. Two different reasons for that, and they need two different sentences — a model\n // that never streams reasoning is not the same as a turn that has not produced any yet,\n // and only the first is worth changing a flag over.\n // Visibility, not existence — and the order matters. `useTurn` appends a reasoning item\n // for every delta the model streams *regardless* of `showReasoning`, and `transcript.ts`\n // filters them out at render. So a session with reasoning hidden has items that cannot be\n // shown, and testing existence first fell through to a toggle whose rows were filtered\n // away: silently nothing, which is the failure this whole branch exists to prevent.\n if (!showReasoning) {\n note(\n \"reasoning is off: either this model does not stream it, or --no-reasoning is set\",\n )\n return\n }\n if (!state.items.some((item) => item.role === \"reasoning\")) {\n note(\"no reasoning to show yet — this expands it once a turn has streamed some\")\n return\n }\n // Unfolding changes how tall the conversation is, so the window has to be told to follow\n // the newest row again — leaving it parked would put the reader at a row that has moved.\n setExpandReasoning((current) => !current)\n setView(FOLLOWING)\n return\n }\n if (intent.kind === \"exit\") {\n exit()\n return\n }\n if (intent.kind === \"cancel\") {\n cancel()\n return\n }\n if (intent.kind === \"submit\") {\n const committed = submit(editor)\n setEditor(committed.state)\n // Sending is an implicit \"take me back to the newest row\": a reply arriving into a window\n // parked ten screens up would be generated where nobody can see it.\n setView(FOLLOWING)\n if (committed.text !== \"\") onSubmit(committed.text, committed.state.value)\n return\n }\n if (intent.kind === \"paste\") {\n // Inserted with its newlines intact, as one message.\n //\n // This used to submit every finished line in the chunk, and that was right when the buffer\n // could not hold a newline: the alternative then was silently running the words together.\n // Now that a message is composed rather than typed on one line, sending line-by-line is the\n // bug multi-line composition exists to remove — pasting a twelve-line code block produced\n // twelve messages, each conditioned on the last, and no way to edit any of them.\n setEditor((current) =>\n applyIntent(current, { kind: \"insert\", text: intent.lines.join(\"\\n\") }),\n )\n return\n }\n // The match list changes underneath the cursor on every keystroke, so keeping its position\n // would silently highlight a different entry than the one on screen — the same reason the\n // history search resets its index.\n if (palette !== undefined) setPaletteIndex(0)\n setEditor((current) => applyIntent(current, intent))\n },\n { isActive: pane.kind === \"none\" },\n )\n\n if (pane.kind === \"config\") {\n return (\n <Box flexDirection=\"column\" width={columns} height={size.rows}>\n <Text color={THEME.accent} bold wrap=\"truncate\">\n {titleLine({ title: `${BRAND.name} ${VERSION}`, summary: \"settings\" }, columns)}\n </Text>\n {Editor === undefined ? (\n <Box marginLeft={2}>\n <Spinner label=\"reading the settings\" />\n </Box>\n ) : (\n <Editor\n rows={pane.rows}\n apply={(row, raw) => applyEditorRow(manifestPath ?? \"\", row, raw)}\n reload={() => editorRowsFor(manifestPath ?? \"\")}\n columns={columns}\n window={SESSION_PICKER_ROWS}\n onDone={(changed) => {\n setPane({ kind: \"none\" })\n // An agent's settings are fixed for the lifetime of the process running it,\n // so a change that is not followed by a restart is a change that silently\n // did not apply — rule 8's shape. The draft rides across, for the reason\n // `/restart` carries it: throwing away a half-written message is a second,\n // unasked-for consequence of asking for the first.\n if (changed) {\n onRestart?.(editor.value)\n exit()\n }\n }}\n />\n )}\n {/*\n * The slack goes *below* a long list, not above it. Bottom-anchoring is right for the\n * conversation switcher — a dozen short rows that read as a menu — and wrong here: the\n * settings run past twenty rows, so a spacer above them started the list mid-screen with\n * eight blank rows over it and the rest running off the bottom.\n */}\n <Box flexGrow={1} />\n </Box>\n )\n }\n\n if (pane.kind === \"sessions\") {\n return (\n <Box flexDirection=\"column\" width={columns} height={size.rows}>\n <Text color={THEME.accent} bold wrap=\"truncate\">\n {titleLine(\n { title: `${BRAND.name} ${VERSION}`, summary: \"pick a conversation\" },\n columns,\n )}\n </Text>\n <Box flexGrow={1} />\n {pane.stored === undefined || Sessions === undefined ? (\n <Box marginLeft={2}>\n <Spinner label=\"reading the stored conversations\" />\n </Box>\n ) : (\n <Sessions\n sessions={pane.stored}\n now={Date.now()}\n columns={columns}\n maxRows={SESSION_PICKER_ROWS}\n current={sessionKey}\n onDone={(picked) => {\n if (picked === undefined || picked === sessionKey) {\n // Esc, or the one already open. Either way nothing is worth a rebuild.\n setPane({ kind: \"none\" })\n return\n }\n onSwitch?.(picked, editor.value)\n exit()\n }}\n />\n )}\n <Box flexGrow={1} />\n </Box>\n )\n }\n\n if (pane.kind === \"skills\" && catalogue !== undefined && Browser !== undefined) {\n return (\n <Browser\n title={`${BRAND.name} ${VERSION}`}\n agents={[]}\n target={manifestPath ?? \"\"}\n load={catalogue.load}\n install={catalogue.install}\n onDone={() => setPane({ kind: \"none\" })}\n />\n )\n }\n\n const header = titleLine(\n {\n title: `${BRAND.name} ${VERSION}`,\n summary: \"\",\n agent: { name: agentName, model },\n ...(warnings === undefined || warnings.length === 0 ? {} : { warnings }),\n },\n columns,\n )\n\n return (\n // Fixed height, because the alternate screen has no scrollback to absorb an overshoot: one row too\n // many and Ink's own output scrolls the buffer, which leaves the status line halfway up the display.\n <Box flexDirection=\"column\" width={columns} height={size.rows}>\n {/*\n * Above the one-line header, and only while landing. Nothing appears or disappears when it goes —\n * the line below it is the same line either way, which is what makes the collapse read as the same\n * screen with less on it rather than as a different screen.\n */}\n {mark === undefined ? null : (\n <>\n <Brandmark lines={mark.lines} />\n <Text> </Text>\n </>\n )}\n <Text color={THEME.accent} bold wrap=\"truncate\">\n {header}\n </Text>\n\n {pane.kind === \"output\" ? (\n <Box flexDirection=\"column\">\n <CommandOutput\n lines={pane.lines}\n label={pane.label}\n offset={pane.offset}\n maxRows={frame.pane}\n {...(pane.code === undefined ? {} : { code: pane.code })}\n />\n <Text dimColor wrap=\"truncate\">\n {\" \"}↑↓ scroll · esc back to the prompt\n </Text>\n </Box>\n ) : (\n <Transcript\n rows={rows}\n slice={window}\n {...(selection === undefined ? {} : { selection })}\n />\n )}\n\n {/*\n * Absorbs the slack, so the composer sits on the bottom edge of every frame.\n *\n * Unconditional, and that is the whole of decision 11.98's reversal. It used to stand down while\n * landing, on the grounds that twelve blank rows between the banner and the input read as a\n * half-empty screen — but a bottom-anchored input is where the eye already rests, so what those\n * rows read as is a prompt waiting. The reference CLI puts ~25 there and nobody reports it.\n *\n * The cost of the old arrangement was not the blank rows, it was that the composer *moved*: it\n * was drawn under whatever content existed, so it walked down the screen as the first few\n * messages arrived and only settled once the transcript filled the window. The place you type\n * should not move. A spacer costs nothing once the transcript is full, because by then there is\n * no slack left for it to take.\n */}\n <Box flexGrow={1} />\n\n {state.live === undefined ? null : (\n <Live live={state.live} showReasoning={showReasoning} columns={columns} />\n )}\n {palette === undefined ? null : (\n <Palette\n palette={palette}\n index={paletteIndex}\n width={columns}\n maxRows={listRows}\n />\n )}\n <HistorySearch editor={editor} width={columns} maxRows={listRows} />\n {/*\n * Rendered once, in the one frame, which is the fix rather than a feature: this lived only in the\n * transcript layout, so `/exit` typed on the landing screen asked for a confirmation nobody could\n * see — the session simply appeared to ignore the command until a second keystroke ended it.\n */}\n {confirming ? (\n <Text color={THEME.warning} wrap=\"truncate\">\n {\" leave this session? press y to confirm · any other key stays\"}\n </Text>\n ) : null}\n <Prompt\n editor={editor}\n busy={busy}\n columns={columns}\n {...(landing ? { placeholder: \"Ask anything…\" } : {})}\n />\n {/*\n * The keys worth knowing before there is a conversation to learn them from. It stands down once\n * one exists: the status line already carries `^C`, and a permanent hint is a row of conversation.\n */}\n {landing ? (\n <Text dimColor wrap=\"truncate\">\n {\" \"}\n {NEW_SESSION_HINT}\n </Text>\n ) : null}\n {/* The status line is the footer, under the input — where every reference CLI puts\n it, and where the eye rests between keystrokes. */}\n <StatusBar\n status={state.status}\n model={model}\n sessionKey={sessionKey}\n elapsedMs={elapsed}\n last={last}\n quiet={quiet}\n armed={armed}\n {...(state.pressure === undefined ? {} : { pressure: state.pressure })}\n {...(state.phase === undefined ? {} : { phase: state.phase })}\n />\n </Box>\n )\n}\n",
5
+ "/**\n * The chat surface — a full-screen session on the alternate buffer.\n *\n * Thin on purpose. Everything worth testing lives in pure modules — `keymap.ts` decides what a keystroke\n * means, `editor.ts` applies it to the line, `transcript.ts` turns bus events into rows, `lib/scroll.ts`\n * moves the window, `lib/chat-frame.ts` decides how many rows each part of the frame may have — so this\n * file is composition plus the decisions that need Ink itself: when to unmount, what to do about a\n * submission arriving mid-turn, and which surface currently owns the keyboard.\n *\n * ## What Phase 5.5 changed here\n *\n * The conversation is no longer in `<Static>`. It is a buffer of rows with a window over it, because\n * `<Static>` writes to the scrollback and the alternate screen discards its buffer on the way out — the\n * two cannot both be true. That has two consequences worth stating before editing:\n *\n * - **The frame has a hard height.** Everything visible must add up to at most the terminal's rows, or\n * Ink's own output scrolls the buffer and the layout comes apart. `chatFrame` owns that arithmetic; no\n * row count is invented in this file.\n * - **^C at an idle prompt takes two presses.** With the buffer discarded on exit, a single reflexive ^C\n * during a long reply would throw the visible conversation away. `keymap.ts` owns the decision; the\n * timer that expires it lives here, because a pure function cannot hold a clock.\n *\n * The Ctrl-C contract from Phase 1 is otherwise unchanged: during a turn it cancels the turn and the\n * prompt comes back.\n */\n\nimport { BRAND, VERSION } from \"@dispach/core\"\nimport { Box, Text, useApp, useInput } from \"ink\"\nimport { type ComponentType, useCallback, useEffect, useMemo, useRef, useState } from \"react\"\nimport { BRAND_INDENT, Brandmark } from \"#components/Brandmark\"\nimport { CommandOutput } from \"#components/CommandOutput\"\nimport type { ConfigEditorProps } from \"#components/ConfigEditor\"\nimport { HistorySearch } from \"#components/HistorySearch\"\nimport { Live } from \"#components/Live\"\nimport { Palette } from \"#components/Palette\"\nimport { Prompt } from \"#components/Prompt\"\nimport type { SessionPickerProps } from \"#components/SessionPicker\"\nimport type { SkillBrowserProps } from \"#components/SkillBrowser\"\nimport { Spinner } from \"#components/Spinner\"\nimport { StatusBar } from \"#components/StatusBar\"\nimport { Transcript } from \"#components/Transcript\"\nimport { applyIntent, EMPTY_EDITOR, selectionRange, submit } from \"#editor\"\nimport { useElapsed } from \"#hooks/useElapsed\"\nimport { useTerminalSize } from \"#hooks/useTerminalSize\"\nimport { useTurn } from \"#hooks/useTurn\"\nimport { keyContext, keyToIntent } from \"#keymap\"\nimport { chatFrame, composerHit, transcriptHit, transcriptRowsAfterBrand } from \"#lib/chat-frame\"\nimport { copyToClipboard } from \"#lib/clipboard\"\nimport type { EditorRow } from \"#lib/config-editor\"\nimport { applyEditorRow, editorRowsFor } from \"#lib/config-rows\"\nimport {\n EXIT_ARM_MS,\n FALLBACK_COLUMNS,\n LANDING_LIST_ROWS,\n MULTI_CLICK_MS,\n SEARCH_ROWS,\n SESSION_PICKER_ROWS,\n} from \"#lib/const\"\nimport { offeredCommands, paletteEntries, paletteFor, paletteSelection } from \"#lib/palette\"\nimport type { AppProps } from \"#lib/schema\"\nimport { screenColumns, titleLine } from \"#lib/screen\"\nimport { FOLLOWING, scroll, slice } from \"#lib/scroll\"\nimport {\n NEW_SESSION_HINT,\n resolveSessionCommand,\n sessionHelpText,\n type ToolsView,\n toolsReport,\n unknownCommandText,\n} from \"#lib/session-commands\"\nimport type { SessionRowSource } from \"#lib/sessions-view\"\nimport { runSubcommand } from \"#lib/subcommand\"\nimport {\n beginSelection,\n dragSelection,\n endSelection,\n extendSelection,\n lineAt,\n selectedText,\n type TextPoint,\n type TextSelection,\n wordAt,\n} from \"#lib/text-selection\"\nimport { THEME } from \"#lib/theme\"\nimport { wordmark } from \"#lib/wordmark\"\nimport { lastStats, transcriptRows } from \"#transcript\"\n\n/**\n * What is layered over the conversation.\n *\n * `output` is a command's captured text; `skills` is the one bespoke view a session hosts so far. Both\n * take the keyboard while open and both *replace* the transcript rather than sitting under it — sharing\n * the screen pushed the conversation off the top of a full-screen frame, which on a surface with no\n * scrollback means gone. Closing either returns to the prompt with the draft untouched, which is what\n * makes a pane an interlude rather than a detour.\n */\ntype Pane =\n | { readonly kind: \"none\" }\n | {\n readonly kind: \"output\"\n readonly label: string\n readonly lines: readonly string[] | undefined\n readonly code?: number\n readonly offset: number\n }\n | { readonly kind: \"skills\" }\n /**\n * The conversation switcher. `undefined` while the store is being read.\n *\n * Loaded when the pane opens rather than kept current, because the list changes only when a turn ends\n * and re-reading it on every frame would put a database query in the render path.\n */\n | { readonly kind: \"sessions\"; readonly stored: readonly SessionRowSource[] | undefined }\n /**\n * The settings editor. `rows` is read when the pane opens, not kept current.\n *\n * Read once because the editor re-reads after each write of its own — keeping it live here would put\n * a file read in the render path for a surface that already knows when it has changed something.\n */\n | { readonly kind: \"config\"; readonly rows: readonly EditorRow[] }\n\nexport function App({\n source,\n sessionKey,\n model,\n agentName,\n warnings,\n freshSession,\n initial,\n correctKeys,\n showReasoning,\n quiet,\n onRestart,\n onSwitch,\n onNew,\n sessions,\n initialDraft,\n manifestPath,\n catalogue,\n status,\n contextView,\n}: AppProps) {\n const { exit } = useApp()\n const size = useTerminalSize()\n const columns = screenColumns(size.columns, FALLBACK_COLUMNS)\n const { state, busy, send, cancel, note, trim } = useTurn({ source, sessionKey, initial })\n // A draft handed in by a `/restart` opens the prompt with the cursor at its end, which is where the\n // person left it. Only the initial value — a later prop change must not overwrite what is being\n // typed now, which is exactly what `useState`'s initialiser semantics give for free.\n const [editor, setEditor] = useState(() =>\n initialDraft === undefined || initialDraft === \"\"\n ? EMPTY_EDITOR\n : { ...EMPTY_EDITOR, value: initialDraft, cursor: [...initialDraft].length },\n )\n\n /**\n * What is on top of the conversation, if anything.\n *\n * A pane is *focused* while it is open, so the prompt's `useInput` stands down — Ink fires every\n * active hook, and two surfaces reading one keystroke is the bug the focus rule exists to prevent.\n */\n const [pane, setPane] = useState<Pane>({ kind: \"none\" })\n /**\n * The skills view's implementation, loaded when it is first opened.\n *\n * Dynamically, and that is not an optimisation. `browse.ts` also imports this component dynamically,\n * and bun's `--splitting` emits a module's exports **twice** when one importer is static and another is\n * dynamic — producing a bundle that dies at parse time with `Duplicate export of 'SkillBrowser'`, which\n * no test that imports source can see. The props come in as a type, which is erased and creates no\n * edge. `boundaries.test.ts` bans the mixing outright.\n */\n const [Browser, setBrowser] = useState<ComponentType<SkillBrowserProps> | undefined>(undefined)\n /**\n * The session switcher's implementation, loaded when the pane first opens.\n *\n * Dynamically for the same reason `Browser` is, and it was caught by the boundaries test rather than\n * remembered: `run.ts` mounts this component too, for a bare `--session` before any chat exists. One\n * static importer and one dynamic one makes bun's `--splitting` emit its exports **twice**, and the\n * built binary then dies at parse time with `Duplicate export of 'SessionPicker'` while every test —\n * which imports source — passes. Both edges dynamic, no duplicate.\n */\n const [Editor, setEditor_] = useState<ComponentType<ConfigEditorProps> | undefined>(undefined)\n const [Sessions, setSessions] = useState<ComponentType<SessionPickerProps> | undefined>(\n undefined,\n )\n /** Where the conversation window sits. Starts and returns to following the newest row. */\n const [view, setView] = useState(FOLLOWING)\n /** A first ^C has landed. Expires, which is why it is here and not in the keymap. */\n const [armed, setArmed] = useState(false)\n /** `/exit` asked; the next keystroke answers. `undefined` means nothing is being confirmed. */\n const [confirming, setConfirming] = useState(false)\n /**\n * Reasoning shown whole rather than folded to a count. Session-wide, and `⌥r` toggles it.\n *\n * Folded is the default because a real turn produced a twenty-three-row block for a one-sentence\n * answer, which filled the terminal and left the reply itself somewhere above the fold.\n */\n const [expandReasoning, setExpandReasoning] = useState(false)\n /**\n * The mouse selection over the transcript, in buffer coordinates.\n *\n * Cleared by eviction below rather than re-keyed: rows are addressed by position, so dropping any from\n * the front shifts every index — a selection kept across a trim would silently start covering different\n * text, which is the \"looks live and is not\" failure `pinned` exists to prevent. There is also nothing\n * to copy from rows that no longer exist.\n */\n const [selection, setSelection] = useState<TextSelection | undefined>(undefined)\n /**\n * The previous press, for counting clicks.\n *\n * A ref rather than state: nothing renders from it, and putting it in state would redraw the whole tree\n * on every press. Multi-click has to be inferred from time and position because a terminal reports\n * three presses and never a \"double click\" — the same reason the reference CLI keeps its own window.\n */\n const lastPress = useRef<{ at: TextPoint; when: number; clicks: number } | undefined>(undefined)\n // Derived from the buffer rather than stored, so the only palette state is where the cursor is.\n const palette = pane.kind === \"none\" ? paletteFor(editor.value) : undefined\n const [paletteIndex, setPaletteIndex] = useState(0)\n\n const elapsed = useElapsed(busy)\n const last = useMemo(() => lastStats(state.items), [state.items])\n\n /**\n * The conversation, wrapped to the width and flattened to rows.\n *\n * Memoised on the three things it depends on. Without that it would re-flatten and re-wrap the whole\n * history on every streamed token, which is the cost `<Static>` used to remove for free.\n */\n const rows = useMemo(\n () => transcriptRows(state.items, { showReasoning, quiet, columns, expandReasoning }),\n [state.items, showReasoning, quiet, columns, expandReasoning],\n )\n\n /**\n * The landing state: a new conversation with nothing sent into it yet.\n *\n * It is a *state of the one frame*, not a screen of its own, and that is the whole design. As a separate\n * screen it was swapped out the moment anything reached the transcript — which `/help`, `/tools` and\n * `/restart` all do — so the landing screen \"disappeared\" for almost every command. And anything added to\n * the other layout was silently missing from it: the palette drew nothing there for a day, and `/exit`'s\n * \"press y\" prompt was invisible, because both live in the layout that was not on screen. One frame\n * removes that class of bug rather than fixing instances of it.\n *\n * `freshSession` is the host's answer to \"is this conversation new\". It used to be load-bearing for a\n * second reason — the chat did not render stored messages, so an empty transcript was equally true of a\n * resumed session — and that is no longer the case: `seedHistory` paints the conversation, so the `user`\n * clause below is now true on its own for anything resumed. Both are kept because they answer different\n * questions, and the remaining job of `freshSession` is the genuinely new session, where there is no\n * history for the second clause to find. The second half is what the owner chose: slash commands, notes\n * and the banner all keep the brand mark, because they are setup rather than conversation. It goes when\n * you actually start talking, and does not come back.\n */\n const landing = freshSession === true && !state.items.some((item) => item.role === \"user\")\n\n // A longer list while landing: there is no conversation to hide behind it, and the screen somebody opens\n // before they know the commands should show all of them rather than six and a counter.\n const listRows = landing ? LANDING_LIST_ROWS : SEARCH_ROWS\n const frame = chatFrame({\n rows: size.rows,\n columns,\n editor,\n live: state.live,\n showReasoning,\n palette,\n paletteMaxRows: listRows,\n searchMaxRows: listRows,\n confirming,\n landing,\n hint: landing,\n })\n /**\n * The brand mark, rendered here so the conversation is charged what it actually draws.\n *\n * `frame.brand` is an allowance and `wordmark` usually takes far less of it — charging the allowance\n * wasted eleven rows on a thirty-row terminal, and the banner ended up scrolled to a mid-wrap fragment of\n * a store path with a third of the screen blank. Computed once and handed to `Brandmark` as lines, so\n * there is no second derivation that could disagree about how tall the frame is.\n */\n const mark =\n frame.brand > 0\n ? wordmark(BRAND.name, { columns: columns - BRAND_INDENT, rows: frame.brand })\n : undefined\n const window = slice(\n view,\n rows.length,\n transcriptRowsAfterBrand(frame, mark?.lines.length ?? 0),\n )\n\n /**\n * Bound the transcript, but only while following the tail.\n *\n * Every item is re-derived and re-wrapped on each frame now that the conversation is a windowed buffer\n * rather than `<Static>` output, so an unbounded one is unbounded work per keystroke. The gate is the\n * point: rows are addressed by position, so dropping any from the front shifts every offset below\n * them — evicting while somebody is parked twelve turns back would leave their offset untouched and\n * the text under it different, which is a session that looks live and is not. Deferring costs nothing,\n * because `esc` returns to the tail and the next append trims then.\n *\n * Called on every change with no check of its own: a buffer under the cap reduces to identical state,\n * so React bails out of the render.\n */\n // `state.items.length` below is a *trigger*, not a read: the body never looks at it, and it is there\n // so a growing conversation re-runs the check. The lint rule offers to remove it, and taking that\n // offer would leave the cap enforced once at mount and never again — a fix that lints clean and does\n // nothing, which is why the suppression carries a reason rather than the dependency being dropped.\n // biome-ignore lint/correctness/useExhaustiveDependencies: a deliberate trigger dependency; see above\n useEffect(() => {\n if (!view.pinned) return\n // Eviction shifts every row index, so a selection made before a trim would afterwards cover\n // different text — the same hazard `pinned` exists for, applied to a highlight. Cleared rather\n // than re-keyed: there is nothing to copy from rows that are gone, and a highlight that quietly\n // slid onto another reply is worse than one that disappeared.\n setSelection(undefined)\n trim()\n }, [view.pinned, state.items.length, trim])\n\n // The armed ^C expires on its own. A prompt that stayed armed indefinitely would turn a ^C pressed\n // minutes ago into the reason a later one ended the session.\n useEffect(() => {\n if (!armed) return\n const timer = setTimeout(() => setArmed(false), EXIT_ARM_MS)\n return () => clearTimeout(timer)\n }, [armed])\n\n /**\n * A submitted line: a slash command, or a message for the model.\n *\n * `draft` is what is *left in the buffer* afterwards, and it has to be passed in rather than read from\n * `editor` here. This closure captures the editor as it was when the frame rendered — before the submit\n * cleared it — so reading `editor.value` returned the command that was just consumed. `/restart` then\n * carried `/restart` across as the draft, which re-opened the palette on top of the new banner: the\n * screen came back identical to before enter was pressed, with the message hidden behind the list, and\n * the restart looked like it had done nothing at all.\n *\n * For a typed command the residual is always empty — `COMMAND_SHAPE` matches the whole trimmed line, so\n * a command cannot share the buffer with a draft. It stays a parameter because a restart offered by a\n * *pane* could, and that is what the carry-across exists for.\n */\n const onSubmit = (text: string, draft: string): void => {\n // Both renderers dispatch through the same table, so `--plain` and the rich path cannot\n // answer the same typed command differently.\n // `offered` is what turns a typed `/config get x` into a command rather than a message. Without\n // it the list defaults to empty, so **no** CLI command resolved when typed with arguments: the\n // palette ran them and typing the same thing sent it to the model as prose, which then answered\n // about it. Selecting `/config` from the list worked, and typing `/config get model.main.id` cost\n // a turn — the same command, two answers, which is exactly what `resolveSessionCommand` living in\n // one place is supposed to prevent.\n const command = resolveSessionCommand(text, offeredCommands())\n if (command !== undefined) {\n switch (command.kind) {\n case \"exit\":\n // Asked, not done. `/exit` is typed deliberately, but so is every other slash command,\n // and the one that discards the visible conversation is worth one keystroke of\n // confirmation on a surface where leaving takes the screen with it.\n setConfirming(true)\n return\n case \"restart\": {\n // The settings an agent booted with are fixed for its lifetime, so a\n // configuration change needs a new one. Nothing is lost either way: the\n // conversation lives in the store and the same session key resumes it.\n //\n // **Attached, the screen does not come down.** The host owns the agent, so this\n // is a request to replace it — and there is nothing in this process to rebuild,\n // so tearing the frame down would be a teardown for its own sake. Embedded,\n // `onRestart` unmounts and the loop builds a new runtime; the unsent draft\n // rides across, because throwing away a half-written message is a second,\n // unasked-for consequence of asking for the first.\n const reload = source.reload\n if (reload === undefined) {\n onRestart?.(draft)\n exit()\n return\n }\n note(\"asking the host to reload this agent…\")\n reload()\n .then((adopted: readonly string[]) =>\n note(\n // Named rather than counted: replacing a supervisor replaces its\n // team, and \"3 agents reloaded\" would leave somebody guessing which.\n `reloaded ${adopted.join(\", \")} — this conversation continues`,\n ),\n )\n .catch((error: unknown) =>\n note(\n `could not reload: ${error instanceof Error ? error.message : String(error)}`,\n ),\n )\n return\n }\n case \"new\":\n // The same unmount-and-reopen route `/restart` and `/sessions` take, for the same\n // reason: a transcript cannot be re-keyed in place. Nothing is destroyed — the\n // conversation being left keeps its key, and the next banner names it.\n onNew?.(draft)\n exit()\n return\n case \"help\":\n note(sessionHelpText())\n return\n case \"tools\":\n // Fire-and-report, like `/status` and `/context` beside it: a component cannot\n // block, so the note is the acknowledgement. Embedded this resolves off the\n // live registry with no await worth mentioning; attached it is a request, and\n // the two must not read differently to whoever typed it.\n source\n .tools()\n .then((view: ToolsView) => note(toolsReport(view)))\n .catch((error: unknown) =>\n note(\n `could not read the tools: ${error instanceof Error ? error.message : String(error)}`,\n ),\n )\n return\n case \"context\":\n // Same shape as `status` below: a component cannot block, so the note is the\n // acknowledgement. Absent means the surface is not offered rather than accepted\n // and silently billed to the model, which is what `/status` did for three phases.\n if (contextView === undefined) {\n note(\"context is unavailable in this session\")\n return\n }\n contextView()\n .then(note)\n .catch((error: unknown) =>\n note(\n `could not read the context: ${error instanceof Error ? error.message : String(error)}`,\n ),\n )\n return\n case \"status\":\n // Declared in `SESSION_COMMANDS`, advertised in `/help` and generated into the\n // palette — and unhandled here, so it fell out of this switch and was sent to the\n // model as prose. Not a type error: the union's first member is\n // `{kind: SessionCommandKind}` and this switch has no exhaustiveness guard, which\n // is why `boundaries.test.ts` now walks every kind. Seventh instance in this repo\n // of every layer being right and one not being connected.\n //\n // Awaited through `.then` rather than inline: a component cannot block, and the\n // note *is* the acknowledgement — the same shape `reset` below uses.\n if (status === undefined) {\n note(\"status is unavailable in this session\")\n return\n }\n status()\n .then(note)\n .catch((error: unknown) =>\n note(\n `could not read the status: ${error instanceof Error ? error.message : String(error)}`,\n ),\n )\n return\n case \"reset\":\n // Fire-and-report rather than awaited: a component cannot block, and the note is\n // the acknowledgement. A failure surfaces as a rejected promise, so it is caught.\n source\n .clearSession(sessionKey)\n .then(() => note(\"session cleared — memory files on disk are untouched\"))\n .catch((error: unknown) =>\n note(\n `could not clear the session: ${error instanceof Error ? error.message : String(error)}`,\n ),\n )\n return\n case \"command\":\n // Through `dispatch`, which is the palette's path too — its own comment says it is\n // shared \"so the two cannot diverge\", and until now only one of the two reached it.\n if (dispatch(`/${command.name}`, command.rest)) return\n note(unknownCommandText({ word: `/${command.name}` }))\n return\n case \"unknown\":\n note(unknownCommandText(command))\n return\n }\n }\n if (busy) {\n // Two turns on one session would interleave in the history the next turn is conditioned\n // on. Refusing is honest; queueing silently would make the reply order unpredictable.\n note(\"a turn is still running — ^C cancels it, then send again\")\n return\n }\n send(text)\n }\n\n /**\n * Run a command and show what it printed.\n *\n * The pane opens *before* the command starts, with a spinner, for the same reason the skills browser\n * mounts before it fetches: a command that takes a second with nothing on screen is indistinguishable\n * from a keystroke that did nothing.\n */\n const openCommand = useCallback(\n (name: string, rest: string) => {\n setPane({ kind: \"output\", label: `/${name}`, lines: undefined, offset: 0 })\n void runSubcommand({ name, rest, manifestPath: manifestPath ?? \"\" })\n .then((result) =>\n setPane({\n kind: \"output\",\n label: `/${name}`,\n lines: result.lines,\n code: result.code,\n offset: 0,\n }),\n )\n .catch((error: unknown) =>\n setPane({\n kind: \"output\",\n label: `/${name}`,\n lines: [error instanceof Error ? error.message : String(error)],\n code: 1,\n offset: 0,\n }),\n )\n },\n [manifestPath],\n )\n\n /** A slash command, from the palette or from a typed line. Shared so the two cannot diverge. */\n const dispatch = useCallback(\n (word: string, rest: string) => {\n const entry = paletteEntries().find((candidate) => candidate.word === word)\n if (entry === undefined) return false\n if (entry.kind === \"view\") {\n if (\n entry.word === \"/sessions\" &&\n sessions !== undefined &&\n onSwitch !== undefined\n ) {\n // Opened before the read finishes, with the spinner the pane draws for an undefined\n // list — the same reason the catalogue mounts before it fetches: a keystroke followed\n // by nothing is indistinguishable from a keystroke that did nothing.\n setPane({ kind: \"sessions\", stored: undefined })\n void import(\"#components/SessionPicker\").then((module) =>\n // Wrapped in a function, or `useState` would call the component as an updater.\n setSessions(() => module.SessionPicker),\n )\n void sessions()\n .then((stored) => setPane({ kind: \"sessions\", stored }))\n .catch((error: unknown) => {\n setPane({ kind: \"none\" })\n note(\n `could not read the stored conversations: ${error instanceof Error ? error.message : String(error)}`,\n )\n })\n return true\n }\n if (entry.word === \"/config\" && (rest.trim() === \"\" || rest.trim() === \"edit\")) {\n // Bare `/config` is the editor; `/config list` and the rest are still the plain\n // command in an output pane, which the fallthrough below handles.\n if (manifestPath === undefined) {\n note(\"this session has no manifest path, so there is nothing to edit\")\n return true\n }\n setPane({ kind: \"config\", rows: editorRowsFor(manifestPath) })\n void import(\"#components/ConfigEditor\").then((module) =>\n // Wrapped in a function, or `useState` would call the component as an updater.\n setEditor_(() => module.ConfigEditor),\n )\n return true\n }\n if (entry.word === \"/skills\" && catalogue !== undefined) {\n setPane({ kind: \"skills\" })\n void import(\"#components/SkillBrowser\").then((module) =>\n // Wrapped in a function, or `useState` would call the component as an updater.\n setBrowser(() => module.SkillBrowser),\n )\n return true\n }\n // A view named in the table with nothing built yet falls back to its own output, which is\n // still the command doing its job — better than a palette entry that does nothing.\n openCommand(entry.word.slice(1), rest)\n return true\n }\n if (entry.kind === \"output\") {\n openCommand(entry.word.slice(1), rest)\n return true\n }\n return false\n },\n // `manifestPath` is read by the `/config` branch. A prop that does not change in practice, and\n // listing it is what stops a later change from being captured stale — the same reason the rule\n // exists rather than a suppression here.\n [openCommand, catalogue, sessions, onSwitch, note, manifestPath],\n )\n\n // ── the pane has the keyboard while it is open ────────────────────────────────────────\n useInput(\n (input, key) => {\n if (pane.kind !== \"output\") return\n if (key.escape || input === \"q\") {\n setPane({ kind: \"none\" })\n return\n }\n const total = pane.lines?.length ?? 0\n const step = key.pageDown || key.pageUp ? frame.pane : 1\n const delta =\n key.downArrow || key.pageDown ? step : key.upArrow || key.pageUp ? -step : 0\n if (delta !== 0) {\n setPane({\n ...pane,\n offset: Math.max(0, Math.min(pane.offset + delta, Math.max(0, total - 1))),\n })\n }\n },\n { isActive: pane.kind === \"output\" },\n )\n\n useInput(\n (input, reported) => {\n // Modifiers off the wire where they can be had, before anything reads one.\n //\n // Ink folds the super bit into `meta` on its legacy path (`modifier & 10`), so `cmd+←` and\n // `⌥←` arrive as the same keystroke and both word-move — measured in a real Warp session.\n // First line of the handler rather than beside `keyToIntent`, because the palette branch below\n // reads `key.escape` and `key.upArrow` too, and a correction applied after it would be one\n // that two of the three branches never got.\n const key = correctKeys === undefined ? reported : correctKeys(reported, input)\n\n // A pending confirmation owns the keyboard for exactly one keystroke. Anything other than a\n // yes is a no — including a stray arrow, because the safe answer to an unclear one is to stay.\n if (confirming) {\n setConfirming(false)\n if (input.toLowerCase() === \"y\" || key.return) exit()\n return\n }\n\n // The palette owns the keys it needs while it is open, and hands everything else to the editor —\n // so typing continues to narrow the list rather than being swallowed by it.\n if (palette !== undefined) {\n if (key.escape) {\n setEditor((current) => applyIntent(current, { kind: \"killToStart\" }))\n setPaletteIndex(0)\n return\n }\n if (key.upArrow || key.downArrow) {\n setPaletteIndex((at) =>\n Math.max(\n 0,\n Math.min(at + (key.downArrow ? 1 : -1), palette.matches.length - 1),\n ),\n )\n return\n }\n if (key.tab) {\n const chosen = paletteSelection(palette, paletteIndex)\n if (chosen !== undefined) {\n setEditor((current) =>\n applyIntent(\n { ...current, value: \"\", cursor: 0 },\n {\n kind: \"insert\",\n text: chosen.word,\n },\n ),\n )\n }\n return\n }\n const selected = paletteSelection(palette, paletteIndex)\n // Only intercepted when something is selected. With no match, enter falls through to the\n // ordinary submit path, which reports `/skils is not a command` and suggests the nearest\n // one — swallowing it here made a mistyped command do nothing at all, which is worse.\n if (key.return && selected !== undefined) {\n const chosen = selected\n setPaletteIndex(0)\n setEditor((current) => ({ ...current, value: \"\", cursor: 0 }))\n // A session verb goes through the same submit path a typed line takes, so `/help` and\n // `/reset` behave identically whether they were completed or typed out.\n // The buffer was cleared in the same handler, so nothing is left behind.\n if (chosen.kind === \"session\") onSubmit(chosen.word, \"\")\n else dispatch(chosen.word, \"\")\n return\n }\n }\n\n const intent = keyToIntent(\n input,\n key,\n keyContext(editor, busy, { armed, scrolled: !view.pinned }),\n )\n\n // Any keystroke that is not the second ^C disarms. Without this the warning would stay true\n // while somebody typed a whole message, and the ^C they pressed at the end of it — meaning\n // \"cancel that\" — would end the session instead.\n if (armed && intent.kind !== \"exit\") setArmed(false)\n\n if (intent.kind === \"arm\") {\n setArmed(true)\n return\n }\n if (intent.kind === \"scroll\") {\n // `times` is the wheel: one chunk can carry several notches, and applying one of them makes\n // a flick of the wheel move a single row. Folded rather than given its own move, so the\n // clamping at both ends stays in one function.\n const times = Math.max(1, intent.times ?? 1)\n setView((current) => {\n let next = current\n for (let step = 0; step < times; step += 1) {\n next = scroll(next, intent.move, rows.length, frame.transcript)\n }\n return next\n })\n return\n }\n if (intent.kind === \"pointer\") {\n // Screen cell to buffer row, through the one function that owns the frame's vertical\n // arithmetic. `undefined` means the cell was chrome — the header, the composer, the status\n // line — and a click there clears the selection rather than selecting the nearest row,\n // because clamping would make clicking the status bar highlight the last reply.\n const hit = transcriptHit(\n { column: intent.column, row: intent.row },\n { brandLines: mark?.lines.length ?? 0, from: window.from, to: window.to },\n )\n if (hit === undefined) {\n // Not the transcript — try the composer. Selecting your own draft with the mouse is\n // the same gesture and a different target, so it is the same branch rather than a\n // second handler that would have to re-derive which cell belongs to whom.\n const offset = composerHit(\n { column: intent.column, row: intent.row },\n { editor, columns, rows: size.rows, hint: landing },\n )\n if (offset === undefined) {\n // Genuine chrome. A press clears both selections rather than clamping to whatever\n // is nearest, because a click on the status line that highlighted the last reply\n // would look deliberate.\n if (intent.gesture === \"press\") {\n setSelection(undefined)\n setEditor((current) => ({ ...current, anchor: undefined }))\n }\n return\n }\n setSelection(undefined)\n setEditor((current) =>\n intent.gesture === \"press\" && !intent.shift\n ? // A press places the caret and starts a possible selection from it; the\n // anchor is set now so the first drag report has something to extend from.\n { ...current, cursor: offset, anchor: offset }\n : // A drag, or a shift-click, moves the cursor and keeps the anchor — which is\n // exactly what `extend` does for a shifted motion, expressed directly\n // because there is no motion here, only a destination.\n {\n ...current,\n cursor: offset,\n anchor: current.anchor ?? current.cursor,\n },\n )\n return\n }\n if (intent.gesture === \"press\") {\n // Shift extends whatever is already there, which is the gesture for correcting a\n // selection that stopped a word short. Checked before the click count, because a\n // shift-click is a deliberate second gesture rather than a fast repeat of the first.\n if (intent.shift && selection !== undefined) {\n setSelection(extendSelection(selection, hit))\n lastPress.current = undefined\n return\n }\n const previous = lastPress.current\n const repeat =\n previous !== undefined &&\n Date.now() - previous.when <= MULTI_CLICK_MS &&\n previous.at.row === hit.row &&\n previous.at.column === hit.column\n // Third click wraps back to one, so a fourth starts a fresh drag rather than doing\n // nothing — a count that only grew would leave rapid clicking permanently stuck on\n // \"line\".\n const clicks = repeat ? (previous.clicks % 3) + 1 : 1\n lastPress.current = { at: hit, when: Date.now(), clicks }\n // One selection at a time. Two visible highlights with one clipboard between them is\n // a screen that cannot say what ⌘C would copy.\n setEditor((current) => ({ ...current, anchor: undefined }))\n setSelection(\n clicks === 3\n ? lineAt(rows, hit)\n : clicks === 2\n ? wordAt(rows, hit)\n : beginSelection(hit),\n )\n return\n }\n if (intent.gesture === \"drag\") {\n setSelection((current) =>\n current === undefined ? undefined : dragSelection(current, hit),\n )\n return\n }\n // Release. The clipboard is written here and nowhere else, because `cmd+c` cannot reach a\n // terminal app — the terminal claims it and finds no native selection, mouse tracking\n // having disabled the one it would have used. Copying on mouse-up is what makes `cmd+v`\n // work, and a copy that failed says so rather than leaving the previous clipboard in place\n // looking like the wrong text was selected.\n // Derived from *this* report rather than from the state in the closure. A release carries\n // its own final position, and `selection` here is whatever the last render saw — which on\n // a fast drag-and-release is one motion behind, so copying from it would drop the last few\n // characters somebody deliberately included.\n const finished =\n selection === undefined\n ? undefined\n : endSelection(dragSelection(selection, hit))\n setSelection(finished)\n const text = selectedText(rows, finished)\n if (text !== \"\") {\n void copyToClipboard(text).then((result) => {\n if (!result.copied && result.problem !== \"nothing selected\") {\n note(`could not copy: ${result.problem ?? \"unknown\"}`)\n }\n })\n }\n return\n }\n if (intent.kind === \"copySelection\" || intent.kind === \"cutSelection\") {\n const range = selectionRange(editor)\n if (range === undefined) {\n note(\"nothing selected — hold shift with a motion, or drag in the box\")\n return\n }\n const text = [...editor.value].slice(range.start, range.end).join(\"\")\n if (intent.kind === \"cutSelection\")\n setEditor((current) => applyIntent(current, intent))\n void copyToClipboard(text).then((result) => {\n if (!result.copied) note(`could not copy: ${result.problem ?? \"unknown\"}`)\n })\n return\n }\n if (intent.kind === \"reasoning\") {\n // A chord with nothing to act on has to say so.\n //\n // Reported as \"⌥r doesn't do anything\", and it was arriving and resolving correctly the\n // whole time: it toggles a fold, and a fold with nothing in it looks exactly like a dead\n // key. Two different reasons for that, and they need two different sentences — a model\n // that never streams reasoning is not the same as a turn that has not produced any yet,\n // and only the first is worth changing a flag over.\n // Visibility, not existence — and the order matters. `useTurn` appends a reasoning item\n // for every delta the model streams *regardless* of `showReasoning`, and `transcript.ts`\n // filters them out at render. So a session with reasoning hidden has items that cannot be\n // shown, and testing existence first fell through to a toggle whose rows were filtered\n // away: silently nothing, which is the failure this whole branch exists to prevent.\n if (!showReasoning) {\n note(\n \"reasoning is off: either this model does not stream it, or --no-reasoning is set\",\n )\n return\n }\n if (!state.items.some((item) => item.role === \"reasoning\")) {\n note(\"no reasoning to show yet — this expands it once a turn has streamed some\")\n return\n }\n // Unfolding changes how tall the conversation is, so the window has to be told to follow\n // the newest row again — leaving it parked would put the reader at a row that has moved.\n setExpandReasoning((current) => !current)\n setView(FOLLOWING)\n return\n }\n if (intent.kind === \"exit\") {\n exit()\n return\n }\n if (intent.kind === \"cancel\") {\n cancel()\n return\n }\n if (intent.kind === \"submit\") {\n const committed = submit(editor)\n setEditor(committed.state)\n // Sending is an implicit \"take me back to the newest row\": a reply arriving into a window\n // parked ten screens up would be generated where nobody can see it.\n setView(FOLLOWING)\n if (committed.text !== \"\") onSubmit(committed.text, committed.state.value)\n return\n }\n if (intent.kind === \"paste\") {\n // Inserted with its newlines intact, as one message.\n //\n // This used to submit every finished line in the chunk, and that was right when the buffer\n // could not hold a newline: the alternative then was silently running the words together.\n // Now that a message is composed rather than typed on one line, sending line-by-line is the\n // bug multi-line composition exists to remove — pasting a twelve-line code block produced\n // twelve messages, each conditioned on the last, and no way to edit any of them.\n setEditor((current) =>\n applyIntent(current, { kind: \"insert\", text: intent.lines.join(\"\\n\") }),\n )\n return\n }\n // The match list changes underneath the cursor on every keystroke, so keeping its position\n // would silently highlight a different entry than the one on screen — the same reason the\n // history search resets its index.\n if (palette !== undefined) setPaletteIndex(0)\n setEditor((current) => applyIntent(current, intent))\n },\n { isActive: pane.kind === \"none\" },\n )\n\n if (pane.kind === \"config\") {\n return (\n <Box flexDirection=\"column\" width={columns} height={size.rows}>\n <Text color={THEME.accent} bold wrap=\"truncate\">\n {titleLine({ title: `${BRAND.name} ${VERSION}`, summary: \"settings\" }, columns)}\n </Text>\n {Editor === undefined ? (\n <Box marginLeft={2}>\n <Spinner label=\"reading the settings\" />\n </Box>\n ) : (\n <Editor\n rows={pane.rows}\n apply={(row, raw) => applyEditorRow(manifestPath ?? \"\", row, raw)}\n reload={() => editorRowsFor(manifestPath ?? \"\")}\n columns={columns}\n window={SESSION_PICKER_ROWS}\n onDone={(changed) => {\n setPane({ kind: \"none\" })\n // An agent's settings are fixed for the lifetime of the process running it,\n // so a change that is not followed by a restart is a change that silently\n // did not apply — rule 8's shape. The draft rides across, for the reason\n // `/restart` carries it: throwing away a half-written message is a second,\n // unasked-for consequence of asking for the first.\n if (changed) {\n onRestart?.(editor.value)\n exit()\n }\n }}\n />\n )}\n {/*\n * The slack goes *below* a long list, not above it. Bottom-anchoring is right for the\n * conversation switcher — a dozen short rows that read as a menu — and wrong here: the\n * settings run past twenty rows, so a spacer above them started the list mid-screen with\n * eight blank rows over it and the rest running off the bottom.\n */}\n <Box flexGrow={1} />\n </Box>\n )\n }\n\n if (pane.kind === \"sessions\") {\n return (\n <Box flexDirection=\"column\" width={columns} height={size.rows}>\n <Text color={THEME.accent} bold wrap=\"truncate\">\n {titleLine(\n { title: `${BRAND.name} ${VERSION}`, summary: \"pick a conversation\" },\n columns,\n )}\n </Text>\n <Box flexGrow={1} />\n {pane.stored === undefined || Sessions === undefined ? (\n <Box marginLeft={2}>\n <Spinner label=\"reading the stored conversations\" />\n </Box>\n ) : (\n <Sessions\n sessions={pane.stored}\n now={Date.now()}\n columns={columns}\n maxRows={SESSION_PICKER_ROWS}\n current={sessionKey}\n onDone={(picked) => {\n if (picked === undefined || picked === sessionKey) {\n // Esc, or the one already open. Either way nothing is worth a rebuild.\n setPane({ kind: \"none\" })\n return\n }\n onSwitch?.(picked, editor.value)\n exit()\n }}\n />\n )}\n <Box flexGrow={1} />\n </Box>\n )\n }\n\n if (pane.kind === \"skills\" && catalogue !== undefined && Browser !== undefined) {\n return (\n <Browser\n title={`${BRAND.name} ${VERSION}`}\n agents={[]}\n target={manifestPath ?? \"\"}\n load={catalogue.load}\n install={catalogue.install}\n onDone={() => setPane({ kind: \"none\" })}\n />\n )\n }\n\n const header = titleLine(\n {\n title: `${BRAND.name} ${VERSION}`,\n summary: \"\",\n agent: { name: agentName, model },\n ...(warnings === undefined || warnings.length === 0 ? {} : { warnings }),\n },\n columns,\n )\n\n return (\n // Fixed height, because the alternate screen has no scrollback to absorb an overshoot: one row too\n // many and Ink's own output scrolls the buffer, which leaves the status line halfway up the display.\n <Box flexDirection=\"column\" width={columns} height={size.rows}>\n {/*\n * Above the one-line header, and only while landing. Nothing appears or disappears when it goes —\n * the line below it is the same line either way, which is what makes the collapse read as the same\n * screen with less on it rather than as a different screen.\n */}\n {mark === undefined ? null : (\n <>\n <Brandmark lines={mark.lines} />\n <Text> </Text>\n </>\n )}\n <Text color={THEME.accent} bold wrap=\"truncate\">\n {header}\n </Text>\n\n {pane.kind === \"output\" ? (\n <Box flexDirection=\"column\">\n <CommandOutput\n lines={pane.lines}\n label={pane.label}\n offset={pane.offset}\n maxRows={frame.pane}\n {...(pane.code === undefined ? {} : { code: pane.code })}\n />\n <Text dimColor wrap=\"truncate\">\n {\" \"}↑↓ scroll · esc back to the prompt\n </Text>\n </Box>\n ) : (\n <Transcript\n rows={rows}\n slice={window}\n {...(selection === undefined ? {} : { selection })}\n />\n )}\n\n {/*\n * Absorbs the slack, so the composer sits on the bottom edge of every frame.\n *\n * Unconditional, and that is the whole of decision 11.98's reversal. It used to stand down while\n * landing, on the grounds that twelve blank rows between the banner and the input read as a\n * half-empty screen — but a bottom-anchored input is where the eye already rests, so what those\n * rows read as is a prompt waiting. The reference CLI puts ~25 there and nobody reports it.\n *\n * The cost of the old arrangement was not the blank rows, it was that the composer *moved*: it\n * was drawn under whatever content existed, so it walked down the screen as the first few\n * messages arrived and only settled once the transcript filled the window. The place you type\n * should not move. A spacer costs nothing once the transcript is full, because by then there is\n * no slack left for it to take.\n */}\n <Box flexGrow={1} />\n\n {state.live === undefined ? null : (\n <Live live={state.live} showReasoning={showReasoning} columns={columns} />\n )}\n {palette === undefined ? null : (\n <Palette\n palette={palette}\n index={paletteIndex}\n width={columns}\n maxRows={frame.paletteRows}\n />\n )}\n <HistorySearch editor={editor} width={columns} maxRows={listRows} />\n {/*\n * Rendered once, in the one frame, which is the fix rather than a feature: this lived only in the\n * transcript layout, so `/exit` typed on the landing screen asked for a confirmation nobody could\n * see — the session simply appeared to ignore the command until a second keystroke ended it.\n */}\n {confirming ? (\n <Text color={THEME.warning} wrap=\"truncate\">\n {\" leave this session? press y to confirm · any other key stays\"}\n </Text>\n ) : null}\n <Prompt\n editor={editor}\n busy={busy}\n columns={columns}\n {...(landing ? { placeholder: \"Ask anything…\" } : {})}\n />\n {/*\n * The keys worth knowing before there is a conversation to learn them from. It stands down once\n * one exists: the status line already carries `^C`, and a permanent hint is a row of conversation.\n */}\n {landing ? (\n <Text dimColor wrap=\"truncate\">\n {\" \"}\n {NEW_SESSION_HINT}\n </Text>\n ) : null}\n {/* The status line is the footer, under the input — where every reference CLI puts\n it, and where the eye rests between keystrokes. */}\n <StatusBar\n status={state.status}\n model={model}\n sessionKey={sessionKey}\n elapsedMs={elapsed}\n last={last}\n quiet={quiet}\n armed={armed}\n {...(state.pressure === undefined ? {} : { pressure: state.pressure })}\n {...(state.phase === undefined ? {} : { phase: state.phase })}\n />\n </Box>\n )\n}\n",
6
6
  "/**\n * A command's output, in a scrollable pane inside the session.\n *\n * ## Why one pane rather than nine screens\n *\n * Every command in the table already produces good text — `keyValue` blocks, sections, the house\n * vocabulary in `lib/render.ts`. Nine bespoke screens for `/status`, `/policy`, `/config`, `/model` and\n * the rest would mostly reproduce those same tables in JSX, and several of them are read-only lists where\n * a generic pane and a hand-made one look identical.\n *\n * So this runs the command, captures what it printed, and shows it. That makes *every* non-hidden command\n * reachable from the palette the moment it exists, which is what \"all the CLI inside the TUI\" asks for,\n * and leaves a bespoke view as something a command earns by having a next action worth a keypress —\n * skills and sources have one, `/policy` does not.\n *\n * Controlled: the scroll offset lives in the screen root, and this owns no keyboard.\n */\n\nimport { Box, Text } from \"ink\"\nimport { Spinner } from \"#components/Spinner\"\nimport { viewport } from \"#lib/rows\"\nimport { GLYPH, THEME } from \"#lib/theme\"\n\nexport interface CommandOutputProps {\n /** `undefined` while it is still running. */\n readonly lines: readonly string[] | undefined\n readonly label: string\n /** First visible line. Clamped here, so a shrinking output cannot leave the view past its end. */\n readonly offset: number\n readonly maxRows: number\n /** Non-zero means the command reported a failure; shown, never hidden behind a clean-looking pane. */\n readonly code?: number\n}\n\nexport function CommandOutput({ lines, label, offset, maxRows, code }: CommandOutputProps) {\n if (lines === undefined) {\n return (\n <Box marginLeft={2}>\n <Spinner label={`running ${label}`} />\n </Box>\n )\n }\n\n if (lines.length === 0) {\n return (\n <Box marginLeft={2}>\n <Text color={THEME.muted}>{label} printed nothing</Text>\n </Box>\n )\n }\n\n // `viewport` centres on a cursor; here the cursor *is* the offset, so it is asked for the row at the\n // top of the window and clamped by the same arithmetic the lists use.\n const { from, to } = viewport(\n lines.length,\n Math.min(offset + Math.floor(maxRows / 2), lines.length - 1),\n maxRows,\n )\n\n const visible = lines.slice(from, to).map((text, at) => ({ row: from + at, text }))\n\n return (\n <Box flexDirection=\"column\">\n {code !== undefined && code !== 0 ? (\n <Text color={THEME.error} wrap=\"truncate\">\n {GLYPH.error}\n {label} exited {code}\n </Text>\n ) : null}\n {from > 0 ? (\n <Text dimColor wrap=\"truncate\">\n {\" \"}\n {GLYPH.ellipsis} {from} line{from === 1 ? \"\" : \"s\"} above\n </Text>\n ) : null}\n {visible.map((entry) => (\n // Keyed by the row's position in the whole output, computed before the map so the key is a\n // line number rather than a callback index. Position is the honest identity here: two\n // identical lines in a report are different lines, and a content key would collapse them.\n <Text key={entry.row} wrap=\"truncate\">\n {entry.text}\n </Text>\n ))}\n {to < lines.length ? (\n <Text dimColor wrap=\"truncate\">\n {\" \"}\n {GLYPH.ellipsis} {lines.length - to} line{lines.length - to === 1 ? \"\" : \"s\"}{\" \"}\n below\n </Text>\n ) : null}\n </Box>\n )\n}\n",
7
7
  "/**\n * `^R` — what you have already sent, filtered as you type, above the prompt.\n *\n * A list rather than bash's in-place `(reverse-i-search)` line, and deliberately the same shape the\n * slash palette uses: matches above the input, narrowing as you type, ↑↓ to pick, ⏎ to use, esc to\n * cancel. One interaction learned once and used by both — a shell shows a single match at a time\n * because a shell has one line to work with, which is not a constraint here.\n *\n * Controlled and presentational: the query, the match list and the selected index all come from\n * `editor.ts`, and this component owns no keyboard. The line being composed is untouched until a match\n * is accepted, so the search costs nothing to cancel — which is why the draft can stay on screen\n * underneath.\n */\n\nimport { Box, Text } from \"ink\"\nimport { searchMatches } from \"#editor\"\nimport { clip, viewport } from \"#lib/rows\"\nimport { GLYPH, THEME } from \"#lib/theme\"\nimport type { EditorState } from \"#lib/types\"\n\nexport interface HistorySearchProps {\n readonly editor: EditorState\n /** Terminal columns, so a long message is clipped rather than wrapped into the list. */\n readonly width: number\n /** Visible matches. The list scrolls inside this rather than pushing the prompt off the screen. */\n readonly maxRows: number\n}\n\nexport function HistorySearch({ editor, width, maxRows }: HistorySearchProps) {\n const search = editor.search\n if (search === undefined) return null\n\n const matches = searchMatches(editor)\n const index = Math.min(search.index, Math.max(0, matches.length - 1))\n const { from, to } = viewport(matches.length, index, maxRows)\n // Two for the gutter, and the query line needs room for its own label.\n const room = Math.max(8, width - 4)\n\n return (\n <Box flexDirection=\"column\">\n {matches.length === 0 ? (\n <Text color={THEME.muted} wrap=\"truncate\">\n {\" \"}\n nothing you have sent matches that\n </Text>\n ) : (\n matches.slice(from, to).map((entry, offset) => {\n const at = from + offset\n const selected = at === index\n return (\n // Keyed by the entry, which is unique: `searchMatches` deduplicates, so the same\n // question asked twice appears once.\n <Text key={entry} wrap=\"truncate\">\n <Text color={THEME.accent}>{selected ? GLYPH.pointer : \" \"}</Text>\n <Text bold={selected} dimColor={!selected}>\n {/* Newlines collapsed: a multi-line message has to read as one row here,\n the same rule the catalogue list follows. */}\n {clip(entry.replace(/\\s+/g, \" \"), room)}\n </Text>\n </Text>\n )\n })\n )}\n <Text wrap=\"truncate\">\n <Text color={THEME.muted}>{\" search: \"}</Text>\n {search.query}\n <Text inverse> </Text>\n {matches.length > 1 ? (\n <Text color={THEME.muted}>{` ${index + 1} of ${matches.length}`}</Text>\n ) : null}\n </Text>\n </Box>\n )\n}\n",
8
8
  "/**\n * The reply being generated — the only part of the conversation that redraws.\n *\n * Height-capped on purpose. Ink redraws this whole subtree per frame, so an uncapped pane means redrawing\n * the entire reply on every token: the cost grows with the length of the answer, precisely when the\n * terminal is busiest. `livePane` keeps the newest rows and drops the older ones, which is what the reader\n * is looking at anyway; the whole reply joins the transcript at `turn.end`, so nothing is lost — it just\n * arrives complete rather than in a redrawn window.\n *\n * It renders pre-wrapped rows rather than handing Ink a paragraph, for the reason `lib/wrap.ts` explains:\n * Ink breaks at spaces and a division does not, so a cap measured one way and drawn the other was always\n * a row or two short of the truth. The chat frame subtracts this pane's height from the terminal before it\n * renders, so being short by a row is a frame taller than the screen.\n */\n\nimport { Box, Text } from \"ink\"\nimport { LIVE_PANE_MAX_ROWS } from \"#lib/const\"\nimport type { LiveProps } from \"#lib/schema\"\nimport { livePane } from \"#lib/wrap\"\n\nexport function Live({ live, showReasoning, columns }: LiveProps) {\n const showing = showReasoning && live.reasoning !== \"\" && live.text === \"\"\n const text = showing ? live.reasoning : live.text\n if (text === \"\") return null\n\n // The reasoning label is a prefix on the first row, so the wrap has to account for its width or that\n // row is one longer than every other.\n const label = showing ? \"· reasoning · \" : \"\"\n const pane = livePane(text, columns - [...label].length, LIVE_PANE_MAX_ROWS)\n // Row numbers computed before the map, so the key is a position rather than a callback index. Position\n // is the honest identity here: two identical rows of a streamed reply are different rows, and a content\n // key would collapse them.\n const rows = pane.lines.map((text, at) => ({ at, text }))\n\n return (\n <Box flexDirection=\"column\">\n {pane.hidden > 0 ? (\n <Text dimColor wrap=\"truncate\">\n … {pane.hidden} earlier row(s) hidden while streaming\n </Text>\n ) : null}\n {rows.map((row) => (\n <Text key={`row-${row.at}`} dimColor={showing} wrap=\"truncate\">\n {row.at === 0 ? label : \"\"}\n {row.text}\n </Text>\n ))}\n </Box>\n )\n}\n",
@@ -14,12 +14,11 @@
14
14
  "/**\n * Selecting text in the transcript with the mouse.\n *\n * ## Buffer coordinates, and why that is the whole design\n *\n * The reference CLI keeps its selection in *screen* coordinates against a viewport-sized cell grid, and\n * roughly forty per cent of its state exists to survive that choice: two accumulators for rows that\n * scrolled out of the grid mid-drag, two parallel soft-wrap bitmaps to go with them, a pre-clamp anchor\n * row, and a function to capture rows before they are overwritten. All of it because the text is gone once\n * it leaves the viewport, so the selection has to hoard it.\n *\n * We never lose the text. The transcript is `readonly TranscriptRow[]` for the whole conversation with a\n * window over it, so a selection stored as `{row, column}` into *that* array needs none of those fields: it\n * is stable while the view scrolls, because scrolling only moves the window, and a copy is a substring of\n * data still in hand. Drag-to-scroll is then free rather than the hardest case.\n *\n * ## What it deliberately does not do\n *\n * Rectangular selection. Terminals select linearly — from a point, through every intervening row, to\n * another point — and a block selection is a different gesture with no way to ask for it here.\n */\n\nimport type { TranscriptRow } from \"#lib/types\"\n\n/** A position in the row buffer. `column` indexes code points of that row's `text`. */\nexport interface TextPoint {\n readonly row: number\n readonly column: number\n}\n\nexport interface TextSelection {\n /** Where the press happened. */\n readonly anchor: TextPoint\n /** Where the pointer is now. Equal to `anchor` until the first motion. */\n readonly focus: TextPoint\n /** True between press and release, which is what tells a finished selection from a live drag. */\n readonly dragging: boolean\n}\n\n/** Begin a selection at a point. Focus starts equal to anchor, so a bare click selects nothing. */\nexport function beginSelection(at: TextPoint): TextSelection {\n return { anchor: at, focus: at, dragging: true }\n}\n\n/** Move the focus. A no-op once the drag has finished, so a stray motion report cannot resurrect it. */\nexport function dragSelection(selection: TextSelection, to: TextPoint): TextSelection {\n if (!selection.dragging) return selection\n return { ...selection, focus: to }\n}\n\n/** Keep the range and stop tracking, so the highlight stays up and the text can be copied. */\nexport function endSelection(selection: TextSelection): TextSelection {\n return { ...selection, dragging: false }\n}\n\n/** Extend an existing selection to a point, as shift-click does. */\nexport function extendSelection(selection: TextSelection, to: TextPoint): TextSelection {\n return { ...selection, focus: to, dragging: false }\n}\n\nfunction before(left: TextPoint, right: TextPoint): boolean {\n return left.row < right.row || (left.row === right.row && left.column <= right.column)\n}\n\n/** The range in reading order, or `undefined` when nothing is selected. */\nexport function textBounds(\n selection: TextSelection | undefined,\n): { readonly start: TextPoint; readonly end: TextPoint } | undefined {\n if (selection === undefined) return undefined\n const { anchor, focus } = selection\n if (anchor.row === focus.row && anchor.column === focus.column) return undefined\n return before(anchor, focus) ? { start: anchor, end: focus } : { start: focus, end: anchor }\n}\n\n/**\n * Which columns of one row are selected, or `undefined` if none are.\n *\n * Clamped to the row's own length by the caller's `cells`, because a drag that runs off the end of a short\n * row must select to its end rather than to the pointer's column — which is what makes dragging down\n * through ragged text feel like one continuous sweep.\n */\nexport function rowSelection(\n selection: TextSelection | undefined,\n row: number,\n cells: number,\n): { readonly from: number; readonly to: number } | undefined {\n const bounds = textBounds(selection)\n if (bounds === undefined) return undefined\n if (row < bounds.start.row || row > bounds.end.row) return undefined\n const from = row === bounds.start.row ? Math.min(bounds.start.column, cells) : 0\n const to = row === bounds.end.row ? Math.min(bounds.end.column, cells) : cells\n return to <= from ? undefined : { from, to }\n}\n\n/**\n * The selected text, with wrapped rows rejoined into the lines they came from.\n *\n * A row's `continuation` flag is what makes this a copy of the *source* rather than of the layout: without\n * it, pasting a wrapped paragraph would carry the newlines this renderer invented. The role prefix is\n * dropped for the same reason — `› ` and ` · ` are chrome nobody typed.\n *\n * Trailing whitespace goes per logical line, not per row, so a break that consumed a space does not leave\n * one behind in the middle of a rejoined sentence.\n */\nexport function selectedText(\n rows: readonly TranscriptRow[],\n selection: TextSelection | undefined,\n): string {\n const bounds = textBounds(selection)\n if (bounds === undefined) return \"\"\n const lines: string[] = []\n for (let row = bounds.start.row; row <= bounds.end.row; row += 1) {\n const current = rows[row]\n if (current === undefined) continue\n const cells = [...current.text]\n const range = rowSelection(selection, row, cells.length)\n // A row with nothing selected still counts as a line break when it is inside the range: a blank\n // row between two turns is a blank line in what gets pasted.\n const text =\n range === undefined\n ? \"\"\n : cells.slice(Math.max(range.from, current.lead), range.to).join(\"\")\n if (current.continuation && lines.length > 0) {\n lines[lines.length - 1] += text\n continue\n }\n lines.push(text)\n }\n return lines.map((line) => line.replace(/\\s+$/, \"\")).join(\"\\n\")\n}\n\n/** Word characters, matching the composer's own idea of a word so a double-click agrees with `⌥←`. */\nfunction isWordChar(char: string | undefined): boolean {\n return char !== undefined && !/\\s/.test(char)\n}\n\n/** The word under a point, as a selection. Falls back to the whole row when the point is whitespace. */\nexport function wordAt(rows: readonly TranscriptRow[], at: TextPoint): TextSelection {\n const row = rows[at.row]\n if (row === undefined) return { anchor: at, focus: at, dragging: false }\n const cells = [...row.text]\n if (!isWordChar(cells[at.column])) return lineAt(rows, at)\n let from = at.column\n let to = at.column\n while (from > row.lead && isWordChar(cells[from - 1])) from -= 1\n while (to < cells.length && isWordChar(cells[to])) to += 1\n return {\n anchor: { row: at.row, column: from },\n focus: { row: at.row, column: to },\n dragging: false,\n }\n}\n\n/** The whole row under a point, prefix excluded. */\nexport function lineAt(rows: readonly TranscriptRow[], at: TextPoint): TextSelection {\n const row = rows[at.row]\n const cells = row === undefined ? 0 : [...row.text].length\n return {\n anchor: { row: at.row, column: row?.lead ?? 0 },\n focus: { row: at.row, column: cells },\n dragging: false,\n }\n}\n",
15
15
  "/**\n * Milliseconds since `active` became true, ticking while it stays true.\n *\n * This is the only clock in the CLI's view layer, and it is deliberately isolated: the transcript\n * reducer takes its durations from `turn.end`, so it needs no clock and stays deterministic. What\n * needs a clock is the \"thinking for 4s\" counter, whose entire job is to distinguish a slow model\n * from a hung one — the case where showing nothing is worst.\n */\n\nimport { useEffect, useState } from \"react\"\n\nconst TICK_MS = 100\n\nexport function useElapsed(active: boolean): number {\n const [elapsed, setElapsed] = useState(0)\n\n useEffect(() => {\n if (!active) {\n setElapsed(0)\n return\n }\n const startedAt = Date.now()\n setElapsed(0)\n const id = setInterval(() => setElapsed(Date.now() - startedAt), TICK_MS)\n return () => clearInterval(id)\n }, [active])\n\n return elapsed\n}\n",
16
16
  "/**\n * The bridge between the event bus and React state.\n *\n * The CLI has always subscribed to `runtime.bus`; this makes it a reducer over that bus rather than\n * a set of callbacks writing to stdout. All the interesting logic lives in `transcript.ts`, which is\n * pure and tested — this hook only owns the subscription, the abort controller, and the promise.\n */\n\nimport type { AnyEvent } from \"@dispach/core\"\nimport { useCallback, useEffect, useReducer, useRef } from \"react\"\nimport type { AgentSource } from \"#lib/source\"\nimport type { TranscriptState } from \"#lib/types\"\nimport { reduce, type TranscriptAction } from \"#transcript\"\n\nexport interface UseTurn {\n readonly state: TranscriptState\n /** A turn is in flight. Drives the Ctrl-C contract and the status bar. */\n readonly busy: boolean\n send(text: string): void\n cancel(): void\n note(text: string): void\n /**\n * Drop the oldest items if the buffer is over its cap. Safe to call on every change — a buffer\n * under the cap returns identical state and React skips the render.\n *\n * Exposed rather than done inside the reducer because the caller owns the scroll state, and\n * eviction while somebody is parked in history would move rows under them. `App` calls this only\n * while following the tail.\n */\n trim(): void\n}\n\nexport function useTurn(options: {\n /**\n * Where the agent is, rather than which object it is.\n *\n * This took an `Agent` and an `EventBus` directly, which is what made the TUI a second *owner*\n * of a runtime rather than a view of one. Nothing in this hook changes between the two: it\n * subscribes, it sends, it aborts, and each of those is one call the source implements its own\n * way — attached, an abort becomes a request naming the turn, because a turn belongs to the\n * server and is never cancelled by a disconnect.\n */\n readonly source: AgentSource\n readonly sessionKey: string\n readonly initial: TranscriptState\n}): UseTurn {\n const { source, sessionKey, initial } = options\n const [state, dispatch] = useReducer(reduce, initial)\n const controller = useRef<AbortController | undefined>(undefined)\n\n // A stream filter is stateful and the reducer is pure, so filtering happens here, on the way in.\n // Without it the live pane shows `ACTION:` and `END` and then commits them as the reply: with a\n // line-oriented dialect the invocation *is* text, and only the dialect knows which text.\n const filter = useRef(source.streamFilter())\n\n useEffect(() => {\n // One wildcard subscription rather than six by name: the reducer already ignores what it\n // does not own, and a subscription list would silently miss any event a later phase adds.\n //\n // `{ chunks: true }` is not optional here and is the whole reason the TUI streams. A\n // wildcard subscriber receives no `model.chunk` unless it asks — because `/v1/events`, the\n // WebSocket bridge and every plugin watcher are also wildcard and must not be put on the\n // per-token path by accident. This is the one wildcard in the tree that genuinely wants\n // tokens; drop the flag and the TUI silently stops streaming, which is the same shape of\n // failure the per-subscriber opt-in was introduced to remove.\n return source.subscribe((event: AnyEvent) => {\n // Other sessions share this bus — from Phase 4, a channel can be delivering a turn for\n // a different peer while this prompt is open. An event with no session key is\n // runtime-wide and belongs to everyone.\n if (event.sessionKey !== undefined && event.sessionKey !== sessionKey) return\n\n // Reasoning is never parsed for tool calls, so it is never filtered for them either.\n if (event.type === \"model.chunk\") {\n const { delta, kind } = event.data\n if (kind === \"reasoning\") {\n dispatch({ kind: \"delta\", of: \"reasoning\", text: delta })\n return\n }\n dispatch({ kind: \"delta\", of: \"text\", text: filter.current.push(delta) })\n return\n }\n\n // The filter owns the paragraph break between one step's narration and the next's, which\n // is why it is told where a step ends rather than being replaced at each one.\n if (event.type === \"model.result\") {\n dispatch({ kind: \"delta\", of: \"text\", text: filter.current.endStep() })\n return\n }\n\n if (event.type === \"turn.end\") {\n // Flush before the reducer commits the reply, or the last line of it is lost.\n dispatch({ kind: \"delta\", of: \"text\", text: filter.current.end() })\n filter.current = source.streamFilter()\n }\n\n dispatch({ kind: \"event\", event })\n })\n }, [source, sessionKey])\n\n const send = useCallback(\n (text: string) => {\n dispatch({ kind: \"user\", text })\n const next = new AbortController()\n controller.current = next\n // `send` resolves rather than rejects on abort, so cancellation is not an error path.\n // Anything that does reject got past the loop's own handling, and swallowing it would be\n // the silent failure hard rule 8 forbids — so it is reported and the prompt returns.\n source\n .send(text, { sessionKey, signal: next.signal })\n .catch((error: unknown) => {\n dispatch({\n kind: \"event\",\n event: {\n v: 1,\n ts: new Date().toISOString(),\n runtimeId: \"cli\",\n sessionKey,\n type: \"error\",\n data: {\n code: \"cli_turn_failed\",\n message: error instanceof Error ? error.message : String(error),\n hint: \"This escaped the turn loop's own error handling. Re-run with DEBUG=1 for a stack trace.\",\n },\n },\n })\n })\n .finally(() => {\n if (controller.current === next) controller.current = undefined\n })\n },\n [source, sessionKey],\n )\n\n const cancel = useCallback(() => {\n const current = controller.current\n if (current === undefined || current.signal.aborted) return\n dispatch({ kind: \"cancelling\" })\n current.abort()\n }, [])\n\n const note = useCallback(\n (text: string) => dispatch({ kind: \"note\", text } as TranscriptAction),\n [],\n )\n\n const trim = useCallback(() => dispatch({ kind: \"trim\" }), [])\n\n return { state, busy: state.status !== \"idle\", send, cancel, note, trim }\n}\n",
17
- "/**\n * How tall each piece of the chat frame is, so the conversation gets exactly the rows that are left.\n *\n * ## Why this has to be arithmetic and not flexbox\n *\n * On the alternate screen the layout has a hard ceiling: the terminal's height, with no scrollback to\n * absorb an overshoot. One row too many and Ink's own output scrolls the buffer, which leaves the status\n * line halfway up the display and the composer where the status line was — a corrupt frame rather than a\n * cramped one. Yoga will not save us here, because the thing that overflows is *our* choice of how many\n * transcript rows to hand it.\n *\n * So every piece of chrome reports its height, the sum is subtracted from the terminal, and the\n * conversation gets the remainder. `bodyRows` spends one further row as a margin, in the direction that\n * cannot be seen.\n *\n * ## The drift this invites, and how it is caught\n *\n * These functions restate each component's geometry, which means a component that grows a row without\n * changing its function here would make the frame one row too tall. That is a real hazard and it is\n * pinned by frame tests: each function is asserted against the line count of the actual render, so the\n * two cannot disagree for longer than one test run. Deriving the number *from* a render is not available\n * — the layout has to be decided before anything is drawn.\n *\n * Pure: editor state, palette matches and live text in, row counts out.\n */\n\nimport { searchMatches } from \"#editor\"\nimport { composerLayout } from \"#lib/composer\"\nimport {\n BRAND_GAP_ROWS,\n LIVE_PANE_MAX_ROWS,\n MAX_INPUT_ROWS,\n MIN_LANDING_TRANSCRIPT,\n} from \"#lib/const\"\nimport type { Palette } from \"#lib/palette\"\nimport { viewport } from \"#lib/rows\"\nimport { bodyRows } from \"#lib/scroll\"\nimport type { EditorState, LiveTurn } from \"#lib/types\"\nimport { livePane } from \"#lib/wrap\"\n\n/** The one-line header, the status line, and the row the transcript reserves for its scroll counter. */\nconst HEADER_ROWS = 1\nconst STATUS_ROWS = 1\nconst SCROLL_HINT_ROWS = 1\n/** `Prompt` wraps `LineCursor` in a bordered box: one row of border above and one below. */\nconst PROMPT_BORDER_ROWS = 2\n/** The same box's two border columns and its `paddingX={1}` on each side. */\nconst PROMPT_PADDING = 4\n/** `PROMPT` — the `\\u203a ` the composer draws before the first row and matches with a blank after it. */\nconst PROMPT_GUTTER = 2\n/** `\\u00b7 reasoning \\u00b7 ` — the prefix `Live` puts on its first row, which narrows the wrap. */\nconst LIVE_LABEL = 14\n\n/**\n * The composer, including its border and the newline hint it shows once a message has two lines.\n *\n * One form, both states. There used to be a `roomy` landing variant three rows taller, which existed\n * because the composer sat directly under the banner with the slack below it — the padding was what kept\n * its border off the text above. With the slack above it (decision 11.98, reversed) there is nothing to\n * separate it from, and 11.90's own argument now applies to both states rather than one: every row the\n * composer takes is a row of conversation, and this is the function that charges for them.\n */\nexport function promptRows(editor: EditorState, columns: number): number {\n // Visual rows, not logical lines. Counting lines was correct only while nothing wrapped, and it went\n // wrong in the direction that cannot be seen: a wrapped message drew more rows than the frame had\n // subtracted, so the bottom of the composer went under the status line.\n const { rows, caretRow } = composerLayout(\n editor,\n Math.max(1, columns - PROMPT_PADDING - PROMPT_GUTTER),\n )\n const total = rows.length\n // Through `viewport`, the function `LineCursor` itself calls, rather than a second guess at where the\n // window lands. Each side of it spends a row on a \"… n lines above/below\" notice when it hides\n // something, so the count has to come from the same arithmetic that decides whether it does.\n const { from, to } = viewport(total, caretRow, Math.max(1, Math.min(total, MAX_INPUT_ROWS)))\n return (\n PROMPT_BORDER_ROWS +\n (to - from) +\n (from > 0 ? 1 : 0) +\n (total - to > 0 ? 1 : 0) +\n // Logical lines, not rows: the newline hint answers \"how do I add another line\", and a message\n // that merely wrapped has not added one. Counting rows here made the frame one row taller than\n // the render for every message wide enough to wrap — the same disagreement, in the other\n // direction, as counting lines for the viewport.\n (editor.value.includes(\"\\n\") ? 1 : 0)\n )\n}\n\n/** The slash-command list: its matches, its overflow notices, and the line naming its keys. */\nexport function paletteRows(palette: Palette | undefined, maxRows: number): number {\n if (palette === undefined) return 0\n // The empty case renders one line saying nothing matched, and no key hint — there is nothing to do.\n if (palette.matches.length === 0) return 1\n const shown = Math.min(palette.matches.length, maxRows)\n const overflow = palette.matches.length > shown ? 1 : 0\n return shown + overflow + 1\n}\n\n/** `^R`'s match list plus its query line. Zero when the search is closed. */\nexport function searchRows(editor: EditorState, maxRows: number): number {\n if (editor.search === undefined) return 0\n const matches = searchMatches(editor)\n return (matches.length === 0 ? 1 : Math.min(matches.length, maxRows)) + 1\n}\n\nexport interface ChatFrame {\n /**\n * Rows the brand mark **may** use above the one-line header, or 0 once it has collapsed.\n *\n * An allowance, not a height, and the caller must charge the conversation for what the mark *actually*\n * draws — `wordmark` degrades through its tiers and usually takes far less. Charging the allowance was\n * the first version and it wasted eleven rows on a thirty-row terminal: the mark drew five, the\n * transcript was billed sixteen, and the banner ended up scrolled to a mid-wrap fragment of a store path\n * with a third of the screen blank.\n *\n * Floored so a landing screen always keeps enough transcript for the banner. That is where the boot notes\n * and every load warning are written, and a picture hiding them is the trimmed-catalogue failure with\n * better typography: true of what is on screen, false of what is the case.\n */\n readonly brand: number\n /**\n * Rows for the brand mark and the conversation together, before either is measured.\n *\n * Returned so the split happens once, in the caller that knows the mark's rendered height.\n */\n readonly body: number\n /** Rows the conversation may draw if the mark takes none — its scroll counter already deducted. */\n readonly transcript: number\n /** Rows a pane over the conversation may draw. It replaces the transcript rather than sharing. */\n readonly pane: number\n}\n\n/**\n * The row budget for one frame.\n *\n * A pane and the transcript are alternatives, not neighbours. Rendered together the pane took a fixed\n * sixteen rows and pushed the conversation off the top of a full screen — and on a surface with no\n * scrollback, \"off the top\" means gone. Whichever is in front gets the body.\n */\nexport function chatFrame(inputs: {\n readonly rows: number\n readonly columns: number\n readonly editor: EditorState\n readonly live: LiveTurn | undefined\n readonly showReasoning: boolean\n readonly palette: Palette | undefined\n readonly searchMaxRows: number\n readonly paletteMaxRows: number\n /** A confirmation question, which is one line above the composer. */\n readonly confirming: boolean\n /**\n * Nothing has been sent yet, so the brand mark is up.\n *\n * It used to mean a roomier composer as well, and no longer does: the composer is one form in both\n * states now that the slack sits above it. What is left is the wordmark's allowance, which is the only\n * thing on the frame that a landing screen still spends rows on.\n */\n readonly landing: boolean\n /** The one-line hint under the composer, shown only while landing. */\n readonly hint: boolean\n}): ChatFrame {\n const live = inputs.live\n // The live pane shows reasoning only until the reply itself starts, which is the component's rule and\n // therefore has to be this one too.\n const liveText =\n live === undefined\n ? \"\"\n : inputs.showReasoning && live.reasoning !== \"\" && live.text === \"\"\n ? live.reasoning\n : live.text\n\n const chrome =\n HEADER_ROWS +\n STATUS_ROWS +\n livePane(liveText, inputs.columns - LIVE_LABEL, LIVE_PANE_MAX_ROWS).rows +\n paletteRows(inputs.palette, inputs.paletteMaxRows) +\n searchRows(inputs.editor, inputs.searchMaxRows) +\n promptRows(inputs.editor, inputs.columns) +\n (inputs.confirming ? 1 : 0) +\n (inputs.hint ? 1 : 0)\n\n const body = bodyRows(inputs.rows, chrome)\n\n // What is left for the brand mark after the conversation keeps its floor and the blank row under the mark\n // is paid for. Zero once it has collapsed, and zero on a terminal too short to afford it — `wordmark`\n // degrades through its tiers on the way down and then to nothing, so a short screen loses the picture\n // rather than the banner.\n const brand = inputs.landing ? Math.max(0, body - MIN_LANDING_TRANSCRIPT - BRAND_GAP_ROWS) : 0\n\n // The pane draws its own two \"… n lines above/below\" notices and a key-hint line, which is why it\n // reports fewer rows than it is given rather than being handed the whole body.\n return {\n brand,\n body,\n transcript: Math.max(1, body - SCROLL_HINT_ROWS),\n pane: Math.max(1, body - 3),\n }\n}\n\n/**\n * The conversation's rows once the brand mark has taken what it actually needs.\n *\n * Separate from `chatFrame` because it needs the mark's *rendered* height, which only the caller has — and\n * one function rather than an inline subtraction at the call site, so there is no second idea of whether the\n * gap row is included.\n */\n/**\n * Which buffer row a screen cell is on, or `undefined` if the cell is not in the transcript.\n *\n * The one place the frame's vertical arithmetic is read backwards, and it belongs here because this module\n * is where that arithmetic already lives. A caller deriving it would restate the brand's height, the gap,\n * the header and the scroll-hint row — four numbers that are only correct together.\n *\n * Above the transcript, in order: the wordmark and its gap (landing only), the one-line header, and the\n * scroll-hint row `Transcript` always draws even when it is blank. Below it, everything is chrome. A cell\n * outside the window returns `undefined` rather than clamping, because clamping would make a click on the\n * status line select the last row of the conversation.\n */\nexport function transcriptHit(\n point: { readonly column: number; readonly row: number },\n layout: {\n readonly brandLines: number\n /** The window `Transcript` was handed: `from` inclusive, `to` exclusive. */\n readonly from: number\n readonly to: number\n },\n): { readonly row: number; readonly column: number } | undefined {\n const top =\n (layout.brandLines === 0 ? 0 : layout.brandLines + BRAND_GAP_ROWS) +\n HEADER_ROWS +\n SCROLL_HINT_ROWS\n const offset = point.row - top\n if (offset < 0) return undefined\n const row = layout.from + offset\n if (row >= layout.to) return undefined\n return { row, column: point.column }\n}\n\n/**\n * Which offset in the message a screen cell is on, or `undefined` if the cell is not in the composer.\n *\n * The composer's position is computable because the frame is bottom-anchored (decision 11.120): the status\n * line is the last row, the landing hint sits above it, and the composer occupies exactly `promptRows`\n * above that. Counting down from the top would mean knowing the height of every optional block in between\n * — the live pane, the palette, the history search, the confirm line — and being wrong about any one of\n * them would put the caret on the wrong row.\n *\n * Horizontally: one border column, one of `paddingX`, then the two-column prompt gutter. `PROMPT_PADDING`\n * is the pair of borders *and* the pair of paddings, so half of it is the left inset — which is why the\n * text does not start at `PROMPT_PADDING`.\n *\n * The returned offset is a code-point index into `editor.value`, which is what the reducer's `cursor` and\n * `anchor` are: a caller never has to know that rows were involved.\n */\nexport function composerHit(\n point: { readonly column: number; readonly row: number },\n inputs: {\n readonly editor: EditorState\n readonly columns: number\n /** The terminal's height, which is the frame's height. */\n readonly rows: number\n /** Whether the one-line landing hint is drawn under the composer. */\n readonly hint: boolean\n },\n): number | undefined {\n const layout = composerLayout(\n inputs.editor,\n Math.max(1, inputs.columns - PROMPT_PADDING - PROMPT_GUTTER),\n )\n const total = layout.rows.length\n const { from, to } = viewport(\n total,\n layout.caretRow,\n Math.max(1, Math.min(total, MAX_INPUT_ROWS)),\n )\n // Only the notice *above* shifts the text down. The one below sits under it and is already inside the\n // block height, so counting it here would move the first row twice.\n const above = from > 0 ? 1 : 0\n // The newline hint is inside `Prompt`'s own box, so it is part of what `promptRows` counts and needs\n // no separate term here.\n const block = promptRows(inputs.editor, inputs.columns)\n const top = inputs.rows - STATUS_ROWS - (inputs.hint ? 1 : 0) - block\n // One border row, then any \"… n lines above\" notice, then the visible rows.\n const firstText = top + PROMPT_BORDER_ROWS / 2 + above\n const offset = point.row - firstText\n if (offset < 0 || offset >= to - from) return undefined\n const row = layout.rows[from + offset]\n if (row === undefined) return undefined\n // Left inset: half of `PROMPT_PADDING` is the left border plus the left padding.\n const textColumn = point.column - PROMPT_PADDING / 2 - PROMPT_GUTTER\n if (textColumn < 0) return row.start\n // Past the end of the row's text means the end of that row, which is what clicking in the empty space\n // after a short line means everywhere else.\n return Math.min(row.end, row.start + Math.max(0, textColumn - row.lead))\n}\n\nexport function transcriptRowsAfterBrand(frame: ChatFrame, brandLines: number): number {\n const used = brandLines === 0 ? 0 : brandLines + BRAND_GAP_ROWS\n return Math.max(1, frame.body - used - SCROLL_HINT_ROWS)\n}\n",
17
+ "/**\n * How tall each piece of the chat frame is, so the conversation gets exactly the rows that are left.\n *\n * ## Why this has to be arithmetic and not flexbox\n *\n * On the alternate screen the layout has a hard ceiling: the terminal's height, with no scrollback to\n * absorb an overshoot. One row too many and Ink's own output scrolls the buffer, which leaves the status\n * line halfway up the display and the composer where the status line was — a corrupt frame rather than a\n * cramped one. Yoga will not save us here, because the thing that overflows is *our* choice of how many\n * transcript rows to hand it.\n *\n * So every piece of chrome reports its height, the sum is subtracted from the terminal, and the\n * conversation gets the remainder. `bodyRows` spends one further row as a margin, in the direction that\n * cannot be seen.\n *\n * ## The drift this invites, and how it is caught\n *\n * These functions restate each component's geometry, which means a component that grows a row without\n * changing its function here would make the frame one row too tall. That is a real hazard and it is\n * pinned by frame tests: each function is asserted against the line count of the actual render, so the\n * two cannot disagree for longer than one test run. Deriving the number *from* a render is not available\n * — the layout has to be decided before anything is drawn.\n *\n * Pure: editor state, palette matches and live text in, row counts out.\n */\n\nimport { searchMatches } from \"#editor\"\nimport { composerLayout } from \"#lib/composer\"\nimport {\n BRAND_GAP_ROWS,\n LIVE_PANE_MAX_ROWS,\n MAX_INPUT_ROWS,\n MIN_LANDING_TRANSCRIPT,\n} from \"#lib/const\"\nimport type { Palette } from \"#lib/palette\"\nimport { viewport } from \"#lib/rows\"\nimport { bodyRows } from \"#lib/scroll\"\nimport type { EditorState, LiveTurn } from \"#lib/types\"\nimport { livePane } from \"#lib/wrap\"\n\n/** The one-line header, the status line, and the row the transcript reserves for its scroll counter. */\nconst HEADER_ROWS = 1\nconst STATUS_ROWS = 1\nconst SCROLL_HINT_ROWS = 1\n/** `Prompt` wraps `LineCursor` in a bordered box: one row of border above and one below. */\nconst PROMPT_BORDER_ROWS = 2\n/** The same box's two border columns and its `paddingX={1}` on each side. */\nconst PROMPT_PADDING = 4\n/** `PROMPT` — the `\\u203a ` the composer draws before the first row and matches with a blank after it. */\nconst PROMPT_GUTTER = 2\n/** `\\u00b7 reasoning \\u00b7 ` — the prefix `Live` puts on its first row, which narrows the wrap. */\nconst LIVE_LABEL = 14\n\n/**\n * The composer, including its border and the newline hint it shows once a message has two lines.\n *\n * One form, both states. There used to be a `roomy` landing variant three rows taller, which existed\n * because the composer sat directly under the banner with the slack below it — the padding was what kept\n * its border off the text above. With the slack above it (decision 11.98, reversed) there is nothing to\n * separate it from, and 11.90's own argument now applies to both states rather than one: every row the\n * composer takes is a row of conversation, and this is the function that charges for them.\n */\nexport function promptRows(editor: EditorState, columns: number): number {\n // Visual rows, not logical lines. Counting lines was correct only while nothing wrapped, and it went\n // wrong in the direction that cannot be seen: a wrapped message drew more rows than the frame had\n // subtracted, so the bottom of the composer went under the status line.\n const { rows, caretRow } = composerLayout(\n editor,\n Math.max(1, columns - PROMPT_PADDING - PROMPT_GUTTER),\n )\n const total = rows.length\n // Through `viewport`, the function `LineCursor` itself calls, rather than a second guess at where the\n // window lands. Each side of it spends a row on a \"… n lines above/below\" notice when it hides\n // something, so the count has to come from the same arithmetic that decides whether it does.\n const { from, to } = viewport(total, caretRow, Math.max(1, Math.min(total, MAX_INPUT_ROWS)))\n return (\n PROMPT_BORDER_ROWS +\n (to - from) +\n (from > 0 ? 1 : 0) +\n (total - to > 0 ? 1 : 0) +\n // Logical lines, not rows: the newline hint answers \"how do I add another line\", and a message\n // that merely wrapped has not added one. Counting rows here made the frame one row taller than\n // the render for every message wide enough to wrap — the same disagreement, in the other\n // direction, as counting lines for the viewport.\n (editor.value.includes(\"\\n\") ? 1 : 0)\n )\n}\n\n/** The slash-command list: its matches, its overflow notices, and the line naming its keys. */\n/** The key-hint line the palette always draws, plus the one overflow notice it may. */\nconst PALETTE_CHROME = 2\n\nexport function paletteRows(palette: Palette | undefined, maxRows: number): number {\n if (palette === undefined) return 0\n // The empty case renders one line saying nothing matched, and no key hint — there is nothing to do.\n if (palette.matches.length === 0) return 1\n const shown = Math.min(palette.matches.length, maxRows)\n const overflow = palette.matches.length > shown ? 1 : 0\n return shown + overflow + 1\n}\n\n/** `^R`'s match list plus its query line. Zero when the search is closed. */\nexport function searchRows(editor: EditorState, maxRows: number): number {\n if (editor.search === undefined) return 0\n const matches = searchMatches(editor)\n return (matches.length === 0 ? 1 : Math.min(matches.length, maxRows)) + 1\n}\n\nexport interface ChatFrame {\n /**\n * Rows the brand mark **may** use above the one-line header, or 0 once it has collapsed.\n *\n * An allowance, not a height, and the caller must charge the conversation for what the mark *actually*\n * draws — `wordmark` degrades through its tiers and usually takes far less. Charging the allowance was\n * the first version and it wasted eleven rows on a thirty-row terminal: the mark drew five, the\n * transcript was billed sixteen, and the banner ended up scrolled to a mid-wrap fragment of a store path\n * with a third of the screen blank.\n *\n * Floored so a landing screen always keeps enough transcript for the banner. That is where the boot notes\n * and every load warning are written, and a picture hiding them is the trimmed-catalogue failure with\n * better typography: true of what is on screen, false of what is the case.\n */\n readonly brand: number\n /**\n * Rows for the brand mark and the conversation together, before either is measured.\n *\n * Returned so the split happens once, in the caller that knows the mark's rendered height.\n */\n readonly body: number\n /**\n * Rows the palette may actually use — its requested ceiling **clamped by the terminal**.\n *\n * `LANDING_LIST_ROWS` is what the landing screen would *like*, and the terminal wins, which is\n * the rule `SkillBrowser` already follows and the chat frame did not. Twenty-three commands at\n * 30 rows asked for 24 rows of palette plus every other piece of chrome, so the frame came out\n * taller than the terminal — and an overflowing frame is corruption rather than a scrollbar:\n * Ink's own output scrolled the buffer and the *first* command went off the top with no counter\n * saying so. Returned rather than clamped silently, because the component has to render the\n * \"… N above/below\" line against the same number the budget was computed from.\n */\n readonly paletteRows: number\n /** Rows the conversation may draw if the mark takes none — its scroll counter already deducted. */\n readonly transcript: number\n /** Rows a pane over the conversation may draw. It replaces the transcript rather than sharing. */\n readonly pane: number\n}\n\n/**\n * The row budget for one frame.\n *\n * A pane and the transcript are alternatives, not neighbours. Rendered together the pane took a fixed\n * sixteen rows and pushed the conversation off the top of a full screen — and on a surface with no\n * scrollback, \"off the top\" means gone. Whichever is in front gets the body.\n */\nexport function chatFrame(inputs: {\n readonly rows: number\n readonly columns: number\n readonly editor: EditorState\n readonly live: LiveTurn | undefined\n readonly showReasoning: boolean\n readonly palette: Palette | undefined\n readonly searchMaxRows: number\n readonly paletteMaxRows: number\n /** A confirmation question, which is one line above the composer. */\n readonly confirming: boolean\n /**\n * Nothing has been sent yet, so the brand mark is up.\n *\n * It used to mean a roomier composer as well, and no longer does: the composer is one form in both\n * states now that the slack sits above it. What is left is the wordmark's allowance, which is the only\n * thing on the frame that a landing screen still spends rows on.\n */\n readonly landing: boolean\n /** The one-line hint under the composer, shown only while landing. */\n readonly hint: boolean\n}): ChatFrame {\n const live = inputs.live\n // The live pane shows reasoning only until the reply itself starts, which is the component's rule and\n // therefore has to be this one too.\n const liveText =\n live === undefined\n ? \"\"\n : inputs.showReasoning && live.reasoning !== \"\" && live.text === \"\"\n ? live.reasoning\n : live.text\n\n /**\n * Everything the frame owes *besides* the palette, so the palette can be clamped by what is left.\n *\n * Computed first and used twice rather than guessed at: the ceiling a caller passes is a wish,\n * and a frame that grants it whatever the terminal has is one row taller than the screen — which\n * scrolls Ink's own output and takes the top of the list with it.\n */\n const fixedChrome =\n HEADER_ROWS +\n STATUS_ROWS +\n livePane(liveText, inputs.columns - LIVE_LABEL, LIVE_PANE_MAX_ROWS).rows +\n searchRows(inputs.editor, inputs.searchMaxRows) +\n promptRows(inputs.editor, inputs.columns) +\n (inputs.confirming ? 1 : 0) +\n (inputs.hint ? 1 : 0)\n // One row of conversation left visible, so the palette never takes the whole screen — a list\n // with nothing above it reads as a different app rather than as a menu over a conversation.\n const paletteCeiling = Math.max(\n 1,\n Math.min(inputs.paletteMaxRows, inputs.rows - fixedChrome - PALETTE_CHROME - 1),\n )\n\n const chrome =\n HEADER_ROWS +\n STATUS_ROWS +\n livePane(liveText, inputs.columns - LIVE_LABEL, LIVE_PANE_MAX_ROWS).rows +\n paletteRows(inputs.palette, paletteCeiling) +\n searchRows(inputs.editor, inputs.searchMaxRows) +\n promptRows(inputs.editor, inputs.columns) +\n (inputs.confirming ? 1 : 0) +\n (inputs.hint ? 1 : 0)\n\n const body = bodyRows(inputs.rows, chrome)\n\n // What is left for the brand mark after the conversation keeps its floor and the blank row under the mark\n // is paid for. Zero once it has collapsed, and zero on a terminal too short to afford it — `wordmark`\n // degrades through its tiers on the way down and then to nothing, so a short screen loses the picture\n // rather than the banner.\n const brand = inputs.landing ? Math.max(0, body - MIN_LANDING_TRANSCRIPT - BRAND_GAP_ROWS) : 0\n\n // The pane draws its own two \"… n lines above/below\" notices and a key-hint line, which is why it\n // reports fewer rows than it is given rather than being handed the whole body.\n return {\n paletteRows: paletteCeiling,\n brand,\n body,\n transcript: Math.max(1, body - SCROLL_HINT_ROWS),\n pane: Math.max(1, body - 3),\n }\n}\n\n/**\n * The conversation's rows once the brand mark has taken what it actually needs.\n *\n * Separate from `chatFrame` because it needs the mark's *rendered* height, which only the caller has — and\n * one function rather than an inline subtraction at the call site, so there is no second idea of whether the\n * gap row is included.\n */\n/**\n * Which buffer row a screen cell is on, or `undefined` if the cell is not in the transcript.\n *\n * The one place the frame's vertical arithmetic is read backwards, and it belongs here because this module\n * is where that arithmetic already lives. A caller deriving it would restate the brand's height, the gap,\n * the header and the scroll-hint row — four numbers that are only correct together.\n *\n * Above the transcript, in order: the wordmark and its gap (landing only), the one-line header, and the\n * scroll-hint row `Transcript` always draws even when it is blank. Below it, everything is chrome. A cell\n * outside the window returns `undefined` rather than clamping, because clamping would make a click on the\n * status line select the last row of the conversation.\n */\nexport function transcriptHit(\n point: { readonly column: number; readonly row: number },\n layout: {\n readonly brandLines: number\n /** The window `Transcript` was handed: `from` inclusive, `to` exclusive. */\n readonly from: number\n readonly to: number\n },\n): { readonly row: number; readonly column: number } | undefined {\n const top =\n (layout.brandLines === 0 ? 0 : layout.brandLines + BRAND_GAP_ROWS) +\n HEADER_ROWS +\n SCROLL_HINT_ROWS\n const offset = point.row - top\n if (offset < 0) return undefined\n const row = layout.from + offset\n if (row >= layout.to) return undefined\n return { row, column: point.column }\n}\n\n/**\n * Which offset in the message a screen cell is on, or `undefined` if the cell is not in the composer.\n *\n * The composer's position is computable because the frame is bottom-anchored (decision 11.120): the status\n * line is the last row, the landing hint sits above it, and the composer occupies exactly `promptRows`\n * above that. Counting down from the top would mean knowing the height of every optional block in between\n * — the live pane, the palette, the history search, the confirm line — and being wrong about any one of\n * them would put the caret on the wrong row.\n *\n * Horizontally: one border column, one of `paddingX`, then the two-column prompt gutter. `PROMPT_PADDING`\n * is the pair of borders *and* the pair of paddings, so half of it is the left inset — which is why the\n * text does not start at `PROMPT_PADDING`.\n *\n * The returned offset is a code-point index into `editor.value`, which is what the reducer's `cursor` and\n * `anchor` are: a caller never has to know that rows were involved.\n */\nexport function composerHit(\n point: { readonly column: number; readonly row: number },\n inputs: {\n readonly editor: EditorState\n readonly columns: number\n /** The terminal's height, which is the frame's height. */\n readonly rows: number\n /** Whether the one-line landing hint is drawn under the composer. */\n readonly hint: boolean\n },\n): number | undefined {\n const layout = composerLayout(\n inputs.editor,\n Math.max(1, inputs.columns - PROMPT_PADDING - PROMPT_GUTTER),\n )\n const total = layout.rows.length\n const { from, to } = viewport(\n total,\n layout.caretRow,\n Math.max(1, Math.min(total, MAX_INPUT_ROWS)),\n )\n // Only the notice *above* shifts the text down. The one below sits under it and is already inside the\n // block height, so counting it here would move the first row twice.\n const above = from > 0 ? 1 : 0\n // The newline hint is inside `Prompt`'s own box, so it is part of what `promptRows` counts and needs\n // no separate term here.\n const block = promptRows(inputs.editor, inputs.columns)\n const top = inputs.rows - STATUS_ROWS - (inputs.hint ? 1 : 0) - block\n // One border row, then any \"… n lines above\" notice, then the visible rows.\n const firstText = top + PROMPT_BORDER_ROWS / 2 + above\n const offset = point.row - firstText\n if (offset < 0 || offset >= to - from) return undefined\n const row = layout.rows[from + offset]\n if (row === undefined) return undefined\n // Left inset: half of `PROMPT_PADDING` is the left border plus the left padding.\n const textColumn = point.column - PROMPT_PADDING / 2 - PROMPT_GUTTER\n if (textColumn < 0) return row.start\n // Past the end of the row's text means the end of that row, which is what clicking in the empty space\n // after a short line means everywhere else.\n return Math.min(row.end, row.start + Math.max(0, textColumn - row.lead))\n}\n\nexport function transcriptRowsAfterBrand(frame: ChatFrame, brandLines: number): number {\n const used = brandLines === 0 ? 0 : brandLines + BRAND_GAP_ROWS\n return Math.max(1, frame.body - used - SCROLL_HINT_ROWS)\n}\n",
18
18
  "/**\n * Putting text on the system clipboard.\n *\n * ## Why this has to exist at all\n *\n * `cmd+c` cannot reach a terminal application. The terminal's own Edit > Copy claims it first, and finds no\n * native selection to copy because mouse tracking disabled the terminal's selection in order to deliver the\n * drag events. The reference CLI says the same thing in its own words and draws the same conclusion: copy\n * on mouse-up, so `cmd+v` then works and the chord nobody can intercept is the one that matters.\n *\n * ## Why not OSC 52\n *\n * There is an escape sequence for this — `OSC 52` asks the terminal to set the clipboard — and it is\n * refused, truncated, or silently ignored by enough terminals that a copy would sometimes do nothing with\n * no way to tell. A subprocess either runs or reports why. It is also the only form that works over ssh\n * *without* the remote terminal cooperating, which is a real advantage OSC 52 has; the trade is taken\n * knowingly, and a failure says which command was missing.\n */\n\nimport { spawnCaptureAsync } from \"#lib/spawn\"\n\n/** Candidates in order of preference, first one present wins. */\nconst WRITERS: readonly { readonly command: string; readonly args: readonly string[] }[] = [\n // macOS.\n { command: \"pbcopy\", args: [] },\n // Wayland, before X11: a Wayland session usually has `xclip` too, through Xwayland, and writing to the\n // X clipboard there puts the text somewhere the compositor's own paste will not find it.\n { command: \"wl-copy\", args: [] },\n { command: \"xclip\", args: [\"-selection\", \"clipboard\"] },\n { command: \"xsel\", args: [\"--clipboard\", \"--input\"] },\n]\n\nexport interface CopyResult {\n readonly copied: boolean\n /** Which command did it, for a message that names what happened rather than asserting success. */\n readonly using?: string\n readonly problem?: string\n}\n\n/**\n * Copy `text` to the clipboard, or say why not.\n *\n * Never throws and never reports success it did not have: a copy that silently failed leaves somebody\n * pasting the *previous* contents of their clipboard, which looks like the wrong text was selected.\n */\nexport async function copyToClipboard(text: string): Promise<CopyResult> {\n if (text === \"\") return { copied: false, problem: \"nothing selected\" }\n const missing: string[] = []\n for (const writer of WRITERS) {\n const result = await spawnCaptureAsync({\n command: writer.command,\n args: writer.args,\n input: text,\n // Generous but bounded: a clipboard helper that hangs must not hang the session with it.\n timeoutMs: 2_000,\n })\n if (result.notFound) {\n missing.push(writer.command)\n continue\n }\n if (result.code === 0) return { copied: true, using: writer.command }\n return {\n copied: false,\n using: writer.command,\n problem: result.stderr.trim() || `${writer.command} exited ${result.code}`,\n }\n }\n return { copied: false, problem: `no clipboard command found (tried ${missing.join(\", \")})` }\n}\n",
19
- "/**\n * The slash-command palette: what a partially typed `/word` could mean.\n *\n * ## Generated, not listed\n *\n * The entries come from two tables that already exist. `SESSION_COMMANDS` holds the verbs that only make\n * sense inside a session — `/help`, `/reset`, `/exit` — and `COMMANDS` holds the whole CLI, with every\n * flag, every `choices` value and every summary already written down for `--help`.\n *\n * Reading `COMMANDS` rather than a second list is the load-bearing decision. A flag added to the CLI\n * appears in the TUI with nothing to remember, which is the discipline `session-commands.ts`'s own header\n * argues for after watching `/help` drift in both directions when it was a string in a component. A\n * command that should not be offered in a session declares `inSession: \"hidden\"` — hiding by omission\n * from a hand-written list is the same drift wearing a different hat, and a required field means a new\n * command cannot be silently absent instead.\n *\n * ## Pure\n *\n * Derived from the editor's value, so the only state the renderer adds is a cursor index. No filesystem,\n * no process, no renderer — PURE-listed, and the matching rules are asserted as data.\n */\n\nimport { COMMANDS } from \"#lib/commands\"\nimport type { CommandSpec } from \"#lib/schema\"\nimport { SESSION_COMMANDS } from \"#lib/session-commands\"\n\nexport interface PaletteEntry {\n /** With the slash, as it would be typed. */\n readonly word: string\n readonly summary: string\n /**\n * `session` — dispatched by `resolveSessionCommand`.\n * `view` — a bespoke screen.\n * `output` — run the command and show what it printed.\n */\n readonly kind: \"session\" | \"view\" | \"output\"\n /** Present for a CLI command, so a host can read its flags and actions. */\n readonly spec?: CommandSpec\n}\n\n/**\n * Every entry a session offers, session verbs first.\n *\n * Session verbs lead because they are the ones with no shell equivalent and the ones typed most: `/help`\n * and `/exit` at the top of an unfiltered list is what makes the palette answer \"what can I do here\"\n * rather than \"what commands exist\".\n */\nexport function paletteEntries(): readonly PaletteEntry[] {\n const session: PaletteEntry[] = SESSION_COMMANDS.map((spec) => ({\n word: spec.word,\n summary: spec.summary,\n kind: \"session\" as const,\n }))\n const own = new Set(session.map((entry) => entry.word))\n const commands: PaletteEntry[] = COMMANDS.filter((spec) => spec.inSession !== \"hidden\")\n // A CLI command whose name collides with a session verb loses: `/tools` inside a session means\n // the running agent's catalogue, not a fresh load of the manifest from disk.\n .filter((spec) => !own.has(`/${spec.name}`))\n .map((spec) => ({\n word: `/${spec.name}`,\n summary: spec.summary,\n kind: spec.inSession === \"view\" ? (\"view\" as const) : (\"output\" as const),\n spec,\n }))\n return [...session, ...commands]\n}\n\nexport interface Palette {\n /** What has been typed after the slash, lowercased. */\n readonly query: string\n readonly matches: readonly PaletteEntry[]\n}\n\n/**\n * The palette for a buffer, or `undefined` when the buffer is not a slash command being typed.\n *\n * Open only while the *whole* buffer is one `/word` under construction. Two consequences, both\n * deliberate: a message that merely mentions a path never opens it, and once arguments are being typed\n * the list closes, because there is nothing left to complete and a list covering the line would hide\n * what is being written.\n */\nexport function paletteFor(\n value: string,\n entries: readonly PaletteEntry[] = paletteEntries(),\n): Palette | undefined {\n if (!/^\\/[A-Za-z-]*$/.test(value)) return undefined\n const query = value.slice(1).toLowerCase()\n const matches = entries.filter((entry) => entry.word.slice(1).toLowerCase().startsWith(query))\n // Prefix, not fuzzy. A palette that offers `/sessions` for `/st` reads as noise, and the words are\n // short enough that a prefix always reaches them in two or three characters.\n return { query, matches }\n}\n\n/** The entry a cursor is on, clamped, or `undefined` when nothing matches. */\nexport function paletteSelection(palette: Palette, index: number): PaletteEntry | undefined {\n if (palette.matches.length === 0) return undefined\n return palette.matches[Math.max(0, Math.min(index, palette.matches.length - 1))]\n}\n\n/**\n * The command names a typed slash line may use, without the leading slash.\n *\n * `resolveSessionCommand` takes this list, and it defaulted to empty at the one call site that mattered\n * — so a typed `/config get x` was prose and the same command chosen from the palette ran. Derived from\n * the palette rather than from `COMMANDS` directly, because the palette is what the person was just\n * shown: anything offered there has to be typeable, and anything typeable has to be offered.\n */\nexport function offeredCommands(): readonly string[] {\n return paletteEntries()\n .filter((entry) => entry.kind !== \"session\")\n .map((entry) => entry.word.slice(1))\n}\n",
20
- "/**\n * Running one of this binary's own commands, for a pane inside a session.\n *\n * ## Why a child process rather than calling the function\n *\n * The obvious implementation is to call `validateCommand()` and swap `process.stdout.write` for a\n * collector. It is also wrong here: Ink *owns* stdout while a session is mounted, and it writes a frame\n * whenever anything re-renders. A frame drawn during the capture window lands in the collector instead of\n * on the terminal — so the screen silently misses a repaint and the pane shows a frame of itself. Nothing\n * errors; the display is just wrong, intermittently, depending on timing.\n *\n * A child writes to its own pipe. Nothing is hijacked, the frame keeps rendering, and the pane shows\n * exactly what the command prints — which is also the honest thing to show, since \"run this command\" is\n * what the palette offered. The cost is process startup, which is the same ~100 ms every command in this\n * CLI already pays and is invisible next to reading the result.\n *\n * `--plain` is forced, for the reason it exists: a child that thought it had a terminal would return\n * escape sequences, and the pane would render them as text.\n */\n\nimport { findCommand } from \"#lib/commands\"\nimport { spawnCaptureAsync } from \"#lib/spawn\"\n\nexport interface SubcommandResult {\n readonly lines: readonly string[]\n readonly code: number\n}\n\nexport interface SubcommandRequest {\n readonly name: string\n /** Arguments as typed after the command word, split on whitespace. */\n readonly rest: string\n /** The agent this session is running, passed to any command that takes a manifest. */\n readonly manifestPath: string\n /** Injected by tests. `process.execPath` and `process.argv[1]` otherwise. */\n readonly interpreter?: string\n readonly script?: string\n readonly env?: Readonly<Record<string, string | undefined>>\n readonly timeoutMs?: number\n}\n\n/**\n * Where this command wants the manifest among its positionals, or `-1` for one that takes none.\n *\n * Read off the command's own spec rather than a hand-kept list, which was wrong in both directions at\n * once. `NO_MANIFEST` held four names: `soul` takes an *action* first and was not listed, so\n * `/soul distill` ran as `soul <manifestPath> distill` and the action became a path — broken in-session\n * for as long as it has been offered there; and `agents` takes a variadic manifest first and *was*\n * listed, so it ran with none at all.\n *\n * It also could not express the real shape. `config` and `memory` take an action and *then* a manifest,\n * so \"prepend or not\" has no right answer for them — the path belongs at index 1. `soul`'s second\n * positional is a `file` (a long-form identity document, not a manifest), which is why matching on the\n * name matters rather than on the position.\n *\n * The same drift `session-commands.ts` exists to end: a second list describing `COMMANDS` disagrees with\n * it on the first command either one grows. Derived, a new command is covered with nothing to remember.\n */\nfunction manifestIndex(name: string): number {\n return findCommand(name)?.args.findIndex((arg) => arg.name === \"manifest\") ?? -1\n}\n\n/**\n * The argv for a request.\n *\n * Pure and exported so the assembly is testable without starting anything — which matters because\n * getting it wrong means a command runs against the wrong agent, and that is not visible in the output.\n */\nexport function subcommandArgv(request: SubcommandRequest): readonly string[] {\n const rest = request.rest.trim() === \"\" ? [] : request.rest.trim().split(/\\s+/)\n const at = manifestIndex(request.name)\n // Inserted only when everything before it was typed. `/skills` bare would otherwise become\n // `skills <manifestPath>`, putting a path where the action goes — and a command that resolves the\n // agent from the cwd instead is the lesser wrong: it may pick a different agent, where this one\n // cannot run at all. `--plain` stays last, so it cannot be swallowed as a flag's value.\n const positionals =\n at === -1 || rest.length < at\n ? rest\n : [...rest.slice(0, at), request.manifestPath, ...rest.slice(at)]\n return [request.name, ...positionals, \"--plain\"]\n}\n\n/**\n * Why a pane must not run this request, if it must not.\n *\n * A pane captures a child to completion, so a command that never finishes is a pane that shows a spinner\n * until the timeout fires and then reports being killed — thirty seconds of a frozen surface for a flag\n * that worked perfectly at a shell. `daemon logs --follow` is the case: it exists precisely to keep\n * printing until interrupted, and there is nothing for it to be interrupted *by* in here.\n *\n * Refused rather than quietly dropped. Dropping the flag would hand back the tail, which looks like a\n * following command that stopped immediately — a wrong answer that reads as a right one. Keyed off the\n * command's own spec, so a second command that grows a `follow` flag is covered with nothing to remember.\n */\nexport function paneRefusal(request: SubcommandRequest): string | undefined {\n const spec = findCommand(request.name)\n if (spec === undefined) return undefined\n const follow = spec.flags.find((flag) => flag.name === \"follow\")\n if (follow === undefined) return undefined\n const tokens = request.rest.trim().split(/\\s+/)\n const asked = tokens.some(\n (token) =>\n token === \"--follow\" || (follow.short !== undefined && token === `-${follow.short}`),\n )\n if (!asked) return undefined\n return `--follow keeps printing until it is interrupted, and a pane has nothing to interrupt it with. Run it in its own terminal: ${request.name} ${request.rest.trim()}`\n}\n\nexport async function runSubcommand(request: SubcommandRequest): Promise<SubcommandResult> {\n const refusal = paneRefusal(request)\n // Non-zero, because it did not do what was asked. A refusal reported as success is the shape hard\n // rule 8 forbids, whatever the message says.\n if (refusal !== undefined) return { lines: [refusal], code: 1 }\n\n const interpreter = request.interpreter ?? process.execPath\n const script = request.script ?? process.argv[1] ?? \"\"\n const result = await spawnCaptureAsync({\n command: interpreter,\n args: [script, ...subcommandArgv(request)],\n ...(request.env === undefined ? {} : { env: request.env }),\n timeoutMs: request.timeoutMs ?? 30_000,\n })\n\n // stderr is shown, not dropped. A command that failed says why on stderr, and a pane that showed only\n // stdout would render an empty box for the case a person most needs to read.\n const body = [result.stdout, result.stderr].filter((part) => part.trim() !== \"\").join(\"\\n\")\n const lines = body === \"\" ? [] : body.replace(/\\n+$/, \"\").split(\"\\n\")\n if (result.notFound) {\n return { lines: [`could not run ${interpreter}`], code: 1 }\n }\n if (result.signalled) {\n return { lines: [...lines, `${request.name} was stopped before it finished`], code: 1 }\n }\n return { lines, code: result.code }\n}\n"
19
+ "/**\n * Running one of this binary's own commands, for a pane inside a session.\n *\n * ## Why a child process rather than calling the function\n *\n * The obvious implementation is to call `validateCommand()` and swap `process.stdout.write` for a\n * collector. It is also wrong here: Ink *owns* stdout while a session is mounted, and it writes a frame\n * whenever anything re-renders. A frame drawn during the capture window lands in the collector instead of\n * on the terminal — so the screen silently misses a repaint and the pane shows a frame of itself. Nothing\n * errors; the display is just wrong, intermittently, depending on timing.\n *\n * A child writes to its own pipe. Nothing is hijacked, the frame keeps rendering, and the pane shows\n * exactly what the command prints — which is also the honest thing to show, since \"run this command\" is\n * what the palette offered. The cost is process startup, which is the same ~100 ms every command in this\n * CLI already pays and is invisible next to reading the result.\n *\n * `--plain` is forced, for the reason it exists: a child that thought it had a terminal would return\n * escape sequences, and the pane would render them as text.\n */\n\nimport { findCommand } from \"#lib/commands\"\nimport { spawnCaptureAsync } from \"#lib/spawn\"\n\nexport interface SubcommandResult {\n readonly lines: readonly string[]\n readonly code: number\n}\n\nexport interface SubcommandRequest {\n readonly name: string\n /** Arguments as typed after the command word, split on whitespace. */\n readonly rest: string\n /** The agent this session is running, passed to any command that takes a manifest. */\n readonly manifestPath: string\n /** Injected by tests. `process.execPath` and `process.argv[1]` otherwise. */\n readonly interpreter?: string\n readonly script?: string\n readonly env?: Readonly<Record<string, string | undefined>>\n readonly timeoutMs?: number\n}\n\n/**\n * Where this command wants the manifest among its positionals, or `-1` for one that takes none.\n *\n * Read off the command's own spec rather than a hand-kept list, which was wrong in both directions at\n * once. `NO_MANIFEST` held four names: `soul` takes an *action* first and was not listed, so\n * `/soul distill` ran as `soul <manifestPath> distill` and the action became a path — broken in-session\n * for as long as it has been offered there; and `agents` takes a variadic manifest first and *was*\n * listed, so it ran with none at all.\n *\n * It also could not express the real shape. `config` and `memory` take an action and *then* a manifest,\n * so \"prepend or not\" has no right answer for them — the path belongs at index 1. `soul`'s second\n * positional is a `file` (a long-form identity document, not a manifest), which is why matching on the\n * name matters rather than on the position.\n *\n * The same drift `session-commands.ts` exists to end: a second list describing `COMMANDS` disagrees with\n * it on the first command either one grows. Derived, a new command is covered with nothing to remember.\n */\nfunction manifestIndex(name: string): number {\n return findCommand(name)?.args.findIndex((arg) => arg.name === \"manifest\") ?? -1\n}\n\n/**\n * The argv for a request.\n *\n * Pure and exported so the assembly is testable without starting anything — which matters because\n * getting it wrong means a command runs against the wrong agent, and that is not visible in the output.\n */\nexport function subcommandArgv(request: SubcommandRequest): readonly string[] {\n const rest = request.rest.trim() === \"\" ? [] : request.rest.trim().split(/\\s+/)\n const at = manifestIndex(request.name)\n // Inserted only when everything before it was typed. `/skills` bare would otherwise become\n // `skills <manifestPath>`, putting a path where the action goes — and a command that resolves the\n // agent from the cwd instead is the lesser wrong: it may pick a different agent, where this one\n // cannot run at all. `--plain` stays last, so it cannot be swallowed as a flag's value.\n const positionals =\n at === -1 || rest.length < at\n ? rest\n : [...rest.slice(0, at), request.manifestPath, ...rest.slice(at)]\n return [request.name, ...positionals, \"--plain\"]\n}\n\n/**\n * Why a pane must not run this request, if it must not.\n *\n * A pane captures a child to completion, so a command that never finishes is a pane that shows a spinner\n * until the timeout fires and then reports being killed — thirty seconds of a frozen surface for a flag\n * that worked perfectly at a shell. `daemon logs --follow` is the case: it exists precisely to keep\n * printing until interrupted, and there is nothing for it to be interrupted *by* in here.\n *\n * Refused rather than quietly dropped. Dropping the flag would hand back the tail, which looks like a\n * following command that stopped immediately — a wrong answer that reads as a right one. Keyed off the\n * command's own spec, so a second command that grows a `follow` flag is covered with nothing to remember.\n */\nexport function paneRefusal(request: SubcommandRequest): string | undefined {\n const spec = findCommand(request.name)\n if (spec === undefined) return undefined\n const follow = spec.flags.find((flag) => flag.name === \"follow\")\n if (follow === undefined) return undefined\n const tokens = request.rest.trim().split(/\\s+/)\n const asked = tokens.some(\n (token) =>\n token === \"--follow\" || (follow.short !== undefined && token === `-${follow.short}`),\n )\n if (!asked) return undefined\n return `--follow keeps printing until it is interrupted, and a pane has nothing to interrupt it with. Run it in its own terminal: ${request.name} ${request.rest.trim()}`\n}\n\nexport async function runSubcommand(request: SubcommandRequest): Promise<SubcommandResult> {\n const refusal = paneRefusal(request)\n // Non-zero, because it did not do what was asked. A refusal reported as success is the shape hard\n // rule 8 forbids, whatever the message says.\n if (refusal !== undefined) return { lines: [refusal], code: 1 }\n\n // The interpreter and the script that started this process — `node` and `dist/index.js` under\n // the npm install, `bun` and `src/index.ts` from a checkout. `request.interpreter`/`request.script`\n // override, because the tests inject both; an interpreter injected without a script gets an\n // empty one rather than this process's, which would run the wrong program under the fake.\n const interpreter = request.interpreter ?? process.execPath\n const script =\n request.script ?? (request.interpreter !== undefined ? \"\" : (process.argv[1] ?? \"\"))\n const result = await spawnCaptureAsync({\n command: interpreter,\n args: [script, ...subcommandArgv(request)],\n ...(request.env === undefined ? {} : { env: request.env }),\n timeoutMs: request.timeoutMs ?? 30_000,\n })\n\n // stderr is shown, not dropped. A command that failed says why on stderr, and a pane that showed only\n // stdout would render an empty box for the case a person most needs to read.\n const body = [result.stdout, result.stderr].filter((part) => part.trim() !== \"\").join(\"\\n\")\n const lines = body === \"\" ? [] : body.replace(/\\n+$/, \"\").split(\"\\n\")\n if (result.notFound) {\n return { lines: [`could not run ${interpreter}`], code: 1 }\n }\n if (result.signalled) {\n return { lines: [...lines, `${request.name} was stopped before it finished`], code: 1 }\n }\n return { lines, code: result.code }\n}\n"
21
20
  ],
22
- "mappings": ";0rBA2BA,cAAS,UAAK,YAAM,eAAQ,aAC5B,sBAA6B,gBAAa,cAAW,aAAS,eAAQ,cCVtE,cAAS,WAAK,iEAgBP,SAAS,EAAa,EAAG,QAAO,QAAO,SAAQ,UAAS,QAA4B,CACvF,GAAI,IAAU,OACV,OACI,GAEE,GAFF,CAAK,WAAY,EAAjB,SACI,GAAC,GAAD,CAAS,MAAO,WAAW,IAAS,EACtC,EAIV,GAAI,EAAM,SAAW,EACjB,OACI,GAEE,GAFF,CAAK,WAAY,EAAjB,SACI,GAAmD,GAAnD,CAAM,MAAO,EAAM,MAAnB,SAAmD,CAAxB,EAA3B,oBAAmD,EACrD,EAMV,IAAQ,OAAM,MAAO,EACjB,EAAM,OACN,KAAK,IAAI,EAAS,KAAK,MAAM,EAAU,CAAC,EAAG,EAAM,OAAS,CAAC,EAC3D,CACJ,EAEM,EAAU,EAAM,MAAM,EAAM,CAAE,EAAE,IAAI,CAAC,EAAM,KAAQ,CAAE,IAAK,EAAO,EAAI,MAAK,EAAE,EAElF,OACI,GA4BE,GA5BF,CAAK,cAAc,SAAnB,SA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