@sagmans/dsh-tui 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +270 -68
  3. package/lib/agent/present.js +1 -1
  4. package/lib/agent/present.js.map +1 -1
  5. package/lib/agent/prompt-history.d.ts.map +1 -1
  6. package/lib/agent/prompt-history.js +5 -3
  7. package/lib/agent/prompt-history.js.map +1 -1
  8. package/lib/agent/status.d.ts +1 -1
  9. package/lib/cards.d.ts +83 -13
  10. package/lib/cards.d.ts.map +1 -1
  11. package/lib/cards.js +96 -28
  12. package/lib/cards.js.map +1 -1
  13. package/lib/export.d.ts +3 -3
  14. package/lib/export.d.ts.map +1 -1
  15. package/lib/export.js +23 -13
  16. package/lib/export.js.map +1 -1
  17. package/lib/fold-cursor.d.ts +12 -5
  18. package/lib/fold-cursor.d.ts.map +1 -1
  19. package/lib/fold-cursor.js +16 -5
  20. package/lib/fold-cursor.js.map +1 -1
  21. package/lib/gates.d.ts.map +1 -1
  22. package/lib/gates.js +42 -9
  23. package/lib/gates.js.map +1 -1
  24. package/lib/index.d.ts.map +1 -1
  25. package/lib/index.js +459 -72
  26. package/lib/index.js.map +1 -1
  27. package/lib/injection.d.ts +9 -0
  28. package/lib/injection.d.ts.map +1 -0
  29. package/lib/injection.js +128 -0
  30. package/lib/injection.js.map +1 -0
  31. package/lib/input/actions.d.ts +19 -2
  32. package/lib/input/actions.d.ts.map +1 -1
  33. package/lib/input/actions.js +57 -11
  34. package/lib/input/actions.js.map +1 -1
  35. package/lib/input/cancel.d.ts +55 -0
  36. package/lib/input/cancel.d.ts.map +1 -0
  37. package/lib/input/cancel.js +47 -0
  38. package/lib/input/cancel.js.map +1 -0
  39. package/lib/input/completion.d.ts +5 -2
  40. package/lib/input/completion.d.ts.map +1 -1
  41. package/lib/input/completion.js +79 -4
  42. package/lib/input/completion.js.map +1 -1
  43. package/lib/input/file-search.d.ts +105 -0
  44. package/lib/input/file-search.d.ts.map +1 -0
  45. package/lib/input/file-search.js +665 -0
  46. package/lib/input/file-search.js.map +1 -0
  47. package/lib/input/fuzzy.d.ts +42 -0
  48. package/lib/input/fuzzy.d.ts.map +1 -0
  49. package/lib/input/fuzzy.js +289 -0
  50. package/lib/input/fuzzy.js.map +1 -0
  51. package/lib/input/keymap.d.ts +3 -1
  52. package/lib/input/keymap.d.ts.map +1 -1
  53. package/lib/input/keymap.js +14 -3
  54. package/lib/input/keymap.js.map +1 -1
  55. package/lib/input/match.d.ts +12 -4
  56. package/lib/input/match.d.ts.map +1 -1
  57. package/lib/input/match.js +50 -51
  58. package/lib/input/match.js.map +1 -1
  59. package/lib/input/submission.d.ts +10 -0
  60. package/lib/input/submission.d.ts.map +1 -1
  61. package/lib/input/submission.js +7 -6
  62. package/lib/input/submission.js.map +1 -1
  63. package/lib/keys-command.d.ts +19 -3
  64. package/lib/keys-command.d.ts.map +1 -1
  65. package/lib/keys-command.js +34 -31
  66. package/lib/keys-command.js.map +1 -1
  67. package/lib/settings-notice.d.ts +5 -0
  68. package/lib/settings-notice.d.ts.map +1 -1
  69. package/lib/settings-notice.js +9 -7
  70. package/lib/settings-notice.js.map +1 -1
  71. package/lib/stash/paths.d.ts +8 -8
  72. package/lib/stash/paths.d.ts.map +1 -1
  73. package/lib/stash/paths.js +19 -18
  74. package/lib/stash/paths.js.map +1 -1
  75. package/lib/stash/schema.d.ts +11 -12
  76. package/lib/stash/schema.d.ts.map +1 -1
  77. package/lib/stash/schema.js +10 -29
  78. package/lib/stash/schema.js.map +1 -1
  79. package/lib/stash/store.js +10 -10
  80. package/lib/stash/store.js.map +1 -1
  81. package/lib/stash.d.ts +37 -6
  82. package/lib/stash.d.ts.map +1 -1
  83. package/lib/stash.js +93 -36
  84. package/lib/stash.js.map +1 -1
  85. package/lib/terminal/external-editor.d.ts +93 -0
  86. package/lib/terminal/external-editor.d.ts.map +1 -0
  87. package/lib/terminal/external-editor.js +263 -0
  88. package/lib/terminal/external-editor.js.map +1 -0
  89. package/lib/terminal/host-writes.d.ts +39 -0
  90. package/lib/terminal/host-writes.d.ts.map +1 -0
  91. package/lib/terminal/host-writes.js +136 -0
  92. package/lib/terminal/host-writes.js.map +1 -0
  93. package/lib/terminal/signals.d.ts +25 -0
  94. package/lib/terminal/signals.d.ts.map +1 -0
  95. package/lib/terminal/signals.js +39 -0
  96. package/lib/terminal/signals.js.map +1 -0
  97. package/lib/terminal/warning-screen.d.ts +19 -1
  98. package/lib/terminal/warning-screen.d.ts.map +1 -1
  99. package/lib/terminal/warning-screen.js +37 -1
  100. package/lib/terminal/warning-screen.js.map +1 -1
  101. package/lib/terminal-text.d.ts +72 -0
  102. package/lib/terminal-text.d.ts.map +1 -0
  103. package/lib/terminal-text.js +603 -0
  104. package/lib/terminal-text.js.map +1 -0
  105. package/lib/text.d.ts +45 -6
  106. package/lib/text.d.ts.map +1 -1
  107. package/lib/text.js +106 -46
  108. package/lib/text.js.map +1 -1
  109. package/lib/theme-command.d.ts +7 -4
  110. package/lib/theme-command.d.ts.map +1 -1
  111. package/lib/theme-command.js +32 -12
  112. package/lib/theme-command.js.map +1 -1
  113. package/lib/theme-files.d.ts +110 -0
  114. package/lib/theme-files.d.ts.map +1 -0
  115. package/lib/theme-files.js +352 -0
  116. package/lib/theme-files.js.map +1 -0
  117. package/lib/theme-schema.d.ts +121 -0
  118. package/lib/theme-schema.d.ts.map +1 -0
  119. package/lib/theme-schema.js +87 -0
  120. package/lib/theme-schema.js.map +1 -0
  121. package/lib/theme-settings.d.ts +43 -10
  122. package/lib/theme-settings.d.ts.map +1 -1
  123. package/lib/theme-settings.js +103 -43
  124. package/lib/theme-settings.js.map +1 -1
  125. package/lib/theme-tokens.d.ts +39 -7
  126. package/lib/theme-tokens.d.ts.map +1 -1
  127. package/lib/theme-tokens.js +96 -13
  128. package/lib/theme-tokens.js.map +1 -1
  129. package/lib/theme.d.ts +24 -2
  130. package/lib/theme.d.ts.map +1 -1
  131. package/lib/theme.js +49 -6
  132. package/lib/theme.js.map +1 -1
  133. package/lib/tool-display.d.ts +57 -0
  134. package/lib/tool-display.d.ts.map +1 -0
  135. package/lib/tool-display.js +51 -0
  136. package/lib/tool-display.js.map +1 -0
  137. package/lib/transcript.d.ts +28 -0
  138. package/lib/transcript.d.ts.map +1 -1
  139. package/lib/transcript.js +126 -37
  140. package/lib/transcript.js.map +1 -1
  141. package/lib/ui/diff.d.ts +49 -0
  142. package/lib/ui/diff.d.ts.map +1 -0
  143. package/lib/ui/diff.js +208 -0
  144. package/lib/ui/diff.js.map +1 -0
  145. package/lib/ui/dock.d.ts.map +1 -1
  146. package/lib/ui/dock.js +9 -6
  147. package/lib/ui/dock.js.map +1 -1
  148. package/lib/ui/editor.d.ts.map +1 -1
  149. package/lib/ui/editor.js +4 -2
  150. package/lib/ui/editor.js.map +1 -1
  151. package/lib/ui/frame.d.ts +16 -5
  152. package/lib/ui/frame.d.ts.map +1 -1
  153. package/lib/ui/frame.js +32 -13
  154. package/lib/ui/frame.js.map +1 -1
  155. package/lib/ui/keymap-picker.d.ts +16 -0
  156. package/lib/ui/keymap-picker.d.ts.map +1 -0
  157. package/lib/ui/keymap-picker.js +41 -0
  158. package/lib/ui/keymap-picker.js.map +1 -0
  159. package/lib/ui/layout.d.ts +33 -0
  160. package/lib/ui/layout.d.ts.map +1 -0
  161. package/lib/ui/layout.js +33 -0
  162. package/lib/ui/layout.js.map +1 -0
  163. package/lib/ui/markdown.d.ts +25 -3
  164. package/lib/ui/markdown.d.ts.map +1 -1
  165. package/lib/ui/markdown.js +12 -8
  166. package/lib/ui/markdown.js.map +1 -1
  167. package/lib/ui/picker-card.d.ts +42 -0
  168. package/lib/ui/picker-card.d.ts.map +1 -0
  169. package/lib/ui/picker-card.js +148 -0
  170. package/lib/ui/picker-card.js.map +1 -0
  171. package/lib/ui/picker.d.ts +40 -2
  172. package/lib/ui/picker.d.ts.map +1 -1
  173. package/lib/ui/picker.js +50 -6
  174. package/lib/ui/picker.js.map +1 -1
  175. package/lib/ui/prompt.d.ts +10 -2
  176. package/lib/ui/prompt.d.ts.map +1 -1
  177. package/lib/ui/prompt.js +21 -2
  178. package/lib/ui/prompt.js.map +1 -1
  179. package/lib/ui/rows.d.ts +8 -6
  180. package/lib/ui/rows.d.ts.map +1 -1
  181. package/lib/ui/rows.js +10 -18
  182. package/lib/ui/rows.js.map +1 -1
  183. package/lib/ui/stash-picker.d.ts +2 -2
  184. package/lib/ui/stash-picker.d.ts.map +1 -1
  185. package/lib/ui/stash-picker.js +4 -4
  186. package/lib/ui/stash-picker.js.map +1 -1
  187. package/lib/ui/status.d.ts.map +1 -1
  188. package/lib/ui/status.js +18 -16
  189. package/lib/ui/status.js.map +1 -1
  190. package/lib/ui/theme-picker.d.ts +18 -0
  191. package/lib/ui/theme-picker.d.ts.map +1 -0
  192. package/lib/ui/theme-picker.js +68 -0
  193. package/lib/ui/theme-picker.js.map +1 -0
  194. package/lib/ui/view.d.ts +146 -22
  195. package/lib/ui/view.d.ts.map +1 -1
  196. package/lib/ui/view.js +461 -154
  197. package/lib/ui/view.js.map +1 -1
  198. package/package.json +3 -1
  199. package/themes/deepseek-blue.yaml +183 -0
  200. package/themes/violet-orbit.yaml +178 -0
@@ -30,7 +30,7 @@ export function stashLabel(text) {
30
30
  return line.length <= LABEL_LENGTH ? line : `${line.slice(0, LABEL_LENGTH - 1)}${ELLIPSIS}`;
31
31
  }
32
32
  /**
33
- * The drafts of one working directory, chosen by key press.
33
+ * The drafts of one session, chosen by key press.
34
34
  *
35
35
  * The id a pick settles on is the entry id, so a pop survives the list being
36
36
  * re-read while it is open and can never take the wrong draft after a concurrent
@@ -39,8 +39,8 @@ export function stashLabel(text) {
39
39
  * it into something a reader could type and miss.
40
40
  */
41
41
  export class StashPicker extends ListPicker {
42
- constructor(entries, cwdLabel, keys, now = () => Date.now()) {
43
- super(() => entries, () => `stash · ${cwdLabel} · ${entries.length} draft${entries.length === 1 ? '' : 's'}`, row => row.entry.id, (row) => ({
42
+ constructor(entries, sessionLabel, keys, now = () => Date.now()) {
43
+ super(() => entries, () => `stash · ${sessionLabel} · ${entries.length} draft${entries.length === 1 ? '' : 's'}`, row => row.entry.id, (row) => ({
44
44
  label: `[${row.index}] ${stashLabel(row.entry.text)}`,
45
45
  description: describeAge(row.entry.createdAt, now()),
46
46
  // The card marks the row under the cursor, which the list decides.
@@ -72,7 +72,7 @@ export class StashConfirmPicker extends ListPicker {
72
72
  description: 'remove them permanently',
73
73
  },
74
74
  ];
75
- super(() => choices, () => `clear stash · ${count} draft${count === 1 ? '' : 's'} in this directory`, choice => choice.id, (choice) => ({ label: choice.label, description: choice.description, current: false }), choice => choice.label, stashHints(keys, 'confirm'), keys);
75
+ super(() => choices, () => `clear stash · ${count} draft${count === 1 ? '' : 's'} in this session`, choice => choice.id, (choice) => ({ label: choice.label, description: choice.description, current: false }), choice => choice.label, stashHints(keys, 'confirm'), keys);
76
76
  }
77
77
  }
78
78
  //# sourceMappingURL=stash-picker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stash-picker.js","sourceRoot":"","sources":["../../src/ui/stash-picker.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAe,MAAM,qBAAqB,CAAA;AACrE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAoC,MAAM,aAAa,CAAA;AAEvF,6DAA6D;AAC7D,MAAM,YAAY,GAAG,EAAE,CAAA;AACvB,qFAAqF;AACrF,MAAM,WAAW,GAAG,eAAe,CAAA;AACnC,MAAM,QAAQ,GAAG,GAAG,CAAA;AAEpB;;;;;GAKG;AACH,SAAS,UAAU,CAAC,IAAkB,EAAE,IAAY;IAClD,OAAO;QACL,KAAK,EAAE,GAAG,EAAE,CAAC,0CAA0C,QAAQ,CAAC,IAAI,EAAE,EAAE,eAAe,CAAC,SAAS;QACjG,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,EAAE,WAAW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AAM,GAAG,SAAS,CAAA;IACtC,4EAA4E;IAC5E,QAAQ,CAAC,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAA;IAChD,yEAAyE;IACzE,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAA;IACzC,6EAA6E;IAC7E,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACrC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;CAClC;AAwBD,wFAAwF;AAExF;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAQxE;AAOD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,MAAM,CAiDvF;AAsCD,yDAAyD;AACzD,qBAAa,SAAU,YAAW,SAAS;IAEvC,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,KAAK;gBADL,KAAK,EAAE,MAAM,WAAW,EACxB,KAAK,EAAE,QAAQ;IAGlC,UAAU,IAAI,IAAI;IAIlB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;CAGhC"}
package/lib/ui/status.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { visibleWidth } from '@earendil-works/pi-tui';
2
- import { displayText } from "../text.js";
2
+ import { oneRow } from "../text.js";
3
+ import { renderTerminalText } from "../terminal-text.js";
3
4
  import { formatTokens } from "../tokens.js";
4
5
  const SECOND_MS = 1000;
5
6
  const MINUTE_MS = 60 * SECOND_MS;
@@ -47,15 +48,14 @@ function elapsed(ms) {
47
48
  export function formatStatus(facts, width, theme) {
48
49
  const segments = [];
49
50
  /**
50
- * Content is escaped as it is collected, and styling is applied only after the
51
- * row has been cut to width. Styling earlier would put generated control
52
- * characters in reach of `displayText`, which exists to make control
53
- * characters visible, so a segment would print its own colour as text.
51
+ * A segment is collected as its source wrote it and drawn when the row is
52
+ * assembled: a sequence has to be read before its width is measured, and the
53
+ * column it starts at is only known while the row is being built.
54
54
  */
55
55
  const push = (token, text, join = false) => {
56
56
  if (!theme.visible(token))
57
57
  return;
58
- segments.push({ token, text: displayText(text), join });
58
+ segments.push({ token, text, join });
59
59
  };
60
60
  // An armed chord is transient and needs the reader's eye now, so it leads the
61
61
  // row: a row cut to width loses its tail, never what is about to happen.
@@ -101,15 +101,17 @@ export function formatStatus(facts, width, theme) {
101
101
  if (facts.cacheRate !== undefined)
102
102
  push('status.cache', `cache ${Math.round(facts.cacheRate * 100)}%`);
103
103
  push('status.cwd', shortPath(facts.cwd, facts.home));
104
- return renderSegments(segments, width, theme);
104
+ // The row is one row whatever a fact carried: a break that survived the cut
105
+ // would be written as a move down, over the row beneath the bar.
106
+ return oneRow(renderSegments(segments, width, theme));
105
107
  }
106
108
  /**
107
- * Join styled segments into one row, cutting it to width first.
109
+ * Join drawn segments into one row, giving each the room the row has left.
108
110
  *
109
- * The cut runs on unstyled text so it can never land inside a style and leave
110
- * one open, and each segment is trimmed to the room left rather than dropped:
111
- * a reader loses the tail of the last fact, not the fact, and the ellipsis
112
- * still says that something was left out.
111
+ * Each segment is drawn first and measured after, because a sequence is not a
112
+ * column and a tab lands on the stop its own starting column reaches. A segment
113
+ * is trimmed to the room left rather than dropped: a reader loses the tail of
114
+ * the last fact, not the fact, and the ellipsis still says something was left out.
113
115
  */
114
116
  function renderSegments(segments, width, theme) {
115
117
  // Hiding the separator means drawing no separator, not drawing a plain one:
@@ -127,14 +129,14 @@ function renderSegments(segments, width, theme) {
127
129
  if (budget - lead < ellipsisWidth)
128
130
  break;
129
131
  const room = budget - lead;
130
- const textWidth = visibleWidth(segment.text);
132
+ const drawn = theme.rich(segment.text, { token: segment.token, column: width - budget });
133
+ const textWidth = visibleWidth(drawn);
131
134
  if (textWidth > room) {
132
135
  // Not the last segment: the rest is omitted, so the row must show it.
133
- const cut = theme.cut(segment.text, room, ELLIPSIS);
134
- out += `${lead > 0 ? separator : ''}${theme.style(segment.token, cut)}`;
136
+ out += `${lead > 0 ? separator : ''}${theme.cut(drawn, room, ELLIPSIS)}`;
135
137
  return out;
136
138
  }
137
- out += `${lead > 0 ? separator : ''}${theme.style(segment.token, segment.text)}`;
139
+ out += `${lead > 0 ? separator : ''}${drawn}`;
138
140
  budget -= lead + textWidth;
139
141
  }
140
142
  return out === '' ? theme.cut('', Math.max(0, width), ELLIPSIS) : out;
@@ -1 +1 @@
1
- {"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/ui/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,YAAY,EAAE,MAAM,wBAAwB,CAAA;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAkC3C,MAAM,SAAS,GAAG,IAAI,CAAA;AACtB,MAAM,SAAS,GAAG,EAAE,GAAG,SAAS,CAAA;AAChC,iGAAiG;AACjG,MAAM,aAAa,GAAG,CAAC,CAAA;AACvB,kEAAkE;AAClE,MAAM,cAAc,GAAG,KAAK,CAAA;AAC5B,sFAAsF;AACtF,MAAM,QAAQ,GAAG,GAAG,CAAA;AACpB,wEAAwE;AACxE,MAAM,YAAY,GAAG,GAAG,CAAA;AACxB,MAAM,UAAU,GAAG,GAAG,CAAA;AACtB,yFAAyF;AACzF,MAAM,WAAW,GAAG,OAAO,CAAA;AAU3B,wFAAwF;AAExF;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,IAAwB;IAC9D,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,EAAE,IAAI,CAAC,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC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C,GAAG,CAAA;AACvE,CAAC;AAED,yDAAyD;AACzD,MAAM,OAAO,SAAS;IAED;IACA;IAFnB,YACmB,KAAwB,EACxB,KAAe;QADf,UAAK,GAAL,KAAK,CAAmB;QACxB,UAAK,GAAL,KAAK,CAAU;IAC/B,CAAC;IAEJ,UAAU;QACR,yDAAyD;IAC3D,CAAC;IAED,MAAM,CAAC,KAAa;QAClB,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;IAC1E,CAAC;CACF"}
@@ -0,0 +1,18 @@
1
+ import { type Keymap } from '../input/actions.ts';
2
+ import { type LoadedTheme, type ThemeLibrary } from '../theme-files.ts';
3
+ import { ListPicker } from './picker.ts';
4
+ /**
5
+ * The themes on disk, chosen by key press.
6
+ *
7
+ * Choosing a theme is a comparison, and a name does not carry the shades it
8
+ * stands for, so the row under the cursor is handed back as it moves: the caller
9
+ * paints the surface with it and writes nothing, which is what makes the list
10
+ * itself the preview. The library is re-read per paint, so a theme exported or
11
+ * edited while the list is open appears in it without reopening.
12
+ */
13
+ export declare class ThemePicker extends ListPicker<LoadedTheme> {
14
+ constructor(library: () => ThemeLibrary, chosen: () => string | undefined, keys: () => Keymap,
15
+ /** The theme to show, or undefined to show the one the document names again. */
16
+ preview: (theme: LoadedTheme | undefined) => void);
17
+ }
18
+ //# sourceMappingURL=theme-picker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-picker.d.ts","sourceRoot":"","sources":["../../src/ui/theme-picker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAA;AACrE,OAAO,EAAiB,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACtF,OAAO,EAAE,UAAU,EAAoC,MAAM,aAAa,CAAA;AAgD1E;;;;;;;;GAQG;AACH,qBAAa,WAAY,SAAQ,UAAU,CAAC,WAAW,CAAC;gBAEpD,OAAO,EAAE,MAAM,YAAY,EAC3B,MAAM,EAAE,MAAM,MAAM,GAAG,SAAS,EAChC,IAAI,EAAE,MAAM,MAAM;IAClB,gFAAgF;IAChF,OAAO,EAAE,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,KAAK,IAAI;CAkBpD"}
@@ -0,0 +1,68 @@
1
+ import { hintKeys, moveHint } from "../input/actions.js";
2
+ import { DEFAULT_THEME } from "../theme-files.js";
3
+ import { ListPicker } from "./picker.js";
4
+ /**
5
+ * The themes to choose from, the one in force first.
6
+ *
7
+ * The row under the cursor is what the screen is painting, so the list opens on
8
+ * the theme already in use: a preview starting anywhere else would repaint the
9
+ * surface the moment the reader asked to see the list, and the top row would name
10
+ * a theme they are not looking at.
11
+ */
12
+ function orderedThemes(library, inUse) {
13
+ const themes = library.list();
14
+ return [
15
+ ...themes.filter(theme => theme.name === inUse),
16
+ ...themes.filter(theme => theme.name !== inUse),
17
+ ];
18
+ }
19
+ /**
20
+ * One theme as a row.
21
+ *
22
+ * The count is of the elements the file names, not of the elements it changes: a
23
+ * theme writes out its whole table, and one that names fewer leaves the rest to
24
+ * the table underneath — which is the difference between two files that their
25
+ * names alone do not show.
26
+ */
27
+ function describeTheme(theme, inUse) {
28
+ const elements = Object.keys(theme.tokens).length;
29
+ return {
30
+ label: theme.name,
31
+ description: [
32
+ theme.builtin ? 'built into the package' : 'yours',
33
+ `${elements} element${elements === 1 ? '' : 's'}`,
34
+ theme.name === inUse ? 'in use' : undefined,
35
+ ].filter(part => part !== undefined).join(' · '),
36
+ // The card marks the row under the cursor, which the list decides.
37
+ current: false,
38
+ };
39
+ }
40
+ /** What the list says about its own keys, read per paint so a rebind lands. */
41
+ function themeHints(keys) {
42
+ return {
43
+ empty: () => `nothing matches · backspace to widen · ${hintKeys(keys(), 'picker.cancel')} cancel`,
44
+ listed: () => `${moveHint(keys(), 'picker.up', 'picker.down')} preview · ${hintKeys(keys(), 'picker.confirm')} apply · ${hintKeys(keys(), 'picker.cancel')} cancel · type to filter`,
45
+ };
46
+ }
47
+ /**
48
+ * The themes on disk, chosen by key press.
49
+ *
50
+ * Choosing a theme is a comparison, and a name does not carry the shades it
51
+ * stands for, so the row under the cursor is handed back as it moves: the caller
52
+ * paints the surface with it and writes nothing, which is what makes the list
53
+ * itself the preview. The library is re-read per paint, so a theme exported or
54
+ * edited while the list is open appears in it without reopening.
55
+ */
56
+ export class ThemePicker extends ListPicker {
57
+ constructor(library, chosen, keys,
58
+ /** The theme to show, or undefined to show the one the document names again. */
59
+ preview) {
60
+ // A document naming no theme is a surface drawing the package's own, so the
61
+ // row the cursor starts on and the screen agree whichever way it was left.
62
+ const inUse = () => chosen() ?? DEFAULT_THEME;
63
+ super(() => orderedThemes(library(), inUse()), () => `theme · ${library().list().length} available`, theme => theme.name, theme => describeTheme(theme, inUse()), theme => [theme.name, theme.builtin ? 'built into the package' : 'yours'].join(' '), themeHints(keys), keys,
64
+ // Opened unfiltered: the reader asked for the list, not for a search.
65
+ '', preview);
66
+ }
67
+ }
68
+ //# sourceMappingURL=theme-picker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-picker.js","sourceRoot":"","sources":["../../src/ui/theme-picker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAe,MAAM,qBAAqB,CAAA;AACrE,OAAO,EAAE,aAAa,EAAuC,MAAM,mBAAmB,CAAA;AACtF,OAAO,EAAE,UAAU,EAAoC,MAAM,aAAa,CAAA;AAE1E;;;;;;;GAOG;AACH,SAAS,aAAa,CAAC,OAAqB,EAAE,KAAa;IACzD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAA;IAC7B,OAAO;QACL,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC;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,IAAkB;IAClB,gFAAgF;IAChF,OAAiD;QAEjD,4EAA4E;QAC5E,2EAA2E;QAC3E,MAAM,KAAK,GAAG,GAAW,EAAE,CAAC,MAAM,EAAE,IAAI,aAAa,CAAA;QACrD,KAAK,CACH,GAAG,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,EACvC,GAAG,EAAE,CAAC,WAAW,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,MAAM,YAAY,EACpD,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,EACnB,KAAK,CAAC,EAAE,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,EACtC,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EACnF,UAAU,CAAC,IAAI,CAAC,EAChB,IAAI;QACJ,sEAAsE;QACtE,EAAE,EACF,OAAO,CACR,CAAA;IACH,CAAC;CACF"}
package/lib/ui/view.d.ts CHANGED
@@ -1,12 +1,13 @@
1
- import { type Component } from '@earendil-works/pi-tui';
1
+ import { type Component, type TuiMouseEvent, type TuiMouseEventResult } from '@earendil-works/pi-tui';
2
2
  import { type Keymap } from '../input/actions.ts';
3
3
  import { type GateCard } from '../gates.ts';
4
4
  import type { TranscriptEntry, TranscriptModel } from '../transcript.ts';
5
+ import { type ToolDisplaySpec } from '../tool-display.ts';
5
6
  import type { TuiTheme } from '../theme.ts';
6
- import type { MarkdownRenderer } from './markdown.ts';
7
+ import { type MarkdownRenderer } from './markdown.ts';
7
8
  import type { PickerCard } from './picker.ts';
8
- import { RowCache } from './rows.ts';
9
- /** Which rows the reader has opened; one key decides for every row of a kind. */
9
+ import { RowCache, type RowCacheStats } from './rows.ts';
10
+ /** Which rows the reader has opened by key; a click decides for one message instead. */
10
11
  export interface ViewState {
11
12
  readonly expandCards: boolean;
12
13
  readonly expandReasoning: boolean;
@@ -16,10 +17,10 @@ export interface ViewState {
16
17
  /**
17
18
  * The state a reader gets before opening anything, and the view's own fallback.
18
19
  *
19
- * Cards and thoughts start folded because either can be long enough to push the
20
- * answer off the screen. A program's calls are the opposite case: one clipped
21
- * line each, under a header that already names them, so folding them costs a
22
- * reader the very thing the card stands for.
20
+ * Thoughts start folded because they can be long enough to push the answer off
21
+ * the screen. Cards and a program's calls start from the reader's own `tools:`
22
+ * settings, which ship folded for cards — one clipped line each — and inline for
23
+ * a program's calls, whose one line per dispatch is what the card stands for.
23
24
  */
24
25
  export declare const DEFAULT_VIEW_STATE: ViewState;
25
26
  /**
@@ -45,6 +46,13 @@ export interface TranscriptViewOptions {
45
46
  * a settings edit moved the key.
46
47
  */
47
48
  readonly keys?: () => Keymap;
49
+ /**
50
+ * How one tool's cards draw, read per render.
51
+ *
52
+ * The settings document is hot-reloaded, so a captured table would keep
53
+ * folding a session under the policy it happened to start with.
54
+ */
55
+ readonly toolDisplay?: (tool: string) => ToolDisplaySpec;
48
56
  }
49
57
  export declare class TranscriptView implements Component {
50
58
  private readonly model;
@@ -52,16 +60,56 @@ export declare class TranscriptView implements Component {
52
60
  private readonly markdown;
53
61
  private readonly options;
54
62
  private readonly rows;
63
+ /**
64
+ * Fold choices the reader made by clicking, per message.
65
+ *
66
+ * Absent means the key or the tool's own policy decides, so a settings edit
67
+ * stays in charge of messages nobody clicked. Keyed by the call or thought id
68
+ * rather than by the entry, because a result replaces the entry a click was
69
+ * made on and a thought outlives the live row that streamed it.
70
+ */
71
+ private readonly clicked;
72
+ /** The rows each clickable message drew last render, for mapping a click back to it. */
73
+ private spans;
74
+ /** The same spans relative to their entry, so a cached entry still answers clicks. */
75
+ private readonly entrySpans;
55
76
  constructor(model: TranscriptModel, theme: TuiTheme, markdown: MarkdownRenderer, options?: TranscriptViewOptions);
56
77
  private get viewState();
78
+ /** The display the reader configured for a tool, or the shipped one. */
79
+ private toolDisplay;
80
+ /**
81
+ * Whether one tool message draws open.
82
+ *
83
+ * A click outranks the key, which outranks the tool's start state: Ctrl+O
84
+ * stays "show me everything", while one clicked message keeps the state the
85
+ * reader gave it.
86
+ */
87
+ private expansionOf;
88
+ /** Whether one thought draws its body; a click decides for that thought alone. */
89
+ private reasoningOpen;
90
+ /** Whether one dispatched call draws its argument in full; a click decides for that call. */
91
+ private subCallOpen;
92
+ /**
93
+ * Answer a click on a message by folding or unfolding that one row.
94
+ *
95
+ * The tightest span under the point wins, so a click on a dispatched call
96
+ * opens that call rather than the card around it. Only a left click is
97
+ * consumed: a press, a drag, and a wheel belong to the surface's own
98
+ * selection and scrolling, and a row that swallowed them would cost the
99
+ * reader the ability to copy the command it just drew.
100
+ */
101
+ handleMouse(event: TuiMouseEvent): TuiMouseEventResult | undefined;
57
102
  /** The cache's own account of the work it avoided; a test reads this. */
58
- rowStats(): {
59
- readonly hits: number;
60
- readonly misses: number;
61
- readonly size: number;
62
- };
103
+ rowStats(): RowCacheStats;
63
104
  invalidate(): void;
64
- /** Wrap one text block under a prefix, keeping the prefix's column budget. */
105
+ /**
106
+ * Wrap one text block under a prefix, keeping the prefix's column budget.
107
+ *
108
+ * The block is drawn before it is wrapped: a sequence a terminal would have
109
+ * acted on has to be gone before pi-tui measures the row, and a tab has to
110
+ * land on the stop the writer saw rather than one a wrapper would guess at.
111
+ * The prefix seeds that stop, because it is already on the row.
112
+ */
65
113
  private pushWrapped;
66
114
  /**
67
115
  * Wrap one already-styled block under a prefix.
@@ -73,8 +121,40 @@ export declare class TranscriptView implements Component {
73
121
  * command is worse than a taller card.
74
122
  */
75
123
  private pushStyledWrapped;
76
- /** Render assistant text as markdown: the model writes structure, the reader reads it. */
124
+ /**
125
+ * The rows one markdown message draws, with the padding pi-tui adds for background styling removed.
126
+ *
127
+ * The source is drawn first so the markdown renderer never measures a sequence
128
+ * it cannot see; its own spans are applied around the result afterwards.
129
+ */
130
+ private markdownLines;
131
+ /**
132
+ * Render one message's text as markdown.
133
+ *
134
+ * A thought passes its own face and an indent, so the row stays visibly a
135
+ * detail of the step that produced it rather than a second answer.
136
+ */
77
137
  private pushMarkdown;
138
+ /**
139
+ * One message closed into a frame, with its markdown laid out to what is left inside.
140
+ *
141
+ * A prompt and a reply are the two objects of an exchange, so both are drawn as
142
+ * bars rather than as one more stretch of rows; the face, the border's element,
143
+ * and whether the text is still arriving are the only differences. Markdown lays
144
+ * itself out to the frame's text width, so the frame may only place the rows:
145
+ * wrapping them again would break what it drew.
146
+ */
147
+ private pushFramed;
148
+ /**
149
+ * The face a thought is drawn in.
150
+ *
151
+ * Its shade stays the thought body's and it asks for no drawing: a diagram in
152
+ * the middle of a thought would carry the answer's weight, and the answer's
153
+ * colours would make the thinking compete with it.
154
+ */
155
+ private reasoningFace;
156
+ /** The face a submitted prompt is drawn in: its structure is markdown's, its shade stays the prompt's. */
157
+ private userFace;
78
158
  /** The live map, or the shipped one for a caller that did not lend one. */
79
159
  private keymap;
80
160
  private reasoningFoldHint;
@@ -84,21 +164,65 @@ export declare class TranscriptView implements Component {
84
164
  * The calls one card dispatched, one entry each.
85
165
  *
86
166
  * A nested call is a signpost rather than a card of its own, so it keeps one
87
- * entry per call; a long argument still wraps under that entry rather than
88
- * being cut, because the argument is the part a reader scans for and a
89
- * silently shortened path reads as the one that ran.
167
+ * entry per call, clipped to that entry until the reader clicks it: the
168
+ * argument is the part a reader scans for, and one that always wrapped pushed
169
+ * the rest of the program off the screen.
90
170
  */
91
171
  private pushSubCalls;
172
+ /**
173
+ * What a dispatched call declared and what it produced, under its argument.
174
+ *
175
+ * The parent card keeps only the program's return value, so both are otherwise
176
+ * gone; a reader who opens the row is asking for them, which is why the call's
177
+ * own rows come first and its outcome under them. Each section keeps the
178
+ * retention its card used, so a long run still says what it dropped.
179
+ */
180
+ private pushSubCallOutput;
181
+ /**
182
+ * A folded card's one row: label, clipped argument, measured facts, outcome.
183
+ *
184
+ * The outcome rides this row rather than a row of its own, because one line
185
+ * per call is what folding promises. A shell card's hidden rows are counted
186
+ * here too: its output is the answer the reader asked for, and a fold that
187
+ * left no trace of it would read as a call that produced nothing.
188
+ *
189
+ * The argument is the part that gives up room: it is clipped to whatever the
190
+ * label, the facts, and the outcome leave before the edge, so a wide terminal
191
+ * shows more of the call while a narrow one still shows how it ended.
192
+ */
193
+ private renderCollapsedHead;
194
+ /**
195
+ * One detail row, drawn with its own kind's colours or nothing at all.
196
+ *
197
+ * The row says what it is, so the renderer never guesses from the text: a diff
198
+ * line beginning with "+" is an addition because the presenter said so, not
199
+ * because of its first character.
200
+ */
201
+ private detailRow;
202
+ /** The mark that introduces a card, empty when the theme hides its label. */
203
+ private cardLead;
204
+ /** A card's label, styled, or nothing when the theme hides it. */
205
+ private cardTitle;
206
+ /** A card's argument, styled and flattened, clipped to `limit` when one is given. */
207
+ private cardArgument;
92
208
  /**
93
209
  * A card's header: its label, its argument, and its measured facts.
94
210
  *
95
211
  * The glyph is returned apart from the body so a wrapped continuation can
96
- * align under the label rather than under the mark. A terminal's argument is
97
- * left out because it needs a row of its own — it is the one argument that can
98
- * be a whole command rather than a word.
212
+ * align under the label rather than under the mark. An opened terminal's
213
+ * argument is left out because it needs a row of its own — it is the one
214
+ * argument that can be a whole command rather than a word.
99
215
  */
100
216
  private renderHead;
101
- /** The measured facts, each in its own colour, or nothing when none is visible. */
217
+ /** The separator a header uses between its label, its facts, and its outcome. */
218
+ private statSeparator;
219
+ /**
220
+ * The measured facts, each in its own colour, or nothing when none is visible.
221
+ *
222
+ * The lead is a parameter because a header that already carries a title and an
223
+ * argument separates its facts with the same mark as its outcome, while facts
224
+ * on a row of their own stand apart with blank columns.
225
+ */
102
226
  private renderStats;
103
227
  private pushPicker;
104
228
  private pushGate;
@@ -1 +1 @@
1
- {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/ui/view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAkC,MAAM,wBAAwB,CAAA;AAEvF,OAA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