@linxiraos/pi-tui 1.4.11 → 1.4.13

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 (265) hide show
  1. package/CHANGELOG.md +30 -233
  2. package/README.md +4 -1
  3. package/THIRD-PARTY-NOTICES.txt +4 -5
  4. package/dist/types/apps/shell-visualizer.d.ts +24 -0
  5. package/dist/types/autocomplete.d.ts +20 -0
  6. package/dist/types/chat/cache-invalidation-marker.d.ts +15 -7
  7. package/dist/types/chat/chat-transcript-builder.d.ts +5 -3
  8. package/dist/types/chat/display-preferences.d.ts +2 -0
  9. package/dist/types/chat/extension-types.d.ts +72 -1
  10. package/dist/types/chat/image-loading.d.ts +2 -2
  11. package/dist/types/chat/messages.d.ts +2 -3
  12. package/dist/types/chat/read-tool-group.d.ts +15 -2
  13. package/dist/types/chat/skill-message.d.ts +1 -0
  14. package/dist/types/chat/spotlight.d.ts +203 -0
  15. package/dist/types/chat/tool-execution.d.ts +26 -5
  16. package/dist/types/chat/transcript-actions.d.ts +11 -0
  17. package/dist/types/chat/transcript-browser.d.ts +9 -0
  18. package/dist/types/chat/transcript-presentation.d.ts +164 -0
  19. package/dist/types/chat/ttsr-notification.d.ts +2 -0
  20. package/dist/types/chrome/message-frame.d.ts +2 -0
  21. package/dist/types/chrome/transcript-container.d.ts +27 -6
  22. package/dist/types/components/loader.d.ts +0 -2
  23. package/dist/types/components/markdown.d.ts +11 -1
  24. package/dist/types/components/settings-list.d.ts +12 -2
  25. package/dist/types/frame-rate.d.ts +18 -0
  26. package/dist/types/hotkeys-markdown.d.ts +2 -0
  27. package/dist/types/index.d.ts +3 -0
  28. package/dist/types/keybinding-matchers.d.ts +4 -1
  29. package/dist/types/kitty-graphics.d.ts +1 -1
  30. package/dist/types/motion-effects.d.ts +10 -0
  31. package/dist/types/native/encode.d.ts +2 -0
  32. package/dist/types/native/measure.d.ts +10 -0
  33. package/dist/types/native/overlay.d.ts +1 -1
  34. package/dist/types/native/quiet.d.ts +5 -0
  35. package/dist/types/native/reconcile.d.ts +6 -1
  36. package/dist/types/native/spans.d.ts +6 -0
  37. package/dist/types/native/state.d.ts +4 -0
  38. package/dist/types/overlays/agent-hub.d.ts +6 -0
  39. package/dist/types/overlays/link-browser.d.ts +55 -0
  40. package/dist/types/overlays/running-subagent-badge.d.ts +1 -4
  41. package/dist/types/overlays/spotlight-sheet.d.ts +36 -0
  42. package/dist/types/prompt/composer-attachments.d.ts +5 -2
  43. package/dist/types/prompt/composer-cache.d.ts +7 -2
  44. package/dist/types/prompt/composer.d.ts +6 -11
  45. package/dist/types/prompt/custom-editor.d.ts +8 -2
  46. package/dist/types/prompt/gradient-highlight.d.ts +2 -2
  47. package/dist/types/prompt/magic-keywords.d.ts +2 -0
  48. package/dist/types/prompt/model-mention-autocomplete.d.ts +9 -7
  49. package/dist/types/prompt/model-mention-syntax.d.ts +6 -0
  50. package/dist/types/prompt/prompt-action-autocomplete.d.ts +2 -1
  51. package/dist/types/prompt/welcome.d.ts +19 -0
  52. package/dist/types/render/extension-links.d.ts +0 -6
  53. package/dist/types/render/index.d.ts +1 -0
  54. package/dist/types/render/link-hints.d.ts +78 -0
  55. package/dist/types/render/render-utils.d.ts +0 -2
  56. package/dist/types/setup/scenes/types.d.ts +8 -0
  57. package/dist/types/setup/scenes/updates.d.ts +6 -0
  58. package/dist/types/setup/wizard.d.ts +7 -2
  59. package/dist/types/spinner-clock.d.ts +34 -0
  60. package/dist/types/status-line/component.d.ts +8 -4
  61. package/dist/types/status-line/host.d.ts +62 -0
  62. package/dist/types/status-line/index.d.ts +1 -0
  63. package/dist/types/status-line/prompt-cache.d.ts +14 -0
  64. package/dist/types/status-line/schema.d.ts +1 -1
  65. package/dist/types/status-line/startup.d.ts +6 -0
  66. package/dist/types/status-line/types.d.ts +8 -21
  67. package/dist/types/theme/schema.d.ts +28 -1
  68. package/dist/types/theme/symbols.d.ts +1 -1
  69. package/dist/types/theme/theme-class.d.ts +12 -2
  70. package/dist/types/theme/theme.d.ts +1 -1
  71. package/dist/types/theme/tui-adapters.d.ts +7 -0
  72. package/dist/types/thinking.d.ts +12 -0
  73. package/dist/types/tools/ask.d.ts +1 -1
  74. package/dist/types/tools/bash.d.ts +21 -0
  75. package/dist/types/tools/find.d.ts +9 -1
  76. package/dist/types/tools/grep.d.ts +2 -1
  77. package/dist/types/tools/grouped-file-output.d.ts +17 -0
  78. package/dist/types/tools/job-widget.d.ts +2 -2
  79. package/dist/types/tools/lsp.d.ts +4 -2
  80. package/dist/types/tools/native-view.d.ts +4 -0
  81. package/dist/types/tools/renderer.d.ts +9 -1
  82. package/dist/types/tools/shell-trace.d.ts +10 -0
  83. package/dist/types/tools/shell-viz-render.d.ts +6 -0
  84. package/dist/types/tools/shell-viz.d.ts +16 -0
  85. package/dist/types/tools/wait.d.ts +2 -2
  86. package/dist/types/tools/web-search-types.d.ts +1 -0
  87. package/dist/types/tools/write.d.ts +2 -0
  88. package/dist/types/tui.d.ts +15 -1
  89. package/package.json +15 -11
  90. package/src/apps/shell-visualizer.d.ts +24 -0
  91. package/src/apps/shell-visualizer.ts +167 -0
  92. package/src/autocomplete.d.ts +20 -0
  93. package/src/autocomplete.ts +14 -0
  94. package/src/chat/assistant-message.ts +11 -6
  95. package/src/chat/cache-invalidation-marker.d.ts +15 -7
  96. package/src/chat/cache-invalidation-marker.ts +18 -9
  97. package/src/chat/chat-transcript-builder.d.ts +5 -3
  98. package/src/chat/chat-transcript-builder.ts +16 -12
  99. package/src/chat/display-preferences.d.ts +2 -0
  100. package/src/chat/display-preferences.ts +3 -0
  101. package/src/chat/extension-types.d.ts +72 -1
  102. package/src/chat/extension-types.ts +74 -1
  103. package/src/chat/image-loading.d.ts +2 -2
  104. package/src/chat/image-loading.ts +2 -2
  105. package/src/chat/messages.d.ts +2 -3
  106. package/src/chat/messages.ts +3 -8
  107. package/src/chat/read-tool-group.d.ts +15 -2
  108. package/src/chat/read-tool-group.ts +201 -41
  109. package/src/chat/skill-message.d.ts +1 -0
  110. package/src/chat/skill-message.ts +4 -0
  111. package/src/chat/spotlight.d.ts +203 -0
  112. package/src/chat/spotlight.ts +460 -0
  113. package/src/chat/tool-execution.d.ts +26 -5
  114. package/src/chat/tool-execution.ts +360 -38
  115. package/src/chat/transcript-actions.d.ts +11 -0
  116. package/src/chat/transcript-actions.ts +13 -1
  117. package/src/chat/transcript-browser.d.ts +9 -0
  118. package/src/chat/transcript-browser.ts +18 -0
  119. package/src/chat/transcript-presentation.d.ts +164 -0
  120. package/src/chat/transcript-presentation.ts +642 -0
  121. package/src/chat/ttsr-notification.d.ts +25 -0
  122. package/src/chat/ttsr-notification.ts +5 -0
  123. package/src/chrome/message-frame.d.ts +2 -0
  124. package/src/chrome/message-frame.ts +7 -0
  125. package/src/chrome/message-notice.d.ts +58 -0
  126. package/src/chrome/transcript-container.d.ts +27 -6
  127. package/src/chrome/transcript-container.ts +317 -66
  128. package/src/components/editor.ts +25 -1
  129. package/src/components/loader.d.ts +0 -2
  130. package/src/components/loader.ts +30 -18
  131. package/src/components/markdown.d.ts +11 -1
  132. package/src/components/markdown.ts +41 -16
  133. package/src/components/settings-list.d.ts +12 -2
  134. package/src/components/settings-list.ts +29 -13
  135. package/src/frame-rate.d.ts +18 -0
  136. package/src/frame-rate.ts +36 -0
  137. package/src/hotkeys-markdown.ts +9 -2
  138. package/src/index.d.ts +3 -0
  139. package/src/index.ts +3 -0
  140. package/src/keybinding-matchers.d.ts +4 -1
  141. package/src/keybinding-matchers.ts +13 -12
  142. package/src/kitty-graphics.d.ts +1 -1
  143. package/src/kitty-graphics.ts +3 -2
  144. package/src/motion-effects.d.ts +10 -0
  145. package/src/motion-effects.ts +27 -0
  146. package/src/native/backend.ts +66 -7
  147. package/src/native/encode.d.ts +2 -0
  148. package/src/native/encode.ts +2 -0
  149. package/src/native/measure.d.ts +10 -0
  150. package/src/native/measure.ts +185 -0
  151. package/src/native/overlay.d.ts +1 -1
  152. package/src/native/overlay.ts +1 -1
  153. package/src/native/quiet.d.ts +5 -0
  154. package/src/native/quiet.ts +105 -0
  155. package/src/native/reconcile.d.ts +6 -1
  156. package/src/native/reconcile.ts +16 -10
  157. package/src/native/spans.d.ts +6 -0
  158. package/src/native/spans.ts +40 -0
  159. package/src/native/state.d.ts +4 -0
  160. package/src/native/state.ts +18 -0
  161. package/src/overlays/agent-hub.ts +15 -2
  162. package/src/overlays/ask-dialog.ts +1 -0
  163. package/src/overlays/btw-history-panel.ts +73 -6
  164. package/src/overlays/link-browser.ts +295 -0
  165. package/src/overlays/running-subagent-badge.ts +2 -9
  166. package/src/overlays/settings-defs.ts +1 -1
  167. package/src/overlays/settings-selector.ts +17 -3
  168. package/src/overlays/spotlight-sheet.ts +478 -0
  169. package/src/overlays/usage-dashboard.ts +6 -5
  170. package/src/prompt/composer-attachments.d.ts +5 -2
  171. package/src/prompt/composer-attachments.ts +6 -6
  172. package/src/prompt/composer-cache.ts +17 -16
  173. package/src/prompt/composer.ts +30 -123
  174. package/src/prompt/custom-editor.ts +17 -13
  175. package/src/prompt/gradient-highlight.d.ts +2 -2
  176. package/src/prompt/gradient-highlight.ts +5 -4
  177. package/src/prompt/magic-keywords.d.ts +2 -0
  178. package/src/prompt/magic-keywords.ts +4 -1
  179. package/src/prompt/model-mention-autocomplete.ts +73 -20
  180. package/src/prompt/model-mention-syntax.d.ts +6 -0
  181. package/src/prompt/model-mention-syntax.ts +9 -0
  182. package/src/prompt/prompt-action-autocomplete.ts +49 -33
  183. package/src/prompt/tips.txt +1 -0
  184. package/src/prompt/welcome.ts +104 -2
  185. package/src/render/extension-links.d.ts +0 -6
  186. package/src/render/extension-links.ts +0 -20
  187. package/src/render/index.d.ts +1 -0
  188. package/src/render/index.ts +1 -0
  189. package/src/render/link-hints.d.ts +78 -0
  190. package/src/render/link-hints.ts +299 -0
  191. package/src/render/render-utils.d.ts +0 -2
  192. package/src/render/render-utils.ts +0 -5
  193. package/src/setup/scenes/glyph.ts +1 -1
  194. package/src/setup/scenes/types.ts +8 -0
  195. package/src/setup/scenes/updates.ts +116 -0
  196. package/src/setup/wizard.ts +19 -8
  197. package/src/spinner-clock.d.ts +34 -0
  198. package/src/spinner-clock.ts +79 -0
  199. package/src/status-line/component.ts +145 -53
  200. package/src/status-line/host.ts +51 -0
  201. package/src/status-line/index.ts +1 -0
  202. package/src/status-line/presets.ts +3 -1
  203. package/src/status-line/prompt-cache.ts +154 -0
  204. package/src/status-line/schema.ts +1 -1
  205. package/src/status-line/segments.ts +33 -22
  206. package/src/status-line/startup.ts +22 -4
  207. package/src/status-line/types.ts +8 -22
  208. package/src/stdin-buffer.ts +89 -46
  209. package/src/terminal-capabilities.ts +3 -3
  210. package/src/terminal.ts +1 -8
  211. package/src/theme/loader.ts +3 -2
  212. package/src/theme/schema.d.ts +28 -1
  213. package/src/theme/schema.ts +30 -1
  214. package/src/theme/symbols.d.ts +1 -1
  215. package/src/theme/symbols.ts +15 -3
  216. package/src/theme/theme-class.d.ts +12 -2
  217. package/src/theme/theme-class.ts +23 -0
  218. package/src/theme/theme-schema.json +1 -1
  219. package/src/theme/theme.d.ts +1 -1
  220. package/src/theme/theme.ts +3 -7
  221. package/src/theme/tui-adapters.d.ts +7 -0
  222. package/src/theme/tui-adapters.ts +33 -1
  223. package/src/thinking.d.ts +12 -0
  224. package/src/thinking.ts +31 -0
  225. package/src/tools/ask.d.ts +1 -1
  226. package/src/tools/ask.ts +99 -38
  227. package/src/tools/ast-edit.ts +51 -32
  228. package/src/tools/ast-grep.ts +31 -19
  229. package/src/tools/bash.d.ts +21 -0
  230. package/src/tools/bash.ts +166 -24
  231. package/src/tools/find.d.ts +9 -1
  232. package/src/tools/find.ts +23 -2
  233. package/src/tools/grep.d.ts +2 -1
  234. package/src/tools/grep.ts +52 -36
  235. package/src/tools/grouped-file-output.d.ts +17 -0
  236. package/src/tools/grouped-file-output.ts +20 -2
  237. package/src/tools/job-widget.d.ts +2 -2
  238. package/src/tools/job-widget.ts +2 -2
  239. package/src/tools/lsp.d.ts +4 -2
  240. package/src/tools/lsp.ts +537 -642
  241. package/src/tools/native-view.d.ts +4 -0
  242. package/src/tools/native-view.ts +8 -2
  243. package/src/tools/renderer.d.ts +9 -1
  244. package/src/tools/renderer.ts +9 -1
  245. package/src/tools/shell-trace.d.ts +10 -0
  246. package/src/tools/shell-trace.ts +80 -0
  247. package/src/tools/shell-viz-render.d.ts +6 -0
  248. package/src/tools/shell-viz-render.ts +156 -0
  249. package/src/tools/shell-viz.d.ts +16 -0
  250. package/src/tools/shell-viz.ts +181 -0
  251. package/src/tools/streaming-output.ts +18 -8
  252. package/src/tools/wait.d.ts +2 -2
  253. package/src/tools/wait.ts +39 -34
  254. package/src/tools/web-search-types.d.ts +1 -0
  255. package/src/tools/web-search-types.ts +1 -0
  256. package/src/tools/write.d.ts +2 -0
  257. package/src/tools/write.ts +2 -0
  258. package/src/tui.d.ts +15 -1
  259. package/src/tui.ts +63 -6
  260. package/src/windows-input-mode.ts +7 -1
  261. package/dist/types/chat/collab-prompt-message.d.ts +0 -14
  262. package/dist/types/chrome/collab-qrcode.d.ts +0 -35
  263. package/src/chat/collab-prompt-message.d.ts +0 -14
  264. package/src/chat/collab-prompt-message.ts +0 -46
  265. package/src/chrome/collab-qrcode.ts +0 -99
@@ -3791,6 +3791,11 @@ export class Editor implements Component, Focusable {
3791
3791
  // Auto-trigger for "#" prompt actions anywhere in the current token
3792
3792
  else if (char === "#") {
3793
3793
  this.#tryTriggerAutocomplete();
3794
+ } else if (
3795
+ char === ":" &&
3796
+ MENTION_CONTEXT_RE.test((this.#state.lines[this.#state.cursorLine] || "").slice(0, this.#state.cursorCol))
3797
+ ) {
3798
+ this.#tryTriggerAutocomplete();
3794
3799
  }
3795
3800
  // Argument providers may expose candidates only after a separator.
3796
3801
  else if (char === " " && this.#isInSubmittedSlashCommandContext()) {
@@ -5431,7 +5436,7 @@ export class Editor implements Component, Focusable {
5431
5436
  */
5432
5437
  #refreshAutocomplete(): void {
5433
5438
  if (this.#autocompleteState === "assist") return;
5434
- if (this.#refreshSlashCommandListSync()) return;
5439
+ if (this.#refreshSlashCommandListSync() || this.#refreshModelMentionListSync()) return;
5435
5440
  this.#narrowAtFileList();
5436
5441
  void this.#updateAutocomplete();
5437
5442
  }
@@ -5465,6 +5470,25 @@ export class Editor implements Component, Focusable {
5465
5470
  return true;
5466
5471
  }
5467
5472
 
5473
+ #refreshModelMentionListSync(): boolean {
5474
+ const provider = this.#autocompleteProvider;
5475
+ if (this.#autocompleteState !== "regular" || !provider?.trySyncModelMentionCompletion) return false;
5476
+ const completion = provider.trySyncModelMentionCompletion(
5477
+ this.#state.lines,
5478
+ this.#state.cursorLine,
5479
+ this.#state.cursorCol,
5480
+ );
5481
+ if (completion.kind === "unhandled") return false;
5482
+ this.#invalidateAutocompleteRequests();
5483
+ if (completion.kind === "matched") {
5484
+ this.#showAutocompleteSuggestions(completion.suggestions, "regular");
5485
+ } else {
5486
+ this.#cancelAutocomplete();
5487
+ this.onAutocompleteUpdate?.();
5488
+ }
5489
+ return true;
5490
+ }
5491
+
5468
5492
  /**
5469
5493
  * Get inline hint text to show as dim ghost text after the cursor.
5470
5494
  * Checks the selected autocomplete item's hint first, then the prediction and its alternatives,
@@ -3,8 +3,6 @@ import type { DescribeContext, NativeNode, NativeUiEvent } from "../native/node"
3
3
  import { type ShimmerPalette } from "../theme/shimmer";
4
4
  import type { TUI } from "../tui";
5
5
  import { Text } from "./text";
6
- /** Milliseconds between spinner-frame advances; exported so time-derived spinners elsewhere tick at the Loader cadence. */
7
- export declare const SPINNER_ADVANCE_MS = 80;
8
6
  /** A working-row variant (§6.5): a retry countdown, or context compaction. */
9
7
  export type WorkingRowVariant = {
10
8
  readonly kind: "retry";
@@ -6,14 +6,15 @@ import { plainText } from "../native/spans";
6
6
  import type { DescribeContext, NativeChild, NativeNode, NativeUiEvent } from "../native/node";
7
7
  import { isNativeRendering } from "../native/state";
8
8
  import { describeShimmer, type ShimmerPalette, shimmerEnabled } from "../theme/shimmer";
9
+ import { sharedSpinnerFrame, spinnerAnimated, spinnerInterval, spinnerTickDelay } from "../spinner-clock";
9
10
  import type { TUI } from "../tui";
10
11
  import { getPaddingX, padding, sliceByColumn, visibleWidth } from "../utils";
11
12
  import { Text } from "./text";
12
13
 
13
14
  const DEFAULT_SPINNER_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
14
15
  const RENDER_INTERVAL_MS = 1000 / 30;
15
- /** Milliseconds between spinner-frame advances; exported so time-derived spinners elsewhere tick at the Loader cadence. */
16
- export const SPINNER_ADVANCE_MS = 80;
16
+ /** Repaint cadence of a static-spinner row, so a dynamic label (countdown, elapsed) still moves. */
17
+ const STATIC_REFRESH_MS = 1000;
17
18
  const RENDER_BACKPRESSURE_MULTIPLIER = 9;
18
19
  const MAX_BACKPRESSURE_FRAME_COST_MS = 200;
19
20
 
@@ -104,7 +105,6 @@ export class Loader extends Text {
104
105
  #currentFrame = 0;
105
106
  #intervalId?: NodeJS.Timeout;
106
107
  #ui: TUI | null = null;
107
- #lastSpinnerTick = 0;
108
108
  #layoutSource?: readonly string[];
109
109
  #layout?: readonly {
110
110
  leading: string;
@@ -298,7 +298,7 @@ export class Loader extends Text {
298
298
  }
299
299
 
300
300
  start() {
301
- this.#lastSpinnerTick = performance.now();
301
+ this.#currentFrame = sharedSpinnerFrame(this.#frames.length);
302
302
  this.#syncText();
303
303
  this.#requestPaint();
304
304
  // The TSP terminal animates the described spinner; nothing to repaint.
@@ -306,8 +306,16 @@ export class Loader extends Text {
306
306
  this.#startNativeCountdown();
307
307
  return;
308
308
  }
309
- const intervalMs = this.messageColorFn.animated === true ? RENDER_INTERVAL_MS : SPINNER_ADVANCE_MS;
310
- this.#scheduleTick(intervalMs, intervalMs);
309
+ this.#scheduleTick(spinnerTickDelay(this.#tickIntervalMs()));
310
+ }
311
+
312
+ /**
313
+ * Tick cadence, re-read every tick so a setting change applies from the next one: shimmer drives a
314
+ * 30 Hz repaint; otherwise the glyph's period, or once a second for a static spinner's dynamic label.
315
+ */
316
+ #tickIntervalMs(): number {
317
+ if (this.messageColorFn.animated === true) return RENDER_INTERVAL_MS;
318
+ return spinnerAnimated() ? spinnerInterval() : STATIC_REFRESH_MS;
311
319
  }
312
320
 
313
321
  stop() {
@@ -348,7 +356,12 @@ export class Loader extends Text {
348
356
  this.#requestPaint();
349
357
  }
350
358
 
351
- #scheduleTick(intervalMs: number, delayMs: number): void {
359
+ /**
360
+ * Ticks land on the shared spinner clock's boundaries (see {@link spinnerTickDelay}), so this row
361
+ * and every live tool card repaint in the same frame; backpressure may hold a tick past a
362
+ * boundary, after which the next one realigns.
363
+ */
364
+ #scheduleTick(delayMs: number): void {
352
365
  const timer = setTimeout(() => {
353
366
  if (this.#intervalId !== timer) return;
354
367
  if (isNativeRendering()) {
@@ -357,22 +370,21 @@ export class Loader extends Text {
357
370
  return;
358
371
  }
359
372
  const startedAt = performance.now();
360
- const elapsed = startedAt - this.#lastSpinnerTick;
361
- const shouldAdvanceSpinner = elapsed >= SPINNER_ADVANCE_MS;
362
- if (shouldAdvanceSpinner) {
363
- const steps = Math.floor(elapsed / SPINNER_ADVANCE_MS);
364
- this.#currentFrame = (this.#currentFrame + steps) % this.#frames.length;
365
- this.#lastSpinnerTick += steps * SPINNER_ADVANCE_MS;
366
- this.#syncText();
367
- }
368
- if (shouldAdvanceSpinner || this.#ui?.synchronizedOutput === true) {
373
+ // The glyph is the shared clock's, so every spinner on screen shows the same frame.
374
+ const frame = sharedSpinnerFrame(this.#frames.length);
375
+ const advanced = frame !== this.#currentFrame;
376
+ this.#currentFrame = frame;
377
+ // A static spinner still re-reads a dynamic message (countdown, elapsed) on its 1 s tick.
378
+ const animated = spinnerAnimated();
379
+ if (advanced || !animated) this.#syncText();
380
+ if (advanced || !animated || this.#ui?.synchronizedOutput === true) {
369
381
  this.#requestPaint();
370
382
  }
371
383
 
372
384
  const completedFrameCostMs = this.#ui?.lastFrameCostMs ?? 0;
373
385
  const requestCostMs = performance.now() - startedAt;
374
386
  if (this.#intervalId !== timer) return;
375
- const cadenceDelayMs = Math.max(0, intervalMs - requestCostMs);
387
+ const cadenceDelayMs = spinnerTickDelay(this.#tickIntervalMs());
376
388
  // Idle for nine times the full frame cost to keep animation at or
377
389
  // below 10% CPU even though requestComponentRender() only enqueues.
378
390
  const boundedFrameCostMs = Math.min(
@@ -380,7 +392,7 @@ export class Loader extends Text {
380
392
  Math.max(completedFrameCostMs, requestCostMs),
381
393
  );
382
394
  const backpressureDelayMs = boundedFrameCostMs * RENDER_BACKPRESSURE_MULTIPLIER;
383
- this.#scheduleTick(intervalMs, Math.max(cadenceDelayMs, backpressureDelayMs));
395
+ this.#scheduleTick(Math.max(cadenceDelayMs, backpressureDelayMs));
384
396
  }, delayMs);
385
397
  this.#intervalId = timer;
386
398
  }
@@ -138,7 +138,8 @@ export declare function getMarkdownLinkUrls(text: string): string[];
138
138
  * Each function takes text and returns styled text with ANSI codes.
139
139
  */
140
140
  export interface MarkdownTheme {
141
- heading: (text: string) => string;
141
+ /** Color a heading; `depth` is its level, 1–6. Bold/underline/`#` prefix are already applied. */
142
+ heading: (text: string, depth: number) => string;
142
143
  link: (text: string) => string;
143
144
  linkUrl: (text: string) => string;
144
145
  /** Resolve the OSC 8 destination without changing visible text; undefined preserves the authored URL. */
@@ -154,6 +155,15 @@ export interface MarkdownTheme {
154
155
  italic: (text: string) => string;
155
156
  strikethrough: (text: string) => string;
156
157
  underline: (text: string) => string;
158
+ /**
159
+ * Style `**strong**` spans, including their weight. Omitted → {@link bold}.
160
+ * A theme that colors them owns the span's foreground over a `proseFg` default.
161
+ */
162
+ strong?: (text: string) => string;
163
+ /** Style `*emphasis*` spans, including their slant. Omitted → {@link italic}; colors win like {@link strong}. */
164
+ emphasis?: (text: string) => string;
165
+ /** Style table header cells, including their weight. Omitted → {@link bold}; colors win like {@link strong}. */
166
+ tableHeader?: (text: string) => string;
157
167
  highlightCode?: (code: string, lang?: string) => string[];
158
168
  /**
159
169
  * Create a stateful incremental highlighter for one streaming code fence.
@@ -1762,7 +1762,8 @@ export function getMarkdownLinkUrls(text: string): string[] {
1762
1762
  * Each function takes text and returns styled text with ANSI codes.
1763
1763
  */
1764
1764
  export interface MarkdownTheme {
1765
- heading: (text: string) => string;
1765
+ /** Color a heading; `depth` is its level, 1–6. Bold/underline/`#` prefix are already applied. */
1766
+ heading: (text: string, depth: number) => string;
1766
1767
  link: (text: string) => string;
1767
1768
  linkUrl: (text: string) => string;
1768
1769
  /** Resolve the OSC 8 destination without changing visible text; undefined preserves the authored URL. */
@@ -1778,6 +1779,15 @@ export interface MarkdownTheme {
1778
1779
  italic: (text: string) => string;
1779
1780
  strikethrough: (text: string) => string;
1780
1781
  underline: (text: string) => string;
1782
+ /**
1783
+ * Style `**strong**` spans, including their weight. Omitted → {@link bold}.
1784
+ * A theme that colors them owns the span's foreground over a `proseFg` default.
1785
+ */
1786
+ strong?: (text: string) => string;
1787
+ /** Style `*emphasis*` spans, including their slant. Omitted → {@link italic}; colors win like {@link strong}. */
1788
+ emphasis?: (text: string) => string;
1789
+ /** Style table header cells, including their weight. Omitted → {@link bold}; colors win like {@link strong}. */
1790
+ tableHeader?: (text: string) => string;
1781
1791
  highlightCode?: (code: string, lang?: string) => string[];
1782
1792
  /**
1783
1793
  * Create a stateful incremental highlighter for one streaming code fence.
@@ -3285,7 +3295,7 @@ export class Markdown implements Component {
3285
3295
 
3286
3296
  #renderSignature(width: number, paddingX: number): RenderSignature {
3287
3297
  const bgColorProbe = this.#defaultTextStyle?.bgColor ? this.#defaultTextStyle.bgColor("\x01") : "";
3288
- const headingProbe = this.#theme.heading("");
3298
+ const headingProbe = this.#theme.heading("", 1);
3289
3299
  return {
3290
3300
  width,
3291
3301
  paddingX,
@@ -3971,7 +3981,9 @@ export class Markdown implements Component {
3971
3981
  const plainWidth = visibleWidth(headingPlainText);
3972
3982
  if (plainWidth > 0 && 2 * plainWidth <= width) {
3973
3983
  const sizedHeading = encodeTextSizedHeading(headingPlainText, 2);
3974
- lines.push(renderedLine(this.#theme.heading(this.#theme.bold(this.#theme.underline(sizedHeading)))));
3984
+ lines.push(
3985
+ renderedLine(this.#theme.heading(this.#theme.bold(this.#theme.underline(sizedHeading)), 1)),
3986
+ );
3975
3987
  lines.push(renderedLine("")); // reserve the heading's second visual row
3976
3988
  if (nextTokenType && nextTokenType !== "space") {
3977
3989
  lines.push(renderedLine("")); // Add spacing after headings (unless space token follows)
@@ -3980,11 +3992,11 @@ export class Markdown implements Component {
3980
3992
  }
3981
3993
  }
3982
3994
  if (headingLevel === 1) {
3983
- styledHeading = this.#theme.heading(this.#theme.bold(this.#theme.underline(headingText)));
3995
+ styledHeading = this.#theme.heading(this.#theme.bold(this.#theme.underline(headingText)), 1);
3984
3996
  } else if (headingLevel === 2) {
3985
- styledHeading = this.#theme.heading(this.#theme.bold(headingText));
3997
+ styledHeading = this.#theme.heading(this.#theme.bold(headingText), 2);
3986
3998
  } else {
3987
- styledHeading = this.#theme.heading(this.#theme.bold(headingPrefix + headingText));
3999
+ styledHeading = this.#theme.heading(this.#theme.bold(headingPrefix + headingText), headingLevel);
3988
4000
  }
3989
4001
  lines.push(renderedLine(styledHeading));
3990
4002
  if (nextTokenType && nextTokenType !== "space") {
@@ -4261,15 +4273,23 @@ export class Markdown implements Component {
4261
4273
 
4262
4274
  case "strong": {
4263
4275
  markHtmlItemWhenContent(plainInlineTokens(token.tokens || []));
4264
- const boldContent = this.#renderInlineTokens(token.tokens || [], resolvedStyleContext);
4265
- result += this.#theme.bold(boldContent) + stylePrefix;
4276
+ // A themed role owns the span's color, so prose runs inside drop a `proseFg` default.
4277
+ const context = this.#theme.strong
4278
+ ? this.#proseFgExemptContext(resolvedStyleContext)
4279
+ : resolvedStyleContext;
4280
+ const content = this.#renderInlineTokens(token.tokens || [], context);
4281
+ result += (this.#theme.strong ? this.#theme.strong(content) : this.#theme.bold(content)) + stylePrefix;
4266
4282
  break;
4267
4283
  }
4268
4284
 
4269
4285
  case "em": {
4270
- const italicContent = this.#renderInlineTokens(token.tokens || [], resolvedStyleContext);
4271
4286
  markHtmlItemWhenContent(plainInlineTokens(token.tokens || []));
4272
- result += this.#theme.italic(italicContent) + stylePrefix;
4287
+ const context = this.#theme.emphasis
4288
+ ? this.#proseFgExemptContext(resolvedStyleContext)
4289
+ : resolvedStyleContext;
4290
+ const content = this.#renderInlineTokens(token.tokens || [], context);
4291
+ result +=
4292
+ (this.#theme.emphasis ? this.#theme.emphasis(content) : this.#theme.italic(content)) + stylePrefix;
4273
4293
  break;
4274
4294
  }
4275
4295
 
@@ -4802,8 +4822,9 @@ export class Markdown implements Component {
4802
4822
  lines.push(`${t.topLeft}${h}${topBorderCells.join(`${h}${t.teeDown}${h}`)}${h}${t.topRight}`);
4803
4823
 
4804
4824
  // Render header with wrapping
4825
+ const headerStyleContext = this.#theme.tableHeader ? this.#proseFgExemptContext(styleContext) : styleContext;
4805
4826
  const headerCellLines: string[][] = token.header.map((cell, i) => {
4806
- const text = this.#renderInlineTokens(cell.tokens || [], styleContext);
4827
+ const text = this.#renderInlineTokens(cell.tokens || [], headerStyleContext);
4807
4828
  return this.#wrapCellText(text, columnWidths[i]);
4808
4829
  });
4809
4830
  const headerLineCount = Math.max(...headerCellLines.map(c => c.length));
@@ -4812,7 +4833,7 @@ export class Markdown implements Component {
4812
4833
  const rowParts = headerCellLines.map((cellLines, colIdx) => {
4813
4834
  const text = cellLines[lineIdx] || "";
4814
4835
  const padded = this.#alignCellText(text, columnWidths[colIdx], columnAligns[colIdx] ?? null);
4815
- return this.#theme.bold(padded);
4836
+ return this.#theme.tableHeader ? this.#theme.tableHeader(padded) : this.#theme.bold(padded);
4816
4837
  });
4817
4838
  lines.push(`${v} ${rowParts.join(` ${v} `)} ${v}`);
4818
4839
  }
@@ -4925,12 +4946,16 @@ function renderInlineTokens(tokens: Token[], mdTheme: MarkdownTheme, applyText:
4925
4946
  result += applyText(normalizeHtmlEntitiesForTerminal(token.text));
4926
4947
  }
4927
4948
  break;
4928
- case "strong":
4929
- result += mdTheme.bold(renderInlineTokens(token.tokens || [], mdTheme, applyText)) + styleReset;
4949
+ case "strong": {
4950
+ const content = renderInlineTokens(token.tokens || [], mdTheme, applyText);
4951
+ result += (mdTheme.strong ? mdTheme.strong(content) : mdTheme.bold(content)) + styleReset;
4930
4952
  break;
4931
- case "em":
4932
- result += mdTheme.italic(renderInlineTokens(token.tokens || [], mdTheme, applyText)) + styleReset;
4953
+ }
4954
+ case "em": {
4955
+ const content = renderInlineTokens(token.tokens || [], mdTheme, applyText);
4956
+ result += (mdTheme.emphasis ? mdTheme.emphasis(content) : mdTheme.italic(content)) + styleReset;
4933
4957
  break;
4958
+ }
4934
4959
  case "codespan":
4935
4960
  result += mdTheme.code(token.text) + styleReset;
4936
4961
  break;
@@ -3,6 +3,8 @@ import type { TspPrefsControl, TspPrefsRow, TspPrefsSection } from "@linxiraos/p
3
3
  import type { DescribeContext, NativeNode, NativeUiEvent } from "../native/node";
4
4
  import type { Component } from "../tui";
5
5
  import { FormField, type FormFieldOptions, type FormFieldTheme } from "./form";
6
+ /** Builds a row's editor from its current value; `done` closes it, with the value picked if one was. */
7
+ export type SettingEditor = (currentValue: string, done: (selectedValue?: string) => void) => Component;
6
8
  export interface SettingItem {
7
9
  /** Unique identifier for this setting */
8
10
  id: string;
@@ -17,7 +19,12 @@ export interface SettingItem {
17
19
  /** If provided, Enter/Space cycles through these values */
18
20
  values?: string[];
19
21
  /** If provided, Enter opens this submenu. Receives current value and done callback. */
20
- submenu?: (currentValue: string, done: (selectedValue?: string) => void) => Component;
22
+ submenu?: SettingEditor;
23
+ /**
24
+ * A `values` row's choices as a menu: a native settings page's popup button
25
+ * opens it ({@link SettingsList.openSubmenuFor}); Enter/Space still cycle.
26
+ */
27
+ menu?: SettingEditor;
21
28
  /** True when the displayed setting differs from its default value. */
22
29
  changed?: boolean;
23
30
  /** The default, as a native settings page names it in the changed dot's title. */
@@ -142,7 +149,10 @@ export declare class SettingsList implements Component {
142
149
  prefsEditing(inlineMenu: (id: string) => boolean): PrefsEditing | null;
143
150
  /** Applies `value` to a cycling (boolean/enum) row the way Enter does: the row shows it and `onChange` runs. */
144
151
  applyValue(id: string, value: string): void;
145
- /** Opens row `id`'s submenu the way Enter does (leaving one already open for it); returns it. */
152
+ /**
153
+ * Opens row `id`'s submenu (a cycling row's `menu`) the way Enter opens a
154
+ * submenu, leaving one already open for it; returns it.
155
+ */
146
156
  openSubmenuFor(id: string): Component | undefined;
147
157
  /** Resize the visible viewport (fullscreen hosts call this every render). */
148
158
  setMaxVisible(rows: number): void;
@@ -34,6 +34,9 @@ function hasMouseRouter(component: Component): component is Component & MouseRou
34
34
  return "routeMouse" in component && typeof component.routeMouse === "function";
35
35
  }
36
36
 
37
+ /** Builds a row's editor from its current value; `done` closes it, with the value picked if one was. */
38
+ export type SettingEditor = (currentValue: string, done: (selectedValue?: string) => void) => Component;
39
+
37
40
  export interface SettingItem {
38
41
  /** Unique identifier for this setting */
39
42
  id: string;
@@ -48,7 +51,12 @@ export interface SettingItem {
48
51
  /** If provided, Enter/Space cycles through these values */
49
52
  values?: string[];
50
53
  /** If provided, Enter opens this submenu. Receives current value and done callback. */
51
- submenu?: (currentValue: string, done: (selectedValue?: string) => void) => Component;
54
+ submenu?: SettingEditor;
55
+ /**
56
+ * A `values` row's choices as a menu: a native settings page's popup button
57
+ * opens it ({@link SettingsList.openSubmenuFor}); Enter/Space still cycle.
58
+ */
59
+ menu?: SettingEditor;
52
60
  /** True when the displayed setting differs from its default value. */
53
61
  changed?: boolean;
54
62
  /** The default, as a native settings page names it in the changed dot's title. */
@@ -366,14 +374,18 @@ export class SettingsList implements Component {
366
374
  this.#onChange(item.id, value);
367
375
  }
368
376
 
369
- /** Opens row `id`'s submenu the way Enter does (leaving one already open for it); returns it. */
377
+ /**
378
+ * Opens row `id`'s submenu (a cycling row's `menu`) the way Enter opens a
379
+ * submenu, leaving one already open for it; returns it.
380
+ */
370
381
  openSubmenuFor(id: string): Component | undefined {
371
382
  const open = this.openSubmenu;
372
383
  if (open?.id === id) return open.component;
373
384
  if (open || !this.selectItem(id)) return undefined;
374
385
  const item = this.getSelectedItem();
375
- if (!item?.submenu) return undefined;
376
- this.#activateItem();
386
+ const editor = item?.submenu ?? item?.menu;
387
+ if (!item || !editor) return undefined;
388
+ this.#openSubmenu(item, editor);
377
389
  return this.#submenuComponent ?? undefined;
378
390
  }
379
391
 
@@ -1047,15 +1059,7 @@ export class SettingsList implements Component {
1047
1059
  if (!item || item.heading) return;
1048
1060
 
1049
1061
  if (item.submenu) {
1050
- // Open submenu, passing current value so it can pre-select correctly
1051
- this.#submenuItemId = item.id;
1052
- this.#submenuComponent = item.submenu(item.currentValue, (selectedValue?: string) => {
1053
- if (selectedValue !== undefined) {
1054
- item.currentValue = selectedValue;
1055
- this.#onChange(item.id, selectedValue);
1056
- }
1057
- this.#closeSubmenu();
1058
- });
1062
+ this.#openSubmenu(item, item.submenu);
1059
1063
  } else if (item.values && item.values.length > 0) {
1060
1064
  // Cycle through values
1061
1065
  const currentIndex = item.values.indexOf(item.currentValue);
@@ -1066,6 +1070,18 @@ export class SettingsList implements Component {
1066
1070
  }
1067
1071
  }
1068
1072
 
1073
+ /** Opens `editor` for `item` with its current value (so it pre-selects); a pick updates the row and runs `onChange`. */
1074
+ #openSubmenu(item: SettingItem, editor: SettingEditor): void {
1075
+ this.#submenuItemId = item.id;
1076
+ this.#submenuComponent = editor(item.currentValue, (selectedValue?: string) => {
1077
+ if (selectedValue !== undefined) {
1078
+ item.currentValue = selectedValue;
1079
+ this.#onChange(item.id, selectedValue);
1080
+ }
1081
+ this.#closeSubmenu();
1082
+ });
1083
+ }
1084
+
1069
1085
  #closeSubmenu(): void {
1070
1086
  this.#submenuComponent = null;
1071
1087
  // Restore selection to the item that opened the submenu. Resolve by id:
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The frame-rate ceiling (`tui.maxFps`): the render scheduler paints no closer than
3
+ * {@link minFrameIntervalMs}, except frames a keystroke is waiting on. Dependency-free: the host's
4
+ * flag table imports it during CLI bootstrap.
5
+ */
6
+ /** Default ceiling, in frames per second (the historical scheduler cadence). */
7
+ export declare const DEFAULT_MAX_FPS = 30;
8
+ /** Shortest interval between two frames at the live ceiling, in milliseconds. */
9
+ export declare function minFrameIntervalMs(): number;
10
+ /** Set the ceiling; callers pass a value {@link parseMaxFps} accepted. Applies from the next scheduled frame. */
11
+ export declare function setMaxFps(next: number): void;
12
+ /**
13
+ * Canonicalize a configured ceiling: an integer from 1 to 120. Numeric strings are accepted so one
14
+ * parser serves the CLI flag, the environment variable, and the setting.
15
+ *
16
+ * @throws Error on a non-numeric, fractional, or out-of-range value.
17
+ */
18
+ export declare function parseMaxFps(value: unknown): number;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * The frame-rate ceiling (`tui.maxFps`): the render scheduler paints no closer than
3
+ * {@link minFrameIntervalMs}, except frames a keystroke is waiting on. Dependency-free: the host's
4
+ * flag table imports it during CLI bootstrap.
5
+ */
6
+
7
+ /** Default ceiling, in frames per second (the historical scheduler cadence). */
8
+ export const DEFAULT_MAX_FPS = 30;
9
+ const MIN_MAX_FPS = 1;
10
+ const MAX_MAX_FPS = 120;
11
+
12
+ let fps = DEFAULT_MAX_FPS;
13
+
14
+ /** Shortest interval between two frames at the live ceiling, in milliseconds. */
15
+ export function minFrameIntervalMs(): number {
16
+ return 1000 / fps;
17
+ }
18
+
19
+ /** Set the ceiling; callers pass a value {@link parseMaxFps} accepted. Applies from the next scheduled frame. */
20
+ export function setMaxFps(next: number): void {
21
+ fps = next;
22
+ }
23
+
24
+ /**
25
+ * Canonicalize a configured ceiling: an integer from 1 to 120. Numeric strings are accepted so one
26
+ * parser serves the CLI flag, the environment variable, and the setting.
27
+ *
28
+ * @throws Error on a non-numeric, fractional, or out-of-range value.
29
+ */
30
+ export function parseMaxFps(value: unknown): number {
31
+ const n = typeof value === "string" ? Number(value.trim() || Number.NaN) : value;
32
+ if (typeof n === "number" && Number.isInteger(n) && n >= MIN_MAX_FPS && n <= MAX_MAX_FPS) return n;
33
+ throw new Error(
34
+ `Max frames per second must be a whole number from ${MIN_MAX_FPS} to ${MAX_MAX_FPS}, got ${JSON.stringify(value)}.`,
35
+ );
36
+ }
@@ -13,6 +13,8 @@ import type { Component } from "./tui";
13
13
  /** Effective keybinding operations used to render the hotkey reference. */
14
14
  export interface HotkeysMarkdownBindings {
15
15
  keybindings: Pick<KeybindingsManager, "getDisplayString" | "getKeys" | "matchesCanonical">;
16
+ /** Whether `/live` (and its `Ctrl+L` toggle) is available; disabled rows are omitted. */
17
+ liveEnabled?: boolean;
16
18
  }
17
19
 
18
20
  /**
@@ -135,7 +137,10 @@ function hotkeyGroups(bindings: HotkeysMarkdownBindings): HotkeyGroup[] {
135
137
  { keys: [act("app.history.search")], action: "Search prompt history" },
136
138
  { keys: [act("app.tools.expand")], action: "Toggle tool output expansion" },
137
139
  { keys: [act("app.tools.toggleVisibility")], action: "Toggle tool activity visibility" },
138
- { keys: [act("app.links.hint")], action: "Pick an extension link on screen by its tag" },
140
+ {
141
+ keys: [act("app.links.hint")],
142
+ action: "Pick an extension link on screen by its tag; press again to browse the whole transcript",
143
+ },
139
144
  { keys: [act("app.ask.hide")], action: "Hide/show a pending ask question" },
140
145
  { keys: [act("app.approval.approve")], action: "Approve a pending tool call" },
141
146
  { keys: [act("app.thinking.toggle")], action: "Toggle thinking block visibility" },
@@ -153,7 +158,9 @@ function hotkeyGroups(bindings: HotkeysMarkdownBindings): HotkeyGroup[] {
153
158
  ? "Speech-to-text (push-to-talk): hold to record, release to transcribe"
154
159
  : "Speech-to-text (push-to-talk) (disabled)",
155
160
  },
156
- { keys: [act("app.live.toggle")], action: "Start/stop live voice mode (/live)" },
161
+ ...(bindings.liveEnabled
162
+ ? [{ keys: [act("app.live.toggle")], action: "Start/stop live voice mode (/live)" }]
163
+ : []),
157
164
  {
158
165
  keys: [
159
166
  act("app.agents.hub"),
package/src/index.d.ts CHANGED
@@ -15,6 +15,9 @@ export * from "./components/layout/row";
15
15
  export * from "./components/layout/split-pane";
16
16
  export * from "./components/layout/stack";
17
17
  export * from "./components/loader";
18
+ export * from "./spinner-clock";
19
+ export * from "./frame-rate";
20
+ export * from "./motion-effects";
18
21
  export * from "./components/markdown";
19
22
  export * from "./components/menu-selection";
20
23
  export * from "./components/metric";
package/src/index.ts CHANGED
@@ -20,6 +20,9 @@ export * from "./components/layout/row";
20
20
  export * from "./components/layout/split-pane";
21
21
  export * from "./components/layout/stack";
22
22
  export * from "./components/loader";
23
+ export * from "./spinner-clock";
24
+ export * from "./frame-rate";
25
+ export * from "./motion-effects";
23
26
  export * from "./components/markdown";
24
27
  export * from "./components/menu-selection";
25
28
  export * from "./components/metric";
@@ -1,4 +1,5 @@
1
1
  import type { KeyId } from "./app-keybindings";
2
+ import { type KeybindingsManager } from "./keybindings";
2
3
  /**
3
4
  * Match the coding-agent interrupt key.
4
5
  *
@@ -38,8 +39,10 @@ export declare function matchesAppExternalEditor(data: string): boolean;
38
39
  * effective follow-up binding.
39
40
  */
40
41
  export declare function matchesAppFollowUp(data: string): boolean;
42
+ /** Effective follow-up keys: the `app.message.followUp` bindings, or Ctrl+Enter/Ctrl+Q when unbound. */
43
+ export declare function appFollowUpKeys(keybindings?: KeybindingsManager): readonly KeyId[];
41
44
  /** Effective tool-approval keys: the `app.approval.approve` bindings, or Ctrl+Enter/Ctrl+Q when unbound. */
42
- export declare function appApproveKeys(): readonly KeyId[];
45
+ export declare function appApproveKeys(keybindings?: KeybindingsManager): readonly KeyId[];
43
46
  /** Match the tool-approval key, recognizing modifier-tagged LF as Ctrl+Enter like {@link matchesAppFollowUp}. */
44
47
  export declare function matchesAppApprove(data: string): boolean;
45
48
  /**
@@ -1,5 +1,5 @@
1
1
  import type { KeyId } from "./app-keybindings";
2
- import { getKeybindings } from "./keybindings";
2
+ import { getKeybindings, type KeybindingsManager } from "./keybindings";
3
3
  import { matchesKey } from "./keys";
4
4
 
5
5
  /**
@@ -99,21 +99,22 @@ function matchesEffectiveKeys(data: string, keys: readonly KeyId[]): boolean {
99
99
  * effective follow-up binding.
100
100
  */
101
101
  export function matchesAppFollowUp(data: string): boolean {
102
- const keybindings = getKeybindings();
103
- const keys = keybindings.getKeys("app.message.followUp");
104
- if (keys.length > 0) {
105
- return matchesEffectiveKeys(data, keys);
106
- }
107
- return matchesEffectiveKeys(data, ["ctrl+enter", "ctrl+q"]);
102
+ return matchesEffectiveKeys(data, appFollowUpKeys());
108
103
  }
109
104
 
110
- /** Approve-key defaults when `app.approval.approve` is unbound: approval must stay reachable by keyboard. */
111
- const APPROVE_DEFAULT_KEYS: readonly KeyId[] = ["ctrl+enter", "ctrl+q"];
105
+ /** Keys approval and follow-up fall back to when unbound: both must stay reachable by keyboard. */
106
+ const UNBOUND_SUBMIT_KEYS: readonly KeyId[] = ["ctrl+enter", "ctrl+q"];
107
+
108
+ /** Effective follow-up keys: the `app.message.followUp` bindings, or Ctrl+Enter/Ctrl+Q when unbound. */
109
+ export function appFollowUpKeys(keybindings: KeybindingsManager = getKeybindings()): readonly KeyId[] {
110
+ const keys = keybindings.getKeys("app.message.followUp");
111
+ return keys.length > 0 ? keys : UNBOUND_SUBMIT_KEYS;
112
+ }
112
113
 
113
114
  /** Effective tool-approval keys: the `app.approval.approve` bindings, or Ctrl+Enter/Ctrl+Q when unbound. */
114
- export function appApproveKeys(): readonly KeyId[] {
115
- const keys = getKeybindings().getKeys("app.approval.approve");
116
- return keys.length > 0 ? keys : APPROVE_DEFAULT_KEYS;
115
+ export function appApproveKeys(keybindings: KeybindingsManager = getKeybindings()): readonly KeyId[] {
116
+ const keys = keybindings.getKeys("app.approval.approve");
117
+ return keys.length > 0 ? keys : UNBOUND_SUBMIT_KEYS;
117
118
  }
118
119
 
119
120
  /** Match the tool-approval key, recognizing modifier-tagged LF as Ctrl+Enter like {@link matchesAppFollowUp}. */
@@ -26,7 +26,7 @@ export interface KittyGraphicsFeatures {
26
26
  * Whether the detected terminal renders Kitty Unicode placeholders (`U=1` +
27
27
  * U+10EEEE with row/column diacritics).
28
28
  *
29
- * Kitty, Ghostty and Otty advertise placeholder support directly. A multiplexer
29
+ * Kitty, Ghostty, Otty and Tern advertise placeholder support directly. A multiplexer
30
30
  * cannot use cursor-positioned placements because the outer terminal does not
31
31
  * know pane scroll/reflow state. An explicit `PI_FORCE_IMAGE_PROTOCOL=kitty`
32
32
  * opts into placeholders under any multiplexer — matching `timg -pk`.
@@ -63,7 +63,7 @@ export interface KittyGraphicsFeatures {
63
63
  * Whether the detected terminal renders Kitty Unicode placeholders (`U=1` +
64
64
  * U+10EEEE with row/column diacritics).
65
65
  *
66
- * Kitty, Ghostty and Otty advertise placeholder support directly. A multiplexer
66
+ * Kitty, Ghostty, Otty and Tern advertise placeholder support directly. A multiplexer
67
67
  * cannot use cursor-positioned placements because the outer terminal does not
68
68
  * know pane scroll/reflow state. An explicit `PI_FORCE_IMAGE_PROTOCOL=kitty`
69
69
  * opts into placeholders under any multiplexer — matching `timg -pk`.
@@ -87,7 +87,8 @@ export function detectKittyUnicodePlaceholdersSupport(terminalId: string, env: N
87
87
  terminalId === "ghostty" ||
88
88
  terminalId === "monstar" ||
89
89
  terminalId === "otty" ||
90
- terminalId === "rio"
90
+ terminalId === "rio" ||
91
+ terminalId === "tern"
91
92
  );
92
93
  }
93
94
 
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Decorative motion with no knob of its own — the status-line blink and brand fade, the editor's
3
+ * magic-keyword sweep, native `fx` spans — behind one switch the host's `tui.motion` preset drives.
4
+ */
5
+ /** Whether decorative motion may run. */
6
+ export declare function motionEffectsEnabled(): boolean;
7
+ /** Enable or disable decorative motion. Timer-driven effects stop at their next frame. */
8
+ export declare function setMotionEffects(next: boolean): void;
9
+ /** Observe switch flips, for output nothing would otherwise re-describe; returns the unsubscribe. */
10
+ export declare function onMotionEffectsChange(listener: () => void): () => void;