@selesai/code 0.9.15 → 0.10.1

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 (269) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +6 -9
  3. package/dist/defaults/models.json +2 -2
  4. package/dist/defaults/settings.json +3 -7
  5. package/dist/extensions/package.json +2 -4
  6. package/dist/extensions/pi-zentui/.editorconfig +12 -0
  7. package/dist/extensions/pi-zentui/.github/CODEOWNERS +1 -0
  8. package/dist/extensions/pi-zentui/.github/ISSUE_TEMPLATE/bug_report.yml +110 -0
  9. package/dist/extensions/pi-zentui/.github/ISSUE_TEMPLATE/config.yml +8 -0
  10. package/dist/extensions/pi-zentui/.github/ISSUE_TEMPLATE/config_question.yml +56 -0
  11. package/dist/extensions/pi-zentui/.github/ISSUE_TEMPLATE/feature_request.yml +63 -0
  12. package/dist/extensions/pi-zentui/.github/ISSUE_TEMPLATE/rendering_issue.yml +106 -0
  13. package/dist/extensions/pi-zentui/.github/ISSUE_TEMPLATE/runtime_detection.yml +103 -0
  14. package/dist/extensions/pi-zentui/.github/dependabot.yml +47 -0
  15. package/dist/extensions/pi-zentui/.github/pull_request_template.md +34 -0
  16. package/dist/extensions/pi-zentui/.github/release.yml +18 -0
  17. package/dist/extensions/pi-zentui/.github/workflows/ci.yml +79 -0
  18. package/dist/extensions/pi-zentui/.github/workflows/publish.yml +63 -0
  19. package/dist/extensions/pi-zentui/AGENTS.md +107 -0
  20. package/dist/extensions/pi-zentui/CONTRIBUTING.md +68 -0
  21. package/dist/extensions/pi-zentui/LICENSE +21 -0
  22. package/dist/extensions/pi-zentui/README.md +188 -0
  23. package/dist/extensions/pi-zentui/SECURITY.md +18 -0
  24. package/dist/extensions/pi-zentui/assets/main-cover.png +0 -0
  25. package/dist/extensions/pi-zentui/assets/screenshots/editor-accent-rail.png +0 -0
  26. package/dist/extensions/pi-zentui/assets/screenshots/editor-minimalist.png +0 -0
  27. package/dist/extensions/pi-zentui/assets/screenshots/editor-opencode-copy-friendly.png +0 -0
  28. package/dist/extensions/pi-zentui/assets/screenshots/editor-opencode.png +0 -0
  29. package/dist/extensions/pi-zentui/assets/screenshots/user-message-compact.png +0 -0
  30. package/dist/extensions/pi-zentui/assets/screenshots/user-message-framed-copy-friendly.png +0 -0
  31. package/dist/extensions/pi-zentui/assets/screenshots/user-message-framed.png +0 -0
  32. package/dist/extensions/pi-zentui/assets/screenshots/user-message-labeled.png +0 -0
  33. package/dist/extensions/pi-zentui/assets/zentui.png +0 -0
  34. package/dist/extensions/pi-zentui/biome.json +31 -0
  35. package/dist/extensions/pi-zentui/docs/configuration.md +509 -0
  36. package/dist/extensions/pi-zentui/docs/footer-format.md +162 -0
  37. package/dist/extensions/pi-zentui/extensions/zentui/accent-rail-editor.ts +99 -0
  38. package/dist/extensions/pi-zentui/extensions/zentui/accent-rail-layout-patch.ts +457 -0
  39. package/dist/extensions/pi-zentui/extensions/zentui/completion-menu.ts +157 -0
  40. package/dist/extensions/pi-zentui/extensions/zentui/config.ts +2100 -0
  41. package/dist/extensions/pi-zentui/extensions/zentui/editor-metadata-format.ts +321 -0
  42. package/dist/extensions/pi-zentui/extensions/zentui/editor-transfer.ts +73 -0
  43. package/dist/extensions/pi-zentui/extensions/zentui/extension-status.ts +89 -0
  44. package/dist/extensions/pi-zentui/extensions/zentui/footer-format.ts +364 -0
  45. package/dist/extensions/pi-zentui/extensions/zentui/footer-layout.ts +122 -0
  46. package/dist/extensions/pi-zentui/extensions/zentui/footer.ts +812 -0
  47. package/dist/extensions/pi-zentui/extensions/zentui/format.ts +568 -0
  48. package/dist/extensions/pi-zentui/extensions/zentui/git.ts +384 -0
  49. package/dist/extensions/pi-zentui/extensions/zentui/icons.ts +252 -0
  50. package/dist/extensions/pi-zentui/extensions/zentui/index.ts +1406 -0
  51. package/dist/extensions/pi-zentui/extensions/zentui/interaction-summary.ts +1049 -0
  52. package/dist/extensions/pi-zentui/extensions/zentui/live-context.ts +75 -0
  53. package/dist/extensions/pi-zentui/extensions/zentui/minimalist-editor.ts +463 -0
  54. package/dist/extensions/pi-zentui/extensions/zentui/package-version.ts +651 -0
  55. package/dist/extensions/pi-zentui/extensions/zentui/project-refresh.ts +120 -0
  56. package/dist/extensions/pi-zentui/extensions/zentui/project-state.ts +59 -0
  57. package/dist/extensions/pi-zentui/extensions/zentui/prototype-patch-registry.ts +166 -0
  58. package/dist/extensions/pi-zentui/extensions/zentui/repository-root.ts +98 -0
  59. package/dist/extensions/pi-zentui/extensions/zentui/runtime.ts +841 -0
  60. package/dist/extensions/pi-zentui/extensions/zentui/selector-border.ts +93 -0
  61. package/dist/extensions/pi-zentui/extensions/zentui/session-lifecycle.ts +60 -0
  62. package/dist/extensions/pi-zentui/extensions/zentui/settings-command.ts +1796 -0
  63. package/dist/extensions/pi-zentui/extensions/zentui/settings-previews.ts +128 -0
  64. package/dist/extensions/pi-zentui/extensions/zentui/state.ts +94 -0
  65. package/dist/extensions/pi-zentui/extensions/zentui/style.ts +424 -0
  66. package/dist/extensions/pi-zentui/extensions/zentui/telemetry.ts +82 -0
  67. package/dist/extensions/pi-zentui/extensions/zentui/ui.ts +1290 -0
  68. package/dist/extensions/pi-zentui/extensions/zentui/user-message-osc.ts +248 -0
  69. package/dist/extensions/pi-zentui/extensions/zentui/user-message-styles.ts +215 -0
  70. package/dist/extensions/pi-zentui/extensions/zentui/user-message.ts +206 -0
  71. package/dist/extensions/pi-zentui/extensions/zentui/working-line-messages.ts +24 -0
  72. package/dist/extensions/pi-zentui/extensions/zentui/working-line-spinners.ts +54 -0
  73. package/dist/extensions/pi-zentui/extensions/zentui/working-line.ts +1433 -0
  74. package/dist/extensions/pi-zentui/package-lock.json +5311 -0
  75. package/dist/extensions/pi-zentui/package.json +60 -0
  76. package/dist/extensions/pi-zentui/test/accent-rail-editor.test.ts +232 -0
  77. package/dist/extensions/pi-zentui/test/accent-rail-layout-patch.test.ts +669 -0
  78. package/dist/extensions/pi-zentui/test/completion-menu.test.ts +265 -0
  79. package/dist/extensions/pi-zentui/test/config.test.ts +3119 -0
  80. package/dist/extensions/pi-zentui/test/editor-metadata-format.test.ts +405 -0
  81. package/dist/extensions/pi-zentui/test/editor-transfer.test.ts +260 -0
  82. package/dist/extensions/pi-zentui/test/editor-viewport-indicators.test.ts +1286 -0
  83. package/dist/extensions/pi-zentui/test/extension-compliance.test.ts +7196 -0
  84. package/dist/extensions/pi-zentui/test/extension-status.test.ts +182 -0
  85. package/dist/extensions/pi-zentui/test/fixtures/starship-nerd-font-symbols.toml +172 -0
  86. package/dist/extensions/pi-zentui/test/footer-format.test.ts +431 -0
  87. package/dist/extensions/pi-zentui/test/footer-layout.test.ts +113 -0
  88. package/dist/extensions/pi-zentui/test/footer-repository-path.test.ts +123 -0
  89. package/dist/extensions/pi-zentui/test/format.test.ts +865 -0
  90. package/dist/extensions/pi-zentui/test/git.test.ts +212 -0
  91. package/dist/extensions/pi-zentui/test/icons.test.ts +69 -0
  92. package/dist/extensions/pi-zentui/test/interaction-summary.test.ts +1402 -0
  93. package/dist/extensions/pi-zentui/test/live-context-integration.test.ts +378 -0
  94. package/dist/extensions/pi-zentui/test/live-context.test.ts +139 -0
  95. package/dist/extensions/pi-zentui/test/minimalist-editor.test.ts +811 -0
  96. package/dist/extensions/pi-zentui/test/package-version.test.ts +321 -0
  97. package/dist/extensions/pi-zentui/test/project-refresh.test.ts +250 -0
  98. package/dist/extensions/pi-zentui/test/project-state.test.ts +159 -0
  99. package/dist/extensions/pi-zentui/test/repository-root.test.ts +108 -0
  100. package/dist/extensions/pi-zentui/test/responsive-dependencies.test.ts +825 -0
  101. package/dist/extensions/pi-zentui/test/runtime.test.ts +183 -0
  102. package/dist/extensions/pi-zentui/test/session-lifecycle.test.ts +40 -0
  103. package/dist/extensions/pi-zentui/test/settings-command.test.ts +1381 -0
  104. package/dist/extensions/pi-zentui/test/settings-previews.test.ts +347 -0
  105. package/dist/extensions/pi-zentui/test/state.test.ts +84 -0
  106. package/dist/extensions/pi-zentui/test/telemetry-lifecycle-integration.test.ts +276 -0
  107. package/dist/extensions/pi-zentui/test/telemetry.test.ts +105 -0
  108. package/dist/extensions/pi-zentui/test/turn-summary-lifecycle.integration.test.ts +327 -0
  109. package/dist/extensions/pi-zentui/test/user-message-osc.test.ts +164 -0
  110. package/dist/extensions/pi-zentui/test/user-message-styles.test.ts +292 -0
  111. package/dist/extensions/pi-zentui/test/working-line-lifecycle.integration.test.ts +730 -0
  112. package/dist/extensions/pi-zentui/test/working-line-messages.test.ts +34 -0
  113. package/dist/extensions/pi-zentui/test/working-line.test.ts +1990 -0
  114. package/dist/extensions/pi-zentui/tsconfig.json +16 -0
  115. package/dist/extensions/tps.test.ts +38 -0
  116. package/dist/extensions/{pi-powerline-footer/tps.ts → tps.ts} +4 -0
  117. package/dist/modes/interactive/components/settings-selector.d.ts +1 -1
  118. package/dist/modes/interactive/interactive-mode.js +1 -1
  119. package/dist/skills/design-references/SKILL.md +31 -0
  120. package/dist/skills/design-references/references/clickhouse/DESIGN.md +544 -0
  121. package/dist/themes/adventure.json +84 -0
  122. package/dist/themes/adwaita-dark.json +84 -0
  123. package/dist/themes/arcoiris.json +84 -0
  124. package/dist/themes/arthur.json +84 -0
  125. package/dist/themes/atom.json +84 -0
  126. package/dist/themes/aura.json +84 -0
  127. package/dist/themes/black-metal-bathory.json +84 -0
  128. package/dist/themes/black-metal-burzum.json +84 -0
  129. package/dist/themes/black-metal-khold.json +84 -0
  130. package/dist/themes/box.json +84 -0
  131. package/dist/themes/brogrammer.json +84 -0
  132. package/dist/themes/carbonfox.json +84 -0
  133. package/dist/themes/catppuccin-mocha.json +84 -0
  134. package/dist/themes/citruszest.json +84 -0
  135. package/dist/themes/cursor-dark.json +84 -0
  136. package/dist/themes/cutie-pro.json +84 -0
  137. package/dist/themes/dark-modern.json +84 -0
  138. package/dist/themes/dark-pastel.json +84 -0
  139. package/dist/themes/dimmed-monokai.json +84 -0
  140. package/dist/themes/doom-peacock.json +84 -0
  141. package/dist/themes/dracula-plus.json +84 -0
  142. package/dist/themes/dracula.json +80 -0
  143. package/dist/themes/earthsong.json +84 -0
  144. package/dist/themes/everforest-dark-hard.json +84 -0
  145. package/dist/themes/everforest-dark.json +80 -0
  146. package/dist/themes/fahrenheit.json +84 -0
  147. package/dist/themes/flatland.json +84 -0
  148. package/dist/themes/flexoki-dark.json +84 -0
  149. package/dist/themes/front-end-delight.json +84 -0
  150. package/dist/themes/fun-forrest.json +84 -0
  151. package/dist/themes/galizur.json +84 -0
  152. package/dist/themes/github-dark-colorblind.json +84 -0
  153. package/dist/themes/github-dark-high-contrast.json +84 -0
  154. package/dist/themes/glacier.json +84 -0
  155. package/dist/themes/gruber-darker.json +84 -0
  156. package/dist/themes/gruvbox-dark-hard.json +84 -0
  157. package/dist/themes/gruvbox-dark.json +84 -0
  158. package/dist/themes/gruvbox-material.json +84 -0
  159. package/dist/themes/guezwhoz.json +84 -0
  160. package/dist/themes/hacktober.json +84 -0
  161. package/dist/themes/hardcore.json +84 -0
  162. package/dist/themes/havn-skumring.json +84 -0
  163. package/dist/themes/ic-orange-ppl.json +84 -0
  164. package/dist/themes/iterm2-smoooooth.json +84 -0
  165. package/dist/themes/iterm2-tango-dark.json +84 -0
  166. package/dist/themes/japanesque.json +84 -0
  167. package/dist/themes/jellybeans.json +84 -0
  168. package/dist/themes/kanagawa-wave.json +84 -0
  169. package/dist/themes/kurokula.json +84 -0
  170. package/dist/themes/later-this-evening.json +84 -0
  171. package/dist/themes/lovelace.json +84 -0
  172. package/dist/themes/material-darker.json +84 -0
  173. package/dist/themes/matte-black.json +84 -0
  174. package/dist/themes/mellow.json +84 -0
  175. package/dist/themes/miasma.json +84 -0
  176. package/dist/themes/nord.json +80 -0
  177. package/dist/themes/nvim-dark.json +84 -0
  178. package/dist/themes/one-dark.json +80 -0
  179. package/dist/themes/popping-and-locking.json +84 -0
  180. package/dist/themes/rose-pine.json +80 -0
  181. package/dist/themes/sea-shells.json +84 -0
  182. package/dist/themes/sleepy-hollow.json +84 -0
  183. package/dist/themes/smyck.json +84 -0
  184. package/dist/themes/solarized-dark.json +80 -0
  185. package/dist/themes/tokyo-night.json +80 -0
  186. package/dist/themes/tomorrow-night-bright.json +84 -0
  187. package/dist/themes/tomorrow-night-burns.json +84 -0
  188. package/dist/themes/tomorrow-night.json +84 -0
  189. package/dist/themes/twilight.json +84 -0
  190. package/dist/themes/vague.json +84 -0
  191. package/dist/themes/vesper.json +84 -0
  192. package/dist/themes/xcode-dark-hc.json +84 -0
  193. package/docs/custom-provider.md +0 -1
  194. package/package.json +3 -3
  195. package/dist/extensions/auto-model/auto-model.test.ts +0 -18
  196. package/dist/extensions/auto-model/classifier.ts +0 -23
  197. package/dist/extensions/auto-model/config.ts +0 -51
  198. package/dist/extensions/auto-model/index.ts +0 -22
  199. package/dist/extensions/auto-model/lifecycle.test.ts +0 -24
  200. package/dist/extensions/pi-powerline-footer/.github/workflows/test.yml +0 -27
  201. package/dist/extensions/pi-powerline-footer/CHANGELOG.md +0 -687
  202. package/dist/extensions/pi-powerline-footer/CONTRIBUTING.md +0 -16
  203. package/dist/extensions/pi-powerline-footer/README.md +0 -513
  204. package/dist/extensions/pi-powerline-footer/banner.png +0 -0
  205. package/dist/extensions/pi-powerline-footer/bash-mode/completion.ts +0 -586
  206. package/dist/extensions/pi-powerline-footer/bash-mode/editor.ts +0 -583
  207. package/dist/extensions/pi-powerline-footer/bash-mode/history.ts +0 -204
  208. package/dist/extensions/pi-powerline-footer/bash-mode/shell-session.ts +0 -286
  209. package/dist/extensions/pi-powerline-footer/bash-mode/transcript.ts +0 -108
  210. package/dist/extensions/pi-powerline-footer/bash-mode/types.ts +0 -60
  211. package/dist/extensions/pi-powerline-footer/cd-command.ts +0 -190
  212. package/dist/extensions/pi-powerline-footer/colors.ts +0 -70
  213. package/dist/extensions/pi-powerline-footer/context-usage.ts +0 -156
  214. package/dist/extensions/pi-powerline-footer/currency-rates.ts +0 -142
  215. package/dist/extensions/pi-powerline-footer/editor-composition.ts +0 -32
  216. package/dist/extensions/pi-powerline-footer/editor-performance.ts +0 -99
  217. package/dist/extensions/pi-powerline-footer/git-status.ts +0 -329
  218. package/dist/extensions/pi-powerline-footer/guide.ts +0 -220
  219. package/dist/extensions/pi-powerline-footer/icons.ts +0 -190
  220. package/dist/extensions/pi-powerline-footer/index.ts +0 -3428
  221. package/dist/extensions/pi-powerline-footer/lifecycle.ts +0 -10
  222. package/dist/extensions/pi-powerline-footer/package.json +0 -49
  223. package/dist/extensions/pi-powerline-footer/paths.ts +0 -22
  224. package/dist/extensions/pi-powerline-footer/powerline-config.ts +0 -446
  225. package/dist/extensions/pi-powerline-footer/presets.ts +0 -102
  226. package/dist/extensions/pi-powerline-footer/queue/store.ts +0 -313
  227. package/dist/extensions/pi-powerline-footer/queue/types.ts +0 -53
  228. package/dist/extensions/pi-powerline-footer/render-scheduler.ts +0 -29
  229. package/dist/extensions/pi-powerline-footer/segments.ts +0 -570
  230. package/dist/extensions/pi-powerline-footer/separators.ts +0 -57
  231. package/dist/extensions/pi-powerline-footer/session-usage.ts +0 -44
  232. package/dist/extensions/pi-powerline-footer/shortcuts.ts +0 -61
  233. package/dist/extensions/pi-powerline-footer/tests/bash-mode.test.ts +0 -1905
  234. package/dist/extensions/pi-powerline-footer/tests/cd-command.test.ts +0 -144
  235. package/dist/extensions/pi-powerline-footer/tests/context-usage.test.ts +0 -156
  236. package/dist/extensions/pi-powerline-footer/tests/custom-items.test.ts +0 -344
  237. package/dist/extensions/pi-powerline-footer/tests/editor-composition.test.ts +0 -48
  238. package/dist/extensions/pi-powerline-footer/tests/editor-performance.test.ts +0 -43
  239. package/dist/extensions/pi-powerline-footer/tests/editor-responsiveness.test.ts +0 -136
  240. package/dist/extensions/pi-powerline-footer/tests/fixed-editor-border.test.ts +0 -39
  241. package/dist/extensions/pi-powerline-footer/tests/git-optional-locks.test.ts +0 -64
  242. package/dist/extensions/pi-powerline-footer/tests/git-status.test.ts +0 -92
  243. package/dist/extensions/pi-powerline-footer/tests/guide.test.ts +0 -129
  244. package/dist/extensions/pi-powerline-footer/tests/jump-shortcuts.test.ts +0 -116
  245. package/dist/extensions/pi-powerline-footer/tests/mode-aware-trigger.test.ts +0 -79
  246. package/dist/extensions/pi-powerline-footer/tests/paths.test.ts +0 -63
  247. package/dist/extensions/pi-powerline-footer/tests/queue-store.test.ts +0 -65
  248. package/dist/extensions/pi-powerline-footer/tests/quit-cursor.test.ts +0 -14
  249. package/dist/extensions/pi-powerline-footer/tests/remaining-regressions.test.ts +0 -173
  250. package/dist/extensions/pi-powerline-footer/tests/session-usage.test.ts +0 -47
  251. package/dist/extensions/pi-powerline-footer/tests/stash-shortcut.test.ts +0 -37
  252. package/dist/extensions/pi-powerline-footer/tests/thinking-segment.test.ts +0 -76
  253. package/dist/extensions/pi-powerline-footer/tests/token-stats.test.ts +0 -249
  254. package/dist/extensions/pi-powerline-footer/tests/tps.test.ts +0 -39
  255. package/dist/extensions/pi-powerline-footer/tests/usage-display.test.ts +0 -237
  256. package/dist/extensions/pi-powerline-footer/tests/welcome.test.ts +0 -199
  257. package/dist/extensions/pi-powerline-footer/tests/working-vibes.test.ts +0 -317
  258. package/dist/extensions/pi-powerline-footer/theme.example.json +0 -24
  259. package/dist/extensions/pi-powerline-footer/theme.json +0 -12
  260. package/dist/extensions/pi-powerline-footer/theme.ts +0 -241
  261. package/dist/extensions/pi-powerline-footer/token-stats.ts +0 -304
  262. package/dist/extensions/pi-powerline-footer/tsconfig.json +0 -13
  263. package/dist/extensions/pi-powerline-footer/types.ts +0 -235
  264. package/dist/extensions/pi-powerline-footer/welcome-dismiss.ts +0 -34
  265. package/dist/extensions/pi-powerline-footer/welcome.ts +0 -709
  266. package/dist/extensions/pi-powerline-footer/working-vibes.ts +0 -721
  267. package/dist/extensions/preview-tools-disabled.test.ts +0 -37
  268. package/dist/extensions/preview-tools-disabled.ts +0 -11
  269. package/dist/themes/powerline-footer/theme.json +0 -33
@@ -0,0 +1,248 @@
1
+ const ESC = "\x1b";
2
+ const BEL = "\x07";
3
+ const C1_DCS = "\x90";
4
+ const C1_SOS = "\x98";
5
+ const C1_CSI = "\x9b";
6
+ const C1_ST = "\x9c";
7
+ const C1_OSC = "\x9d";
8
+ const C1_PM = "\x9e";
9
+ const C1_APC = "\x9f";
10
+ const CAN = 0x18;
11
+ const SUB = 0x1a;
12
+
13
+ type ControlBoundary =
14
+ | { kind: "terminator"; index: number; length: number; safeOsc8Terminator: boolean }
15
+ | { kind: "start"; index: number };
16
+
17
+ type FilterOptions = {
18
+ preserveValidOsc8: boolean;
19
+ preserveSourceWhitespace: boolean;
20
+ preserveSgr: boolean;
21
+ };
22
+
23
+ type FilterResult = {
24
+ text: string;
25
+ balancedOsc8: boolean;
26
+ };
27
+
28
+ function anyOscStartLength(text: string, index: number): number {
29
+ if (text[index] === C1_OSC) return 1;
30
+ return text[index] === ESC && text[index + 1] === "]" ? 2 : 0;
31
+ }
32
+
33
+ function findOscBoundary(text: string, payloadStart: number): ControlBoundary | undefined {
34
+ for (let index = payloadStart; index < text.length; index += 1) {
35
+ if (anyOscStartLength(text, index) > 0) return { kind: "start", index };
36
+ if (text[index] === BEL) {
37
+ return { kind: "terminator", index, length: 1, safeOsc8Terminator: true };
38
+ }
39
+ if (text[index] === C1_ST) {
40
+ return { kind: "terminator", index, length: 1, safeOsc8Terminator: false };
41
+ }
42
+ if (text[index] === ESC && text[index + 1] === "\\") {
43
+ return { kind: "terminator", index, length: 2, safeOsc8Terminator: true };
44
+ }
45
+ }
46
+ return undefined;
47
+ }
48
+
49
+ const terminalControlPattern = /[\u0000-\u001f\u007f-\u009f]/;
50
+ const safeParameterKeyPattern = /^[A-Za-z0-9_.-]+$/;
51
+
52
+ export function isValidUserMessageOsc8Payload(payload: string): boolean {
53
+ if (!payload.startsWith("8;")) return false;
54
+ const uriSeparator = payload.indexOf(";", 2);
55
+ if (uriSeparator < 0) return false;
56
+
57
+ const params = payload.slice(2, uriSeparator);
58
+ const uri = payload.slice(uriSeparator + 1);
59
+ if (params === "" && uri === "") return true;
60
+ if (uri === "" || /\s/.test(uri) || terminalControlPattern.test(uri)) return false;
61
+ if (params === "") return true;
62
+
63
+ return params.split(":").every((entry) => {
64
+ const equals = entry.indexOf("=");
65
+ if (equals <= 0) return false;
66
+ const key = entry.slice(0, equals);
67
+ const value = entry.slice(equals + 1);
68
+ return (
69
+ safeParameterKeyPattern.test(key) &&
70
+ !terminalControlPattern.test(key) &&
71
+ !terminalControlPattern.test(value)
72
+ );
73
+ });
74
+ }
75
+
76
+ function incompleteOsc133PrefixLength(payload: string): number {
77
+ if (payload.length > 0 && "133".startsWith(payload)) return payload.length;
78
+ if (!payload.startsWith("133;")) return 0;
79
+
80
+ let length = 4;
81
+ if (/^[A-D]$/.test(payload[length] ?? "")) length += 1;
82
+ if (payload[length] === ";") length += 1;
83
+ return length;
84
+ }
85
+
86
+ function consumeCsi(value: string, start: number): number {
87
+ for (let index = start; index < value.length; index += 1) {
88
+ const code = value.charCodeAt(index);
89
+ if (code === CAN || code === SUB) return index + 1;
90
+ if (code >= 0x40 && code <= 0x7e) return index + 1;
91
+ }
92
+ return value.length;
93
+ }
94
+
95
+ function consumeControlString(value: string, start: number, allowBel: boolean): number {
96
+ for (let index = start; index < value.length; index += 1) {
97
+ const code = value.charCodeAt(index);
98
+ if (code === CAN || code === SUB) return index + 1;
99
+ if (allowBel && code === BEL.charCodeAt(0)) return index + 1;
100
+ if (code === C1_ST.charCodeAt(0)) return index + 1;
101
+ if (code === ESC.charCodeAt(0) && value[index + 1] === "\\") return index + 2;
102
+ }
103
+ return value.length;
104
+ }
105
+
106
+ function consumeEscape(value: string, start: number): number {
107
+ if (start + 1 >= value.length) return value.length;
108
+ const next = value[start + 1];
109
+ if (next === "[") return consumeCsi(value, start + 2);
110
+ if (next === "P" || next === "X" || next === "^" || next === "_") {
111
+ return consumeControlString(value, start + 2, false);
112
+ }
113
+
114
+ let index = start + 1;
115
+ while (index < value.length) {
116
+ const code = value.charCodeAt(index);
117
+ if (code >= 0x20 && code <= 0x2f) {
118
+ index += 1;
119
+ continue;
120
+ }
121
+ return code >= 0x30 && code <= 0x7e ? index + 1 : index;
122
+ }
123
+ return value.length;
124
+ }
125
+
126
+ function isSafeSgr(sequence: string): boolean {
127
+ return /^\x1b\[[0-9:;]*m$/.test(sequence);
128
+ }
129
+
130
+ function isOsc8Close(payload: string): boolean {
131
+ return payload === "8;;";
132
+ }
133
+
134
+ function updateOsc8Balance(payload: string, state: { open: boolean; invalid: boolean }): void {
135
+ if (isOsc8Close(payload)) {
136
+ if (!state.open) state.invalid = true;
137
+ state.open = false;
138
+ return;
139
+ }
140
+ if (state.open) state.invalid = true;
141
+ state.open = true;
142
+ }
143
+
144
+ function filterUserMessageTerminalText(text: string, options: FilterOptions): FilterResult {
145
+ let output = "";
146
+ let index = 0;
147
+ const osc8 = { open: false, invalid: false };
148
+ while (index < text.length) {
149
+ const oscStartLength = anyOscStartLength(text, index);
150
+ if (oscStartLength > 0) {
151
+ const payloadStart = index + oscStartLength;
152
+ const boundary = findOscBoundary(text, payloadStart);
153
+ if (boundary?.kind === "terminator") {
154
+ const end = boundary.index + boundary.length;
155
+ const payload = text.slice(payloadStart, boundary.index);
156
+ if (
157
+ options.preserveValidOsc8 &&
158
+ oscStartLength === 2 &&
159
+ boundary.safeOsc8Terminator &&
160
+ isValidUserMessageOsc8Payload(payload)
161
+ ) {
162
+ updateOsc8Balance(payload, osc8);
163
+ output += text.slice(index, end);
164
+ }
165
+ index = end;
166
+ continue;
167
+ }
168
+
169
+ // Removing an unterminated introducer prevents it from consuming
170
+ // Zentui's prompt markers. Preserve visible trailing payload, except
171
+ // for a recognized partial OSC 133 command prefix.
172
+ const payloadEnd = boundary?.index ?? text.length;
173
+ const payload = text.slice(payloadStart, payloadEnd);
174
+ index = payloadStart + incompleteOsc133PrefixLength(payload);
175
+ continue;
176
+ }
177
+
178
+ const code = text.charCodeAt(index);
179
+ if (code === ESC.charCodeAt(0)) {
180
+ if (text[index + 1] === "[") {
181
+ const end = consumeCsi(text, index + 2);
182
+ const sequence = text.slice(index, end);
183
+ if (options.preserveSgr && isSafeSgr(sequence)) output += sequence;
184
+ index = end;
185
+ continue;
186
+ }
187
+ index = consumeEscape(text, index);
188
+ continue;
189
+ }
190
+ if (text[index] === C1_CSI) {
191
+ index = consumeCsi(text, index + 1);
192
+ continue;
193
+ }
194
+ if (
195
+ text[index] === C1_DCS ||
196
+ text[index] === C1_SOS ||
197
+ text[index] === C1_PM ||
198
+ text[index] === C1_APC
199
+ ) {
200
+ index = consumeControlString(text, index + 1, false);
201
+ continue;
202
+ }
203
+ if (code === 0x09 || code === 0x0a) {
204
+ if (options.preserveSourceWhitespace) output += text[index];
205
+ index += 1;
206
+ continue;
207
+ }
208
+ if (code < 0x20 || (code >= 0x7f && code <= 0x9f)) {
209
+ index += 1;
210
+ continue;
211
+ }
212
+ output += text[index];
213
+ index += 1;
214
+ }
215
+ return { text: output, balancedOsc8: !osc8.open && !osc8.invalid };
216
+ }
217
+
218
+ function filterBalancedUserMessageTerminalText(text: string, options: FilterOptions): string {
219
+ const filtered = filterUserMessageTerminalText(text, options);
220
+ if (!options.preserveValidOsc8 || filtered.balancedOsc8) return filtered.text;
221
+ return filterUserMessageTerminalText(text, { ...options, preserveValidOsc8: false }).text;
222
+ }
223
+
224
+ /** Strip every terminal control from untrusted source text before Markdown rendering. */
225
+ export function sanitizeUserMessageSourceText(text: string): string {
226
+ return filterBalancedUserMessageTerminalText(text, {
227
+ preserveValidOsc8: false,
228
+ preserveSourceWhitespace: true,
229
+ preserveSgr: false,
230
+ });
231
+ }
232
+
233
+ /**
234
+ * Sanitize a predecessor-rendered row. Pi formatting needs only SGR and
235
+ * structurally valid 7-bit OSC 8; every other terminal control is removed.
236
+ */
237
+ export function sanitizeRenderedUserMessageText(text: string): string {
238
+ return filterBalancedUserMessageTerminalText(text, {
239
+ preserveValidOsc8: true,
240
+ preserveSourceWhitespace: true,
241
+ preserveSgr: true,
242
+ });
243
+ }
244
+
245
+ /** Sanitize one predecessor output stream while retaining its row boundaries. */
246
+ export function sanitizeRenderedUserMessageLines(lines: string[]): string[] {
247
+ return sanitizeRenderedUserMessageText(lines.join("\n")).split("\n");
248
+ }
@@ -0,0 +1,215 @@
1
+ import type { Theme, ThemeColor } from "@earendil-works/pi-coding-agent";
2
+ import {
3
+ Markdown,
4
+ type MarkdownTheme,
5
+ truncateToWidth,
6
+ visibleWidth,
7
+ } from "@earendil-works/pi-tui";
8
+ import type { ZentuiConfig } from "./config";
9
+ import {
10
+ EDITOR_ACCENT_FALLBACK,
11
+ EDITOR_BORDER_FALLBACK,
12
+ renderStyleForSourceOrFallbackStrict,
13
+ } from "./style";
14
+ import { sanitizeUserMessageSourceText } from "./user-message-osc";
15
+
16
+ export type UserMessageStyleRenderInput = {
17
+ text: string;
18
+ width: number;
19
+ theme?: Theme;
20
+ config: ZentuiConfig;
21
+ };
22
+
23
+ function themeFg(theme: Theme | undefined, color: ThemeColor, text: string): string {
24
+ return theme ? theme.fg(color, text) : text;
25
+ }
26
+
27
+ function makeMarkdownTheme(theme: Theme | undefined): MarkdownTheme {
28
+ return {
29
+ heading: (text) => themeFg(theme, "mdHeading", text),
30
+ link: (text) => themeFg(theme, "mdLink", text),
31
+ linkUrl: (text) => themeFg(theme, "mdLinkUrl", text),
32
+ code: (text) => themeFg(theme, "mdCode", text),
33
+ codeBlock: (text) => themeFg(theme, "mdCodeBlock", text),
34
+ codeBlockBorder: (text) => themeFg(theme, "mdCodeBlockBorder", text),
35
+ quote: (text) => themeFg(theme, "mdQuote", text),
36
+ quoteBorder: (text) => themeFg(theme, "mdQuoteBorder", text),
37
+ hr: (text) => themeFg(theme, "mdHr", text),
38
+ listBullet: (text) => themeFg(theme, "mdListBullet", text),
39
+ bold: (text) => (theme ? theme.bold(text) : text),
40
+ italic: (text) => (theme ? theme.italic(text) : text),
41
+ underline: (text) => (theme ? theme.underline(text) : text),
42
+ strikethrough: (text) => (theme ? theme.strikethrough(text) : text),
43
+ };
44
+ }
45
+
46
+ function renderMarkdown(text: string, width: number, theme: Theme | undefined): string[] {
47
+ const renderer = new Markdown(text, 0, 0, makeMarkdownTheme(theme), {
48
+ color: (content) => themeFg(theme, "userMessageText", content),
49
+ });
50
+ const lines = renderer.render(Math.max(1, width));
51
+ return lines.length > 0 ? lines : [""];
52
+ }
53
+
54
+ function trimMarkdownPadding(line: string): string {
55
+ return line.replace(/ +((?:\x1b\[[0-?]*[ -/]*[@-~])*)$/, "$1");
56
+ }
57
+
58
+ function fillLine(content: string, width: number): string {
59
+ const truncated = truncateToWidth(content, Math.max(0, width), "");
60
+ return `${truncated}${" ".repeat(Math.max(0, width - visibleWidth(truncated)))}`;
61
+ }
62
+
63
+ function accent(theme: Theme | undefined, config: ZentuiConfig, text: string): string {
64
+ return theme
65
+ ? renderStyleForSourceOrFallbackStrict(
66
+ theme,
67
+ config.components.userMessages.colorSource,
68
+ config.colors.editorAccent,
69
+ EDITOR_ACCENT_FALLBACK,
70
+ text,
71
+ )
72
+ : text;
73
+ }
74
+
75
+ function border(theme: Theme | undefined, config: ZentuiConfig, text: string): string {
76
+ return theme
77
+ ? renderStyleForSourceOrFallbackStrict(
78
+ theme,
79
+ config.components.userMessages.colorSource,
80
+ config.colors.editorBorder,
81
+ EDITOR_BORDER_FALLBACK,
82
+ text,
83
+ )
84
+ : text;
85
+ }
86
+
87
+ function renderRail(theme: Theme | undefined, config: ZentuiConfig): string {
88
+ return `${accent(theme, config, config.icons.rail)} `;
89
+ }
90
+
91
+ function renderFramed({ text, width, theme, config }: UserMessageStyleRenderInput): string[] {
92
+ if (width <= 0) return [""];
93
+ const rail = renderRail(theme, config);
94
+ const contentWidth = Math.max(1, width - visibleWidth(rail));
95
+ const body = renderMarkdown(text, contentWidth, theme);
96
+ const row = (line: string) => {
97
+ const available = Math.max(0, width - visibleWidth(rail));
98
+ return truncateToWidth(`${rail}${fillLine(line, available)}`, width, "");
99
+ };
100
+ const rule = truncateToWidth(border(theme, config, "─".repeat(width)), width, "");
101
+ return [rule, row(""), ...body.map(row), row(""), rule];
102
+ }
103
+
104
+ function renderFramedCopyFriendly({
105
+ text,
106
+ width,
107
+ theme,
108
+ config,
109
+ }: UserMessageStyleRenderInput): string[] {
110
+ if (width <= 0) return [""];
111
+ const prefix = width > 1 ? " " : "";
112
+ const body = renderMarkdown(text, width - prefix.length, theme).map((line) =>
113
+ fillLine(`${prefix}${line}`, width),
114
+ );
115
+ const rule = truncateToWidth(border(theme, config, "─".repeat(width)), width, "");
116
+ return [rule, "", ...body, "", rule];
117
+ }
118
+
119
+ function renderCompact({ text, width, theme, config }: UserMessageStyleRenderInput): string[] {
120
+ if (width <= 0) return [""];
121
+ const rail = renderRail(theme, config);
122
+ const railWidth = visibleWidth(rail);
123
+ if (width <= railWidth) {
124
+ return renderMarkdown(text, width, theme).map((line) =>
125
+ truncateToWidth(trimMarkdownPadding(line), width, ""),
126
+ );
127
+ }
128
+ const contentWidth = width - railWidth;
129
+ return renderMarkdown(text, contentWidth, theme).map((line) =>
130
+ truncateToWidth(`${rail}${trimMarkdownPadding(line)}`, width, ""),
131
+ );
132
+ }
133
+
134
+ function renderLabeled({ text, width, theme, config }: UserMessageStyleRenderInput): string[] {
135
+ if (width <= 0) return [""];
136
+ if (width <= 2) {
137
+ return renderMarkdown(text, width, theme).map((line) => truncateToWidth(line, width, ""));
138
+ }
139
+
140
+ const horizontalPadding = width >= 5 ? 1 : 0;
141
+ const contentWidth = Math.max(1, width - 2 - horizontalPadding * 2);
142
+ const body = renderMarkdown(text, contentWidth, theme);
143
+ const top =
144
+ width >= 9
145
+ ? `${border(theme, config, "╭─")}${accent(theme, config, " User ")}${border(
146
+ theme,
147
+ config,
148
+ `${"─".repeat(Math.max(0, width - 9))}╮`,
149
+ )}`
150
+ : border(theme, config, `╭${"─".repeat(Math.max(0, width - 2))}╮`);
151
+ const padding = " ".repeat(horizontalPadding);
152
+ const side = (line: string) =>
153
+ `${border(theme, config, "│")}${padding}${fillLine(line, contentWidth)}${padding}${border(
154
+ theme,
155
+ config,
156
+ "│",
157
+ )}`;
158
+ const bottom = border(theme, config, `╰${"─".repeat(Math.max(0, width - 2))}╯`);
159
+ return [top, ...body.map(side), bottom];
160
+ }
161
+
162
+ export function userMessageStyleCacheKey(config: ZentuiConfig): string {
163
+ const messages = config.components.userMessages;
164
+ switch (messages.style) {
165
+ case "framed":
166
+ return [
167
+ "framed",
168
+ messages.colorSource,
169
+ config.colors.editorAccent ?? "",
170
+ config.colors.editorBorder ?? "",
171
+ config.icons.rail,
172
+ ].join("\0");
173
+ case "framed-copy-friendly":
174
+ return ["framed-copy-friendly", messages.colorSource, config.colors.editorBorder ?? ""].join(
175
+ "\0",
176
+ );
177
+ case "compact":
178
+ return [
179
+ "compact",
180
+ messages.colorSource,
181
+ config.colors.editorAccent ?? "",
182
+ config.icons.rail,
183
+ ].join("\0");
184
+ case "labeled":
185
+ return [
186
+ "labeled",
187
+ messages.colorSource,
188
+ config.colors.editorAccent ?? "",
189
+ config.colors.editorBorder ?? "",
190
+ "User:v1",
191
+ ].join("\0");
192
+ }
193
+ }
194
+
195
+ function renderSelectedUserMessageStyle(input: UserMessageStyleRenderInput): string[] {
196
+ switch (input.config.components.userMessages.style) {
197
+ case "framed":
198
+ return renderFramed(input);
199
+ case "framed-copy-friendly":
200
+ return renderFramedCopyFriendly(input);
201
+ case "compact":
202
+ return renderCompact(input);
203
+ case "labeled":
204
+ return renderLabeled(input);
205
+ }
206
+ }
207
+
208
+ export function renderUserMessageStyle(input: UserMessageStyleRenderInput): string[] {
209
+ // Raw user input is a terminal trust boundary. Strip every source control,
210
+ // including OSC 8; Markdown may add its own validated links afterward.
211
+ return renderSelectedUserMessageStyle({
212
+ ...input,
213
+ text: sanitizeUserMessageSourceText(input.text),
214
+ });
215
+ }
@@ -0,0 +1,206 @@
1
+ import { type Theme, UserMessageComponent } from "@earendil-works/pi-coding-agent";
2
+ import { wrapTextWithAnsi } from "@earendil-works/pi-tui";
3
+ import type { ZentuiConfig } from "./config";
4
+ import { installPrototypePatch, removePrototypePatch } from "./prototype-patch-registry";
5
+ import {
6
+ sanitizeRenderedUserMessageLines,
7
+ sanitizeRenderedUserMessageText,
8
+ sanitizeUserMessageSourceText,
9
+ } from "./user-message-osc";
10
+ import { renderUserMessageStyle, userMessageStyleCacheKey } from "./user-message-styles";
11
+
12
+ const OSC133_ZONE_START = "\x1b]133;A\x07";
13
+ const OSC133_ZONE_END = "\x1b]133;B\x07";
14
+ const OSC133_ZONE_FINAL = "\x1b]133;C\x07";
15
+
16
+ type PatchableUserMessagePrototype = {
17
+ children?: unknown[];
18
+ };
19
+
20
+ type Cleanup = () => void;
21
+
22
+ type UserMessageRenderCache = {
23
+ hasMarkdownText: boolean;
24
+ text?: string;
25
+ width?: number;
26
+ theme?: Theme;
27
+ configKey?: string;
28
+ renderedLines?: string[];
29
+ };
30
+
31
+ const userMessageRenderCache = new WeakMap<object, UserMessageRenderCache>();
32
+
33
+ function isObject(value: unknown): value is object {
34
+ return (typeof value === "object" && value !== null) || typeof value === "function";
35
+ }
36
+
37
+ function isRecord(value: unknown): value is Record<string, unknown> {
38
+ return typeof value === "object" && value !== null && !Array.isArray(value);
39
+ }
40
+
41
+ function findMarkdownText(value: unknown): string | undefined {
42
+ if (!isRecord(value)) return undefined;
43
+ if (typeof value.text === "string") return value.text;
44
+
45
+ const children = value.children;
46
+ if (!Array.isArray(children)) return undefined;
47
+
48
+ for (const child of children) {
49
+ const text = findMarkdownText(child);
50
+ if (text !== undefined) return text;
51
+ }
52
+
53
+ return undefined;
54
+ }
55
+
56
+ function getCachedMarkdownText(instance: object): string | undefined {
57
+ const cached = userMessageRenderCache.get(instance);
58
+ if (cached?.hasMarkdownText) return cached.text;
59
+
60
+ const text = findMarkdownText(instance);
61
+ if (text !== undefined) {
62
+ userMessageRenderCache.set(instance, { ...cached, hasMarkdownText: true, text });
63
+ }
64
+ return text;
65
+ }
66
+
67
+ function renderZentuiUserMessage(
68
+ instance: PatchableUserMessagePrototype,
69
+ width: number,
70
+ theme: Theme | undefined,
71
+ config: ZentuiConfig,
72
+ ): string[] | undefined {
73
+ if (!isRecord(instance)) return undefined;
74
+
75
+ const text = getCachedMarkdownText(instance);
76
+ if (text === undefined) return undefined;
77
+ const configKey = userMessageStyleCacheKey(config);
78
+ const cached = userMessageRenderCache.get(instance);
79
+ if (
80
+ cached?.hasMarkdownText &&
81
+ cached.width === width &&
82
+ cached.theme === theme &&
83
+ cached.configKey === configKey &&
84
+ cached.renderedLines
85
+ ) {
86
+ return cached.renderedLines;
87
+ }
88
+
89
+ const lines = renderUserMessageStyle({
90
+ text,
91
+ width,
92
+ theme,
93
+ config,
94
+ });
95
+ userMessageRenderCache.set(instance, {
96
+ hasMarkdownText: true,
97
+ text,
98
+ width,
99
+ theme,
100
+ configKey,
101
+ renderedLines: lines,
102
+ });
103
+ return lines;
104
+ }
105
+
106
+ function withPromptZoneMarkers(lines: string[]): string[] {
107
+ if (lines.length === 1) {
108
+ return [`${OSC133_ZONE_START}${lines[0]}${OSC133_ZONE_END}${OSC133_ZONE_FINAL}`];
109
+ }
110
+ const markedLines = [...lines];
111
+ markedLines[0] = OSC133_ZONE_START + markedLines[0];
112
+ markedLines[markedLines.length - 1] =
113
+ OSC133_ZONE_END + OSC133_ZONE_FINAL + markedLines[markedLines.length - 1];
114
+ return markedLines;
115
+ }
116
+
117
+ function sanitizePredecessorRender(result: unknown): unknown {
118
+ if (typeof result === "string") return sanitizeRenderedUserMessageText(result);
119
+ if (!Array.isArray(result)) return result;
120
+ const stringRows = result.every((line): line is string => typeof line === "string");
121
+ if (stringRows) return sanitizeRenderedUserMessageLines(result);
122
+ return result.map((line) =>
123
+ typeof line === "string" ? sanitizeRenderedUserMessageText(line) : line,
124
+ );
125
+ }
126
+
127
+ function renderSafeSourceFallback(
128
+ instance: PatchableUserMessagePrototype,
129
+ width: number,
130
+ ): string[] | undefined {
131
+ let text: string | undefined;
132
+ try {
133
+ text = isRecord(instance) ? getCachedMarkdownText(instance) : undefined;
134
+ } catch {
135
+ return undefined;
136
+ }
137
+ if (text === undefined) return undefined;
138
+ const stripped = sanitizeUserMessageSourceText(text);
139
+ if (stripped === text) return undefined;
140
+ const lines = (width > 0 ? wrapTextWithAnsi(stripped, width) : [""]).map(
141
+ sanitizeRenderedUserMessageText,
142
+ );
143
+ return withPromptZoneMarkers(lines.length > 0 ? lines : [""]);
144
+ }
145
+
146
+ export function removeUserMessageStyle(): void {
147
+ const prototype = UserMessageComponent.prototype;
148
+ removePrototypePatch(prototype, "render", "user-message-render");
149
+ removePrototypePatch(prototype, "invalidate", "user-message-invalidate");
150
+ }
151
+
152
+ export function installUserMessageStyle(
153
+ getTheme: () => Theme | undefined,
154
+ getConfig: () => ZentuiConfig,
155
+ ): Cleanup {
156
+ const prototype = UserMessageComponent.prototype;
157
+ const cleanupInvalidate = installPrototypePatch(
158
+ prototype,
159
+ "invalidate",
160
+ "user-message-invalidate",
161
+ ({ predecessor, receiver, args }) => {
162
+ if (isObject(receiver)) userMessageRenderCache.delete(receiver);
163
+ return Reflect.apply(predecessor, receiver, args);
164
+ },
165
+ );
166
+ let cleanupRender: Cleanup;
167
+ try {
168
+ cleanupRender = installPrototypePatch(
169
+ prototype,
170
+ "render",
171
+ "user-message-render",
172
+ ({ predecessor, receiver, args }) => {
173
+ const renderPredecessor = () =>
174
+ sanitizePredecessorRender(Reflect.apply(predecessor, receiver, args));
175
+ const width = args[0];
176
+ if (typeof width !== "number") return renderPredecessor();
177
+ try {
178
+ const lines = renderZentuiUserMessage(
179
+ receiver as PatchableUserMessagePrototype,
180
+ width,
181
+ getTheme(),
182
+ getConfig(),
183
+ );
184
+ if (!lines) return renderPredecessor();
185
+ return lines.length ? withPromptZoneMarkers(lines) : lines;
186
+ } catch {
187
+ const safeFallback = renderSafeSourceFallback(
188
+ receiver as PatchableUserMessagePrototype,
189
+ width,
190
+ );
191
+ return safeFallback ?? renderPredecessor();
192
+ }
193
+ },
194
+ );
195
+ } catch (error) {
196
+ cleanupInvalidate();
197
+ throw error;
198
+ }
199
+ let cleaned = false;
200
+ return () => {
201
+ if (cleaned) return;
202
+ cleaned = true;
203
+ cleanupRender();
204
+ cleanupInvalidate();
205
+ };
206
+ }
@@ -0,0 +1,24 @@
1
+ /** The built-in Working-line verb catalog, in display order. */
2
+ export const PI_WORKING_LINE_DEFAULT_PHRASES = [
3
+ "Sautéing",
4
+ "Cooking",
5
+ "Ionizing",
6
+ "Zigzagging",
7
+ "Razzle-dazzling",
8
+ "Photosynthesizing",
9
+ "Nucleating",
10
+ "Brewing",
11
+ "Combobulating",
12
+ "Boogieing",
13
+ "Befuddling",
14
+ "Alchemizing",
15
+ "Conjuring",
16
+ "Baking",
17
+ "Simmering",
18
+ "Blanching",
19
+ ] as const;
20
+
21
+ /** Complete visible messages derived consistently from the built-in verb catalog. */
22
+ export const PI_WORKING_LINE_MESSAGES = PI_WORKING_LINE_DEFAULT_PHRASES.map(
23
+ (phrase) => `${phrase}…`,
24
+ );