@kenkaiiii/ggcoder 4.3.211 → 4.3.213

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 (314) hide show
  1. package/README.md +5 -8
  2. package/dist/cli.d.ts +3 -1
  3. package/dist/cli.d.ts.map +1 -1
  4. package/dist/cli.js +112 -61
  5. package/dist/cli.js.map +1 -1
  6. package/dist/core/continue-replay-inventory.test.d.ts +2 -0
  7. package/dist/core/continue-replay-inventory.test.d.ts.map +1 -0
  8. package/dist/core/continue-replay-inventory.test.js +42 -0
  9. package/dist/core/continue-replay-inventory.test.js.map +1 -0
  10. package/dist/core/goal-controller.d.ts +2 -0
  11. package/dist/core/goal-controller.d.ts.map +1 -1
  12. package/dist/core/goal-controller.js +283 -24
  13. package/dist/core/goal-controller.js.map +1 -1
  14. package/dist/core/goal-controller.test.js +413 -16
  15. package/dist/core/goal-controller.test.js.map +1 -1
  16. package/dist/core/goal-lifecycle-smoke.test.js +48 -6
  17. package/dist/core/goal-lifecycle-smoke.test.js.map +1 -1
  18. package/dist/core/goal-prerequisites.d.ts +23 -0
  19. package/dist/core/goal-prerequisites.d.ts.map +1 -0
  20. package/dist/core/goal-prerequisites.js +114 -0
  21. package/dist/core/goal-prerequisites.js.map +1 -0
  22. package/dist/core/goal-prerequisites.test.d.ts +2 -0
  23. package/dist/core/goal-prerequisites.test.d.ts.map +1 -0
  24. package/dist/core/goal-prerequisites.test.js +118 -0
  25. package/dist/core/goal-prerequisites.test.js.map +1 -0
  26. package/dist/core/goal-references.d.ts +14 -0
  27. package/dist/core/goal-references.d.ts.map +1 -0
  28. package/dist/core/goal-references.js +153 -0
  29. package/dist/core/goal-references.js.map +1 -0
  30. package/dist/core/goal-references.test.d.ts +2 -0
  31. package/dist/core/goal-references.test.d.ts.map +1 -0
  32. package/dist/core/goal-references.test.js +77 -0
  33. package/dist/core/goal-references.test.js.map +1 -0
  34. package/dist/core/goal-store.d.ts +25 -0
  35. package/dist/core/goal-store.d.ts.map +1 -1
  36. package/dist/core/goal-store.js +161 -38
  37. package/dist/core/goal-store.js.map +1 -1
  38. package/dist/core/goal-store.test.js +33 -8
  39. package/dist/core/goal-store.test.js.map +1 -1
  40. package/dist/core/goal-verifier.d.ts.map +1 -1
  41. package/dist/core/goal-verifier.js +4 -1
  42. package/dist/core/goal-verifier.js.map +1 -1
  43. package/dist/core/goal-verifier.test.js +43 -0
  44. package/dist/core/goal-verifier.test.js.map +1 -1
  45. package/dist/core/goal-worker.d.ts +2 -0
  46. package/dist/core/goal-worker.d.ts.map +1 -1
  47. package/dist/core/goal-worker.js +33 -9
  48. package/dist/core/goal-worker.js.map +1 -1
  49. package/dist/core/goal-worker.test.js +49 -1
  50. package/dist/core/goal-worker.test.js.map +1 -1
  51. package/dist/core/prompt-commands.d.ts.map +1 -1
  52. package/dist/core/prompt-commands.js +28 -845
  53. package/dist/core/prompt-commands.js.map +1 -1
  54. package/dist/core/prompt-commands.test.js +40 -74
  55. package/dist/core/prompt-commands.test.js.map +1 -1
  56. package/dist/core/runtime-mode.d.ts +14 -0
  57. package/dist/core/runtime-mode.d.ts.map +1 -0
  58. package/dist/core/runtime-mode.js +10 -0
  59. package/dist/core/runtime-mode.js.map +1 -0
  60. package/dist/core/session-restore-display.test.d.ts +2 -0
  61. package/dist/core/session-restore-display.test.d.ts.map +1 -0
  62. package/dist/core/session-restore-display.test.js +100 -0
  63. package/dist/core/session-restore-display.test.js.map +1 -0
  64. package/dist/core/verify-commands.js +4 -4
  65. package/dist/core/verify-commands.js.map +1 -1
  66. package/dist/system-prompt.d.ts +2 -1
  67. package/dist/system-prompt.d.ts.map +1 -1
  68. package/dist/system-prompt.js +51 -37
  69. package/dist/system-prompt.js.map +1 -1
  70. package/dist/system-prompt.test.js +147 -40
  71. package/dist/system-prompt.test.js.map +1 -1
  72. package/dist/tools/bash.d.ts +3 -2
  73. package/dist/tools/bash.d.ts.map +1 -1
  74. package/dist/tools/bash.js +11 -4
  75. package/dist/tools/bash.js.map +1 -1
  76. package/dist/tools/edit.d.ts +5 -3
  77. package/dist/tools/edit.d.ts.map +1 -1
  78. package/dist/tools/edit.js +14 -4
  79. package/dist/tools/edit.js.map +1 -1
  80. package/dist/tools/edit.test.js +0 -10
  81. package/dist/tools/edit.test.js.map +1 -1
  82. package/dist/tools/goal-mode.test.d.ts +2 -0
  83. package/dist/tools/goal-mode.test.d.ts.map +1 -0
  84. package/dist/tools/goal-mode.test.js +121 -0
  85. package/dist/tools/goal-mode.test.js.map +1 -0
  86. package/dist/tools/goals.d.ts +15 -3
  87. package/dist/tools/goals.d.ts.map +1 -1
  88. package/dist/tools/goals.js +385 -35
  89. package/dist/tools/goals.js.map +1 -1
  90. package/dist/tools/goals.test.js +389 -6
  91. package/dist/tools/goals.test.js.map +1 -1
  92. package/dist/tools/index.d.ts +7 -10
  93. package/dist/tools/index.d.ts.map +1 -1
  94. package/dist/tools/index.js +6 -19
  95. package/dist/tools/index.js.map +1 -1
  96. package/dist/tools/plan-mode.test.js +34 -224
  97. package/dist/tools/plan-mode.test.js.map +1 -1
  98. package/dist/tools/prompt-hints.d.ts.map +1 -1
  99. package/dist/tools/prompt-hints.js +2 -6
  100. package/dist/tools/prompt-hints.js.map +1 -1
  101. package/dist/tools/subagent.d.ts +3 -2
  102. package/dist/tools/subagent.d.ts.map +1 -1
  103. package/dist/tools/subagent.js +4 -9
  104. package/dist/tools/subagent.js.map +1 -1
  105. package/dist/tools/write.d.ts +5 -3
  106. package/dist/tools/write.d.ts.map +1 -1
  107. package/dist/tools/write.js +14 -13
  108. package/dist/tools/write.js.map +1 -1
  109. package/dist/tools/write.test.js +0 -16
  110. package/dist/tools/write.test.js.map +1 -1
  111. package/dist/ui/App.d.ts +146 -30
  112. package/dist/ui/App.d.ts.map +1 -1
  113. package/dist/ui/App.js +1202 -910
  114. package/dist/ui/App.js.map +1 -1
  115. package/dist/ui/activity-phrases.d.ts.map +1 -1
  116. package/dist/ui/activity-phrases.js +0 -2
  117. package/dist/ui/activity-phrases.js.map +1 -1
  118. package/dist/ui/app-state-persistence.test.js +181 -13
  119. package/dist/ui/app-state-persistence.test.js.map +1 -1
  120. package/dist/ui/chat-layout-pinning.test.d.ts +2 -0
  121. package/dist/ui/chat-layout-pinning.test.d.ts.map +1 -0
  122. package/dist/ui/chat-layout-pinning.test.js +407 -0
  123. package/dist/ui/chat-layout-pinning.test.js.map +1 -0
  124. package/dist/ui/components/ActivityIndicator.d.ts +1 -2
  125. package/dist/ui/components/ActivityIndicator.d.ts.map +1 -1
  126. package/dist/ui/components/ActivityIndicator.js +63 -94
  127. package/dist/ui/components/ActivityIndicator.js.map +1 -1
  128. package/dist/ui/components/AssistantMessage.d.ts +6 -2
  129. package/dist/ui/components/AssistantMessage.d.ts.map +1 -1
  130. package/dist/ui/components/AssistantMessage.js +9 -4
  131. package/dist/ui/components/AssistantMessage.js.map +1 -1
  132. package/dist/ui/components/AssistantMessage.test.d.ts +2 -0
  133. package/dist/ui/components/AssistantMessage.test.d.ts.map +1 -0
  134. package/dist/ui/components/AssistantMessage.test.js +369 -0
  135. package/dist/ui/components/AssistantMessage.test.js.map +1 -0
  136. package/dist/ui/components/BackgroundTasksBar.d.ts +1 -3
  137. package/dist/ui/components/BackgroundTasksBar.d.ts.map +1 -1
  138. package/dist/ui/components/BackgroundTasksBar.js +2 -4
  139. package/dist/ui/components/BackgroundTasksBar.js.map +1 -1
  140. package/dist/ui/components/Banner.d.ts +1 -3
  141. package/dist/ui/components/Banner.d.ts.map +1 -1
  142. package/dist/ui/components/Banner.js +7 -3
  143. package/dist/ui/components/Banner.js.map +1 -1
  144. package/dist/ui/components/Footer.d.ts +26 -4
  145. package/dist/ui/components/Footer.d.ts.map +1 -1
  146. package/dist/ui/components/Footer.js +73 -21
  147. package/dist/ui/components/Footer.js.map +1 -1
  148. package/dist/ui/components/GoalOverlay.d.ts +28 -20
  149. package/dist/ui/components/GoalOverlay.d.ts.map +1 -1
  150. package/dist/ui/components/GoalOverlay.js +283 -253
  151. package/dist/ui/components/GoalOverlay.js.map +1 -1
  152. package/dist/ui/components/InputArea.d.ts +2 -6
  153. package/dist/ui/components/InputArea.d.ts.map +1 -1
  154. package/dist/ui/components/InputArea.js +40 -32
  155. package/dist/ui/components/InputArea.js.map +1 -1
  156. package/dist/ui/components/InputArea.test.js +11 -1
  157. package/dist/ui/components/InputArea.test.js.map +1 -1
  158. package/dist/ui/components/Markdown.d.ts +11 -11
  159. package/dist/ui/components/Markdown.d.ts.map +1 -1
  160. package/dist/ui/components/Markdown.js +25 -198
  161. package/dist/ui/components/Markdown.js.map +1 -1
  162. package/dist/ui/components/PlanOverlay.d.ts.map +1 -1
  163. package/dist/ui/components/PlanOverlay.js +1 -1
  164. package/dist/ui/components/PlanOverlay.js.map +1 -1
  165. package/dist/ui/components/ServerToolExecution.d.ts.map +1 -1
  166. package/dist/ui/components/ServerToolExecution.js +3 -2
  167. package/dist/ui/components/ServerToolExecution.js.map +1 -1
  168. package/dist/ui/components/SlashCommandMenu.d.ts +4 -3
  169. package/dist/ui/components/SlashCommandMenu.d.ts.map +1 -1
  170. package/dist/ui/components/SlashCommandMenu.js +38 -26
  171. package/dist/ui/components/SlashCommandMenu.js.map +1 -1
  172. package/dist/ui/components/StreamingArea.d.ts +11 -2
  173. package/dist/ui/components/StreamingArea.d.ts.map +1 -1
  174. package/dist/ui/components/StreamingArea.js +20 -23
  175. package/dist/ui/components/StreamingArea.js.map +1 -1
  176. package/dist/ui/components/StreamingArea.test.d.ts +2 -0
  177. package/dist/ui/components/StreamingArea.test.d.ts.map +1 -0
  178. package/dist/ui/components/StreamingArea.test.js +18 -0
  179. package/dist/ui/components/StreamingArea.test.js.map +1 -0
  180. package/dist/ui/components/ToolExecution.d.ts.map +1 -1
  181. package/dist/ui/components/ToolExecution.js +11 -27
  182. package/dist/ui/components/ToolExecution.js.map +1 -1
  183. package/dist/ui/components/ToolGroupExecution.d.ts.map +1 -1
  184. package/dist/ui/components/ToolGroupExecution.js +9 -124
  185. package/dist/ui/components/ToolGroupExecution.js.map +1 -1
  186. package/dist/ui/components/UserMessage.d.ts.map +1 -1
  187. package/dist/ui/components/UserMessage.js +15 -10
  188. package/dist/ui/components/UserMessage.js.map +1 -1
  189. package/dist/ui/components/UserMessage.test.d.ts +2 -0
  190. package/dist/ui/components/UserMessage.test.d.ts.map +1 -0
  191. package/dist/ui/components/UserMessage.test.js +39 -0
  192. package/dist/ui/components/UserMessage.test.js.map +1 -0
  193. package/dist/ui/footer-status-layout.test.js +21 -7
  194. package/dist/ui/footer-status-layout.test.js.map +1 -1
  195. package/dist/ui/goal-events.d.ts +8 -0
  196. package/dist/ui/goal-events.d.ts.map +1 -1
  197. package/dist/ui/goal-events.js +28 -8
  198. package/dist/ui/goal-events.js.map +1 -1
  199. package/dist/ui/goal-events.test.js +40 -2
  200. package/dist/ui/goal-events.test.js.map +1 -1
  201. package/dist/ui/goal-lifecycle-orchestration.test.js +127 -34
  202. package/dist/ui/goal-lifecycle-orchestration.test.js.map +1 -1
  203. package/dist/ui/goal-overlay.test.js +122 -44
  204. package/dist/ui/goal-overlay.test.js.map +1 -1
  205. package/dist/ui/goal-summary.d.ts +14 -0
  206. package/dist/ui/goal-summary.d.ts.map +1 -0
  207. package/dist/ui/goal-summary.js +194 -0
  208. package/dist/ui/goal-summary.js.map +1 -0
  209. package/dist/ui/hooks/useAgentLoop.d.ts +8 -2
  210. package/dist/ui/hooks/useAgentLoop.d.ts.map +1 -1
  211. package/dist/ui/hooks/useAgentLoop.js +20 -9
  212. package/dist/ui/hooks/useAgentLoop.js.map +1 -1
  213. package/dist/ui/hooks/useAgentLoop.test.d.ts +2 -0
  214. package/dist/ui/hooks/useAgentLoop.test.d.ts.map +1 -0
  215. package/dist/ui/hooks/useAgentLoop.test.js +8 -0
  216. package/dist/ui/hooks/useAgentLoop.test.js.map +1 -0
  217. package/dist/ui/hooks/useTerminalSize.d.ts +5 -9
  218. package/dist/ui/hooks/useTerminalSize.d.ts.map +1 -1
  219. package/dist/ui/hooks/useTerminalSize.js +9 -14
  220. package/dist/ui/hooks/useTerminalSize.js.map +1 -1
  221. package/dist/ui/live-item-flush.d.ts +2 -2
  222. package/dist/ui/live-item-flush.d.ts.map +1 -1
  223. package/dist/ui/live-item-flush.js +8 -4
  224. package/dist/ui/live-item-flush.js.map +1 -1
  225. package/dist/ui/long-prompt-regression-harness.test.d.ts +2 -0
  226. package/dist/ui/long-prompt-regression-harness.test.d.ts.map +1 -0
  227. package/dist/ui/long-prompt-regression-harness.test.js +195 -0
  228. package/dist/ui/long-prompt-regression-harness.test.js.map +1 -0
  229. package/dist/ui/plan-overlay.test.js +7 -29
  230. package/dist/ui/plan-overlay.test.js.map +1 -1
  231. package/dist/ui/queued-message.test.d.ts.map +1 -1
  232. package/dist/ui/queued-message.test.js +76 -14
  233. package/dist/ui/queued-message.test.js.map +1 -1
  234. package/dist/ui/render.d.ts +21 -24
  235. package/dist/ui/render.d.ts.map +1 -1
  236. package/dist/ui/render.js +46 -28
  237. package/dist/ui/render.js.map +1 -1
  238. package/dist/ui/render.test.d.ts +2 -0
  239. package/dist/ui/render.test.d.ts.map +1 -0
  240. package/dist/ui/render.test.js +16 -0
  241. package/dist/ui/render.test.js.map +1 -0
  242. package/dist/ui/scroll-stabilization.test.js +1 -1
  243. package/dist/ui/scroll-stabilization.test.js.map +1 -1
  244. package/dist/ui/slash-command-images.test.js +79 -4
  245. package/dist/ui/slash-command-images.test.js.map +1 -1
  246. package/dist/ui/terminal-history.d.ts +26 -0
  247. package/dist/ui/terminal-history.d.ts.map +1 -0
  248. package/dist/ui/terminal-history.js +910 -0
  249. package/dist/ui/terminal-history.js.map +1 -0
  250. package/dist/ui/terminal-history.test.d.ts +2 -0
  251. package/dist/ui/terminal-history.test.d.ts.map +1 -0
  252. package/dist/ui/terminal-history.test.js +314 -0
  253. package/dist/ui/terminal-history.test.js.map +1 -0
  254. package/dist/ui/tool-group-summary.d.ts +16 -0
  255. package/dist/ui/tool-group-summary.d.ts.map +1 -0
  256. package/dist/ui/tool-group-summary.js +123 -0
  257. package/dist/ui/tool-group-summary.js.map +1 -0
  258. package/dist/ui/tui-history-parity.test.d.ts +2 -0
  259. package/dist/ui/tui-history-parity.test.d.ts.map +1 -0
  260. package/dist/ui/tui-history-parity.test.js +243 -0
  261. package/dist/ui/tui-history-parity.test.js.map +1 -0
  262. package/dist/ui/utils/assistant-stream-split.d.ts +6 -0
  263. package/dist/ui/utils/assistant-stream-split.d.ts.map +1 -0
  264. package/dist/ui/utils/assistant-stream-split.js +37 -0
  265. package/dist/ui/utils/assistant-stream-split.js.map +1 -0
  266. package/dist/ui/utils/assistant-stream-split.test.d.ts +2 -0
  267. package/dist/ui/utils/assistant-stream-split.test.d.ts.map +1 -0
  268. package/dist/ui/utils/assistant-stream-split.test.js +58 -0
  269. package/dist/ui/utils/assistant-stream-split.test.js.map +1 -0
  270. package/dist/ui/utils/latex-to-unicode.d.ts +22 -0
  271. package/dist/ui/utils/latex-to-unicode.d.ts.map +1 -0
  272. package/dist/ui/utils/latex-to-unicode.js +538 -0
  273. package/dist/ui/utils/latex-to-unicode.js.map +1 -0
  274. package/dist/ui/utils/markdown-renderer.d.ts +20 -0
  275. package/dist/ui/utils/markdown-renderer.d.ts.map +1 -0
  276. package/dist/ui/utils/markdown-renderer.js +327 -0
  277. package/dist/ui/utils/markdown-renderer.js.map +1 -0
  278. package/dist/ui/utils/markdown-table.d.ts +9 -0
  279. package/dist/ui/utils/markdown-table.d.ts.map +1 -0
  280. package/dist/ui/utils/markdown-table.js +95 -0
  281. package/dist/ui/utils/markdown-table.js.map +1 -0
  282. package/dist/ui/utils/text-utils.d.ts +8 -0
  283. package/dist/ui/utils/text-utils.d.ts.map +1 -0
  284. package/dist/ui/utils/text-utils.js +16 -0
  285. package/dist/ui/utils/text-utils.js.map +1 -0
  286. package/dist/ui/utils/token-to-ansi.js +19 -9
  287. package/dist/ui/utils/token-to-ansi.js.map +1 -1
  288. package/dist/ui/utils/user-message-display.d.ts +7 -0
  289. package/dist/ui/utils/user-message-display.d.ts.map +1 -0
  290. package/dist/ui/utils/user-message-display.js +26 -0
  291. package/dist/ui/utils/user-message-display.js.map +1 -0
  292. package/dist/utils/format.js +0 -9
  293. package/dist/utils/format.js.map +1 -1
  294. package/package.json +9 -5
  295. package/dist/tools/enter-plan.d.ts +0 -8
  296. package/dist/tools/enter-plan.d.ts.map +0 -1
  297. package/dist/tools/enter-plan.js +0 -30
  298. package/dist/tools/enter-plan.js.map +0 -1
  299. package/dist/tools/exit-plan.d.ts +0 -8
  300. package/dist/tools/exit-plan.d.ts.map +0 -1
  301. package/dist/tools/exit-plan.js +0 -36
  302. package/dist/tools/exit-plan.js.map +0 -1
  303. package/dist/tools/tasks.d.ts +0 -16
  304. package/dist/tools/tasks.d.ts.map +0 -1
  305. package/dist/tools/tasks.js +0 -133
  306. package/dist/tools/tasks.js.map +0 -1
  307. package/dist/ui/components/EyesOverlay.d.ts +0 -10
  308. package/dist/ui/components/EyesOverlay.d.ts.map +0 -1
  309. package/dist/ui/components/EyesOverlay.js +0 -220
  310. package/dist/ui/components/EyesOverlay.js.map +0 -1
  311. package/dist/ui/components/TaskOverlay.d.ts +0 -10
  312. package/dist/ui/components/TaskOverlay.d.ts.map +0 -1
  313. package/dist/ui/components/TaskOverlay.js +0 -267
  314. package/dist/ui/components/TaskOverlay.js.map +0 -1
@@ -0,0 +1,538 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Converts common LaTeX-style syntax in model output into terminal-friendly
8
+ * Unicode (and lightweight markdown where appropriate).
9
+ *
10
+ * Terminals cannot natively render LaTeX, but model responses — especially for
11
+ * math, CS, and algorithms — frequently include constructs like `$\{P_0,
12
+ * \dots, P_n\}$` or `$\to$`. Left as-is, the raw backslash commands show up
13
+ * verbatim and make the output look broken.
14
+ *
15
+ * This function is a conservative, lossy post-processor that handles the
16
+ * common cases and leaves anything it does not recognise untouched, so that
17
+ * legitimate backslash content (e.g. Windows paths, regex examples) is not
18
+ * mangled.
19
+ *
20
+ * See issue #25656.
21
+ */
22
+ // Greek letters, lower and upper case, plus the common "var" variants.
23
+ const GREEK_LETTERS = Object.freeze({
24
+ alpha: "α",
25
+ beta: "β",
26
+ gamma: "γ",
27
+ delta: "δ",
28
+ epsilon: "ε",
29
+ zeta: "ζ",
30
+ eta: "η",
31
+ theta: "θ",
32
+ iota: "ι",
33
+ kappa: "κ",
34
+ lambda: "λ",
35
+ mu: "μ",
36
+ nu: "ν",
37
+ xi: "ξ",
38
+ omicron: "ο",
39
+ pi: "π",
40
+ rho: "ρ",
41
+ sigma: "σ",
42
+ tau: "τ",
43
+ upsilon: "υ",
44
+ phi: "φ",
45
+ chi: "χ",
46
+ psi: "ψ",
47
+ omega: "ω",
48
+ Alpha: "Α",
49
+ Beta: "Β",
50
+ Gamma: "Γ",
51
+ Delta: "Δ",
52
+ Epsilon: "Ε",
53
+ Zeta: "Ζ",
54
+ Eta: "Η",
55
+ Theta: "Θ",
56
+ Iota: "Ι",
57
+ Kappa: "Κ",
58
+ Lambda: "Λ",
59
+ Mu: "Μ",
60
+ Nu: "Ν",
61
+ Xi: "Ξ",
62
+ Omicron: "Ο",
63
+ Pi: "Π",
64
+ Rho: "Ρ",
65
+ Sigma: "Σ",
66
+ Tau: "Τ",
67
+ Upsilon: "Υ",
68
+ Phi: "Φ",
69
+ Chi: "Χ",
70
+ Psi: "Ψ",
71
+ Omega: "Ω",
72
+ varepsilon: "ε",
73
+ vartheta: "ϑ",
74
+ varphi: "φ",
75
+ varrho: "ϱ",
76
+ varsigma: "ς",
77
+ varpi: "ϖ",
78
+ });
79
+ // Named LaTeX commands → Unicode. Covers arrows, relations, set theory,
80
+ // logic, large operators, and a handful of common decorations. Anything not
81
+ // listed here is deliberately left untouched.
82
+ const LATEX_COMMANDS = Object.freeze({
83
+ // Arrows
84
+ to: "→",
85
+ rightarrow: "→",
86
+ Rightarrow: "⇒",
87
+ leftarrow: "←",
88
+ Leftarrow: "⇐",
89
+ leftrightarrow: "↔",
90
+ Leftrightarrow: "⇔",
91
+ mapsto: "↦",
92
+ longrightarrow: "⟶",
93
+ longleftarrow: "⟵",
94
+ longleftrightarrow: "⟷",
95
+ uparrow: "↑",
96
+ downarrow: "↓",
97
+ Uparrow: "⇑",
98
+ Downarrow: "⇓",
99
+ hookrightarrow: "↪",
100
+ hookleftarrow: "↩",
101
+ // Ellipses
102
+ dots: "…",
103
+ ldots: "…",
104
+ cdots: "⋯",
105
+ vdots: "⋮",
106
+ ddots: "⋱",
107
+ // Arithmetic / comparison
108
+ times: "×",
109
+ cdot: "·",
110
+ div: "÷",
111
+ pm: "±",
112
+ mp: "∓",
113
+ ast: "∗",
114
+ leq: "≤",
115
+ le: "≤",
116
+ geq: "≥",
117
+ ge: "≥",
118
+ neq: "≠",
119
+ ne: "≠",
120
+ ll: "≪",
121
+ gg: "≫",
122
+ approx: "≈",
123
+ equiv: "≡",
124
+ sim: "∼",
125
+ simeq: "≃",
126
+ cong: "≅",
127
+ propto: "∝",
128
+ // Set theory
129
+ in: "∈",
130
+ notin: "∉",
131
+ ni: "∋",
132
+ subset: "⊂",
133
+ supset: "⊃",
134
+ subseteq: "⊆",
135
+ supseteq: "⊇",
136
+ cup: "∪",
137
+ cap: "∩",
138
+ setminus: "∖",
139
+ emptyset: "∅",
140
+ varnothing: "∅",
141
+ // Logic
142
+ forall: "∀",
143
+ exists: "∃",
144
+ nexists: "∄",
145
+ neg: "¬",
146
+ lnot: "¬",
147
+ land: "∧",
148
+ wedge: "∧",
149
+ lor: "∨",
150
+ vee: "∨",
151
+ oplus: "⊕",
152
+ otimes: "⊗",
153
+ implies: "⟹",
154
+ iff: "⟺",
155
+ // Large operators
156
+ sum: "∑",
157
+ prod: "∏",
158
+ coprod: "∐",
159
+ int: "∫",
160
+ iint: "∬",
161
+ iiint: "∭",
162
+ oint: "∮",
163
+ // Calculus
164
+ partial: "∂",
165
+ nabla: "∇",
166
+ infty: "∞",
167
+ // Misc letters / constants
168
+ ell: "ℓ",
169
+ hbar: "ℏ",
170
+ Re: "ℜ",
171
+ Im: "ℑ",
172
+ aleph: "ℵ",
173
+ beth: "ℶ",
174
+ // Brackets / delimiters
175
+ lbrace: "{",
176
+ rbrace: "}",
177
+ lbrack: "[",
178
+ rbrack: "]",
179
+ langle: "⟨",
180
+ rangle: "⟩",
181
+ lceil: "⌈",
182
+ rceil: "⌉",
183
+ lfloor: "⌊",
184
+ rfloor: "⌋",
185
+ // Geometry / misc
186
+ perp: "⊥",
187
+ parallel: "∥",
188
+ angle: "∠",
189
+ triangle: "△",
190
+ square: "□",
191
+ circ: "∘",
192
+ bullet: "•",
193
+ star: "⋆",
194
+ prime: "′",
195
+ dag: "†",
196
+ ddag: "‡",
197
+ therefore: "∴",
198
+ because: "∵",
199
+ top: "⊤",
200
+ bot: "⊥",
201
+ // Operator names (`\log`, `\sin`, …) render in LaTeX as upright text. In a
202
+ // terminal the closest equivalent is the lowercase word itself.
203
+ log: "log",
204
+ ln: "ln",
205
+ lg: "lg",
206
+ exp: "exp",
207
+ sin: "sin",
208
+ cos: "cos",
209
+ tan: "tan",
210
+ cot: "cot",
211
+ sec: "sec",
212
+ csc: "csc",
213
+ arcsin: "arcsin",
214
+ arccos: "arccos",
215
+ arctan: "arctan",
216
+ sinh: "sinh",
217
+ cosh: "cosh",
218
+ tanh: "tanh",
219
+ max: "max",
220
+ min: "min",
221
+ sup: "sup",
222
+ inf: "inf",
223
+ lim: "lim",
224
+ limsup: "lim sup",
225
+ liminf: "lim inf",
226
+ arg: "arg",
227
+ det: "det",
228
+ dim: "dim",
229
+ ker: "ker",
230
+ gcd: "gcd",
231
+ deg: "deg",
232
+ hom: "hom",
233
+ mod: "mod",
234
+ bmod: "mod",
235
+ pmod: "mod",
236
+ // Whitespace commands — render as visible space so layout is roughly right.
237
+ quad: " ",
238
+ qquad: " ",
239
+ // These are all "thin-space" style commands in LaTeX; render as a single
240
+ // space so the surrounding tokens don't jam together.
241
+ ",": " ",
242
+ ";": " ",
243
+ ":": " ",
244
+ "!": "",
245
+ });
246
+ // Unicode subscript mappings (digits, operators, and the common letters that
247
+ // have full-height subscript glyphs in Unicode).
248
+ const SUBSCRIPT_MAP = Object.freeze({
249
+ "0": "₀",
250
+ "1": "₁",
251
+ "2": "₂",
252
+ "3": "₃",
253
+ "4": "₄",
254
+ "5": "₅",
255
+ "6": "₆",
256
+ "7": "₇",
257
+ "8": "₈",
258
+ "9": "₉",
259
+ "+": "₊",
260
+ "-": "₋",
261
+ "=": "₌",
262
+ "(": "₍",
263
+ ")": "₎",
264
+ a: "ₐ",
265
+ e: "ₑ",
266
+ h: "ₕ",
267
+ i: "ᵢ",
268
+ j: "ⱼ",
269
+ k: "ₖ",
270
+ l: "ₗ",
271
+ m: "ₘ",
272
+ n: "ₙ",
273
+ o: "ₒ",
274
+ p: "ₚ",
275
+ r: "ᵣ",
276
+ s: "ₛ",
277
+ t: "ₜ",
278
+ u: "ᵤ",
279
+ v: "ᵥ",
280
+ x: "ₓ",
281
+ });
282
+ // Unicode superscript mappings. A superset of subscripts — most letters have
283
+ // superscript glyphs.
284
+ const SUPERSCRIPT_MAP = Object.freeze({
285
+ "0": "⁰",
286
+ "1": "¹",
287
+ "2": "²",
288
+ "3": "³",
289
+ "4": "⁴",
290
+ "5": "⁵",
291
+ "6": "⁶",
292
+ "7": "⁷",
293
+ "8": "⁸",
294
+ "9": "⁹",
295
+ "+": "⁺",
296
+ "-": "⁻",
297
+ "=": "⁼",
298
+ "(": "⁽",
299
+ ")": "⁾",
300
+ a: "ᵃ",
301
+ b: "ᵇ",
302
+ c: "ᶜ",
303
+ d: "ᵈ",
304
+ e: "ᵉ",
305
+ f: "ᶠ",
306
+ g: "ᵍ",
307
+ h: "ʰ",
308
+ i: "ⁱ",
309
+ j: "ʲ",
310
+ k: "ᵏ",
311
+ l: "ˡ",
312
+ m: "ᵐ",
313
+ n: "ⁿ",
314
+ o: "ᵒ",
315
+ p: "ᵖ",
316
+ r: "ʳ",
317
+ s: "ˢ",
318
+ t: "ᵗ",
319
+ u: "ᵘ",
320
+ v: "ᵛ",
321
+ w: "ʷ",
322
+ x: "ˣ",
323
+ y: "ʸ",
324
+ z: "ᶻ",
325
+ });
326
+ /**
327
+ * Strips `$...$` and `$$...$$` math delimiters when the inner content looks
328
+ * like math, applying the full set of math-mode conversions (including
329
+ * sub/superscripts) to the inner text. The goal is to handle model output
330
+ * without eating dollar signs that appear in ordinary prose (prices,
331
+ * shell examples, etc.).
332
+ *
333
+ * A pair of `$...$` is treated as math when the inner text either:
334
+ * - contains a LaTeX marker (`\command`, `_`, `^`), or
335
+ * - is a single letter, possibly with whitespace padding (e.g. `$x$`,
336
+ * `$ n $`). Shell-style variables like `$USER` are LEFT intact because
337
+ * multi-letter all-caps sequences look much more like shell vars than
338
+ * math in practice.
339
+ *
340
+ * A currency expression like `$5.99` (single `$`) never matches the pair
341
+ * regex. `From $5 to $10` matches `$5 to $` as a pair but the inner text is
342
+ * neither mathy nor a single variable, so it is left intact.
343
+ */
344
+ function stripMathDelimiters(text) {
345
+ // Display math first, greedy-safe with non-dollar inner class.
346
+ let out = text.replace(/\$\$([^$]+)\$\$/g, (_, inner) => applyMathModeConversions(inner));
347
+ // Inline math: lazy, single-line to avoid eating across paragraphs.
348
+ out = out.replace(/\$([^$\n]+?)\$/g, (match, inner) => {
349
+ const hasLatexMarkers = /\\[A-Za-z]|[\\_^]/.test(inner);
350
+ const isSingleVariable = /^\s*[A-Za-z]\s*$/.test(inner);
351
+ if (hasLatexMarkers || isSingleVariable) {
352
+ return applyMathModeConversions(inner);
353
+ }
354
+ return match;
355
+ });
356
+ return out;
357
+ }
358
+ /**
359
+ * Converts `\textbf{..}`, `\textit{..}`, `\emph{..}`, `\text{..}`,
360
+ * `\mathrm{..}`, `\mathbf{..}`, `\mathit{..}`, `\mathsf{..}`, `\mathtt{..}`,
361
+ * and `\operatorname{..}` into markdown-equivalent wrappers or plain text so
362
+ * the regular inline parser picks them up downstream.
363
+ *
364
+ * Only handles a single level of nesting (no inner braces) — this keeps the
365
+ * regex bounded and avoids catastrophic backtracking on adversarial input.
366
+ */
367
+ function convertTextFormatting(text) {
368
+ let out = text;
369
+ out = out.replace(/\\(?:textbf|mathbf)\{([^{}]*)\}/g, (_, inner) => `**${inner}**`);
370
+ out = out.replace(/\\(?:textit|emph|mathit)\{([^{}]*)\}/g, (_, inner) => `*${inner}*`);
371
+ out = out.replace(/\\(?:text|mathrm|mathsf|mathtt|mathbb|mathcal|mathfrak|operatorname)\{([^{}]*)\}/g, (_, inner) => inner);
372
+ return out;
373
+ }
374
+ /**
375
+ * Handles `\frac{a}{b}` → `(a)/(b)` and `\sqrt{x}` → `√(x)`.
376
+ * Only a single level of braces is supported.
377
+ */
378
+ function convertFractionsAndRoots(text) {
379
+ let out = text;
380
+ out = out.replace(/\\frac\{([^{}]*)\}\{([^{}]*)\}/g, (_, num, den) => `(${num})/(${den})`);
381
+ out = out.replace(/\\sqrt\[([^\]]*)\]\{([^{}]*)\}/g, (_, index, radicand) => `${index}√(${radicand})`);
382
+ out = out.replace(/\\sqrt\{([^{}]*)\}/g, (_, radicand) => `√(${radicand})`);
383
+ return out;
384
+ }
385
+ /**
386
+ * Converts escaped single-character specials (`\{` → `{`, `\_` → `_`, etc.).
387
+ * Runs before command lookup so `\{` is not misread as a command named `{`.
388
+ */
389
+ function convertEscapedSpecials(text) {
390
+ // The set is intentionally narrow: only characters that have meaning in
391
+ // LaTeX and also appear unescaped in plain text. We do not unescape `\\`
392
+ // (line break) here — it is handled separately.
393
+ let out = text.replace(/\\([{}[\]_%&#$|])/g, (_, ch) => ch);
394
+ // `\ ` (backslash + space) is LaTeX for a non-breaking space; just keep it
395
+ // as a regular space so words do not collide.
396
+ out = out.replace(/\\ /g, " ");
397
+ return out;
398
+ }
399
+ /**
400
+ * Converts named commands (alphabetic control sequences) to Unicode. Anything
401
+ * not in the tables is left as-is so unrelated backslash content
402
+ * (e.g. Windows paths) is not disturbed.
403
+ */
404
+ function convertNamedCommands(text) {
405
+ return text.replace(/\\([A-Za-z]+)(?![A-Za-z])/g, (match, name) => GREEK_LETTERS[name] ?? LATEX_COMMANDS[name] ?? match);
406
+ }
407
+ /**
408
+ * Converts the short-form punctuation commands `\,`, `\;`, `\:`, `\!` used
409
+ * for spacing in LaTeX. These are handled separately from alphabetic commands
410
+ * because the regex for the latter only matches letters.
411
+ */
412
+ function convertPunctuationCommands(text) {
413
+ // `\,`, `\;`, `\:` all render as a single space; `\!` is a negative space
414
+ // and is stripped.
415
+ return text.replace(/\\([,;:!])/g, (_, ch) => {
416
+ switch (ch) {
417
+ case ",":
418
+ case ";":
419
+ case ":":
420
+ return " ";
421
+ case "!":
422
+ return "";
423
+ default:
424
+ return ch;
425
+ }
426
+ });
427
+ }
428
+ /**
429
+ * Converts the `\\` line-break command (used inside math environments and
430
+ * tables) to a literal newline. Must run after `\` specials but before any
431
+ * other regex that might see a lingering backslash.
432
+ */
433
+ function convertLineBreaks(text) {
434
+ return text.replace(/\\\\/g, "\n");
435
+ }
436
+ /**
437
+ * Converts subscripts and superscripts to Unicode where every character in
438
+ * the operand maps. If any character has no mapping the whole operand is
439
+ * left alone, to avoid "half-converted" output that looks worse than no
440
+ * conversion.
441
+ */
442
+ function convertSubSuperScripts(text) {
443
+ // Braced form first: x_{...}, x^{...}. We only support BMP characters (the
444
+ // mapping tables are ASCII-only), so iterating with `Array.from` over code
445
+ // units is safe and keeps the lint rule against splitting strings happy.
446
+ const charsOf = (s) => Array.from(s);
447
+ let out = text.replace(/_\{([^{}]+)\}/g, (match, inner) => {
448
+ const chars = charsOf(inner);
449
+ if (chars.every((c) => SUBSCRIPT_MAP[c] !== undefined)) {
450
+ return chars.map((c) => SUBSCRIPT_MAP[c]).join("");
451
+ }
452
+ return match;
453
+ });
454
+ out = out.replace(/\^\{([^{}]+)\}/g, (match, inner) => {
455
+ const chars = charsOf(inner);
456
+ if (chars.every((c) => SUPERSCRIPT_MAP[c] !== undefined)) {
457
+ return chars.map((c) => SUPERSCRIPT_MAP[c]).join("");
458
+ }
459
+ return match;
460
+ });
461
+ // Single-character form: x_0, x^2. Only convert when the character actually
462
+ // has a mapping — leaves `file_name` and `foo^bar` alone.
463
+ out = out.replace(/([A-Za-z0-9)\]])_([A-Za-z0-9+\-=()])/g, (match, base, c) => {
464
+ const sub = SUBSCRIPT_MAP[c];
465
+ return sub ? `${base}${sub}` : match;
466
+ });
467
+ out = out.replace(/([A-Za-z0-9)\]])\^([A-Za-z0-9+\-=()])/g, (match, base, c) => {
468
+ const sup = SUPERSCRIPT_MAP[c];
469
+ return sup ? `${base}${sup}` : match;
470
+ });
471
+ return out;
472
+ }
473
+ /**
474
+ * Applies the full set of conversions that make sense inside a LaTeX math
475
+ * region (i.e. text that was originally wrapped in `$...$`). This includes
476
+ * sub/superscripts, which are NOT safe to apply to arbitrary prose because
477
+ * they would mangle identifiers like `file_name`.
478
+ */
479
+ function applyMathModeConversions(text) {
480
+ let out = text;
481
+ out = convertTextFormatting(out);
482
+ out = convertFractionsAndRoots(out);
483
+ out = convertEscapedSpecials(out);
484
+ out = convertLineBreaks(out);
485
+ out = convertNamedCommands(out);
486
+ out = convertPunctuationCommands(out);
487
+ out = convertSubSuperScripts(out);
488
+ return out;
489
+ }
490
+ /**
491
+ * Applies conversions that are safe to run on arbitrary prose — anything
492
+ * keyed off explicit LaTeX tokens like `\alpha`, `\textbf{...}`, `\to`. Does
493
+ * NOT touch standalone `_` or `^` so identifiers and snake_case names are
494
+ * preserved.
495
+ */
496
+ function applyProseConversions(text) {
497
+ let out = text;
498
+ out = convertTextFormatting(out);
499
+ out = convertFractionsAndRoots(out);
500
+ out = convertEscapedSpecials(out);
501
+ // Deliberately NOT running convertLineBreaks here: outside math delimiters
502
+ // `\\` is far more likely to be a Windows UNC path (`\\server\share`) or an
503
+ // escaped backslash in code-like prose than a LaTeX line break. Legitimate
504
+ // LaTeX line breaks belong inside `$...$` or `$$...$$` and are handled by
505
+ // applyMathModeConversions. See PR #25802 review.
506
+ out = convertNamedCommands(out);
507
+ out = convertPunctuationCommands(out);
508
+ return out;
509
+ }
510
+ /**
511
+ * Top-level entry point. Two-phase conversion:
512
+ *
513
+ * 1. Strip `$...$` / `$$...$$` math regions, applying math-mode conversions
514
+ * (including sub/superscripts) to the inner text. The heuristic for
515
+ * "this dollar pair is math" runs against the ORIGINAL input so that
516
+ * model-authored LaTeX is recognised before any tokens are rewritten.
517
+ *
518
+ * 2. Run prose-safe conversions over the remaining text, catching
519
+ * unwrapped LaTeX tokens (`\alpha`, `\to`, `\textbf{...}`) that the
520
+ * model emitted outside math delimiters.
521
+ *
522
+ * Short-circuits on input that has no LaTeX markers at all (`\` or `$`) so
523
+ * the hot rendering path stays cheap for ordinary prose.
524
+ */
525
+ export function convertLatexToUnicode(input) {
526
+ if (!input)
527
+ return input;
528
+ // Fast path: if there's no backslash and no dollar sign, there's nothing to
529
+ // convert. This keeps the hot rendering path inexpensive for ordinary text.
530
+ if (input.indexOf("\\") === -1 && input.indexOf("$") === -1) {
531
+ return input;
532
+ }
533
+ let text = input;
534
+ text = stripMathDelimiters(text);
535
+ text = applyProseConversions(text);
536
+ return text;
537
+ }
538
+ //# sourceMappingURL=latex-to-unicode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"latex-to-unicode.js","sourceRoot":"","sources":["../../../src/ui/utils/latex-to-unicode.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;GAeG;AAEH,uEAAuE;AACvE,MAAM,aAAa,GAAqC,MAAM,CAAC,MAAM,CAAC;IACpE,KAAK,EAAE,GAAG;IACV,IAAI,EAAE,GAAG;IACT,KAAK,EAAE,GAAG;IACV,KAAK,EAAE,GAAG;IACV,OAAO,EAAE,GAAG;IACZ,IAAI,EAAE,GAAG;IACT,GAAG,EAAE,GAAG;IACR,KAAK,EAAE,GAAG;IACV,IAAI,EAAE,GAAG;IACT,KAAK,EAAE,GAAG;IACV,MAAM,EAA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C;QAC5D,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,IAAI,GAAG,KAAK,CAAC;IACjB,IAAI,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;IACnC,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { Theme } from "../theme/theme.js";
2
+ export declare function renderInlineMarkdownToAnsi(rawText: string, theme: Theme, defaultColor?: string): string;
3
+ export declare function wrapAnsiMarkdownLine(text: string, width: number): string[];
4
+ export declare function renderMarkdownCodeBlockToAnsi({ content, language, maxWidth, theme, hideLineNumbers, }: {
5
+ content: readonly string[];
6
+ language?: string | null;
7
+ maxWidth: number;
8
+ theme: Theme;
9
+ hideLineNumbers?: boolean;
10
+ }): string[];
11
+ export interface RenderMarkdownToAnsiOptions {
12
+ text: string;
13
+ theme: Theme;
14
+ width: number;
15
+ isPending?: boolean;
16
+ availableTerminalHeight?: number;
17
+ renderMarkdown?: boolean;
18
+ }
19
+ export declare function renderMarkdownToAnsiLines({ text, theme, width, isPending, availableTerminalHeight, renderMarkdown, }: RenderMarkdownToAnsiOptions): string[];
20
+ //# sourceMappingURL=markdown-renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown-renderer.d.ts","sourceRoot":"","sources":["../../../src/ui/utils/markdown-renderer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AA2B/C,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,KAAK,EACZ,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,CAsER;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAE1E;AAwED,wBAAgB,6BAA6B,CAAC,EAC5C,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,eAAuB,GACxB,EAAE;IACD,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;IACb,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,GAAG,MAAM,EAAE,CASX;AAED,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,wBAAgB,yBAAyB,CAAC,EACxC,IAAI,EACJ,KAAK,EACL,KAAK,EACL,SAAiB,EACjB,uBAAuB,EACvB,cAAqB,GACtB,EAAE,2BAA2B,GAAG,MAAM,EAAE,CAkLxC"}