@nexus-cortex/tui 4.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (409) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +2 -0
  3. package/README.md +13 -0
  4. package/bin/cli-full.js +23 -0
  5. package/bin/cortex-ui.js +26 -0
  6. package/bin/ink-ui.js +108 -0
  7. package/bin/launcher-dev.js +266 -0
  8. package/bin/launcher.js +516 -0
  9. package/dist/commands/agent/InteractiveAgentMenu.d.ts +100 -0
  10. package/dist/commands/agent/InteractiveAgentMenu.d.ts.map +1 -0
  11. package/dist/commands/agent/InteractiveAgentMenu.js +909 -0
  12. package/dist/commands/agent/InteractiveAgentMenu.js.map +1 -0
  13. package/dist/commands/agent/index.d.ts +55 -0
  14. package/dist/commands/agent/index.d.ts.map +1 -0
  15. package/dist/commands/agent/index.js +714 -0
  16. package/dist/commands/agent/index.js.map +1 -0
  17. package/dist/commands/chat/interactive.d.ts +13 -0
  18. package/dist/commands/chat/interactive.d.ts.map +1 -0
  19. package/dist/commands/chat/interactive.js +2055 -0
  20. package/dist/commands/chat/interactive.js.map +1 -0
  21. package/dist/commands/system-message/EditorLauncher.d.ts +65 -0
  22. package/dist/commands/system-message/EditorLauncher.d.ts.map +1 -0
  23. package/dist/commands/system-message/EditorLauncher.js +143 -0
  24. package/dist/commands/system-message/EditorLauncher.js.map +1 -0
  25. package/dist/commands/system-message/InlineEditor.d.ts +23 -0
  26. package/dist/commands/system-message/InlineEditor.d.ts.map +1 -0
  27. package/dist/commands/system-message/InlineEditor.js +225 -0
  28. package/dist/commands/system-message/InlineEditor.js.map +1 -0
  29. package/dist/commands/system-message/InteractiveMenu.d.ts +76 -0
  30. package/dist/commands/system-message/InteractiveMenu.d.ts.map +1 -0
  31. package/dist/commands/system-message/InteractiveMenu.js +979 -0
  32. package/dist/commands/system-message/InteractiveMenu.js.map +1 -0
  33. package/dist/commands/system-message/index.d.ts +56 -0
  34. package/dist/commands/system-message/index.d.ts.map +1 -0
  35. package/dist/commands/system-message/index.js +694 -0
  36. package/dist/commands/system-message/index.js.map +1 -0
  37. package/dist/commands/ui/artifacts.d.ts +14 -0
  38. package/dist/commands/ui/artifacts.d.ts.map +1 -0
  39. package/dist/commands/ui/artifacts.js +22 -0
  40. package/dist/commands/ui/artifacts.js.map +1 -0
  41. package/dist/commands/ui/config.d.ts +12 -0
  42. package/dist/commands/ui/config.d.ts.map +1 -0
  43. package/dist/commands/ui/config.js +26 -0
  44. package/dist/commands/ui/config.js.map +1 -0
  45. package/dist/commands/ui/context.d.ts +16 -0
  46. package/dist/commands/ui/context.d.ts.map +1 -0
  47. package/dist/commands/ui/context.js +28 -0
  48. package/dist/commands/ui/context.js.map +1 -0
  49. package/dist/commands/ui/middleware.d.ts +14 -0
  50. package/dist/commands/ui/middleware.d.ts.map +1 -0
  51. package/dist/commands/ui/middleware.js +22 -0
  52. package/dist/commands/ui/middleware.js.map +1 -0
  53. package/dist/commands/ui/models.d.ts +14 -0
  54. package/dist/commands/ui/models.d.ts.map +1 -0
  55. package/dist/commands/ui/models.js +50 -0
  56. package/dist/commands/ui/models.js.map +1 -0
  57. package/dist/commands/ui/permissions.d.ts +14 -0
  58. package/dist/commands/ui/permissions.d.ts.map +1 -0
  59. package/dist/commands/ui/permissions.js +22 -0
  60. package/dist/commands/ui/permissions.js.map +1 -0
  61. package/dist/commands/ui/sessions.d.ts +13 -0
  62. package/dist/commands/ui/sessions.d.ts.map +1 -0
  63. package/dist/commands/ui/sessions.js +45 -0
  64. package/dist/commands/ui/sessions.js.map +1 -0
  65. package/dist/commands/ui/system-messages.d.ts +5 -0
  66. package/dist/commands/ui/system-messages.d.ts.map +1 -0
  67. package/dist/commands/ui/system-messages.js +19 -0
  68. package/dist/commands/ui/system-messages.js.map +1 -0
  69. package/dist/commands/ui/themes.d.ts +12 -0
  70. package/dist/commands/ui/themes.d.ts.map +1 -0
  71. package/dist/commands/ui/themes.js +40 -0
  72. package/dist/commands/ui/themes.js.map +1 -0
  73. package/dist/commands/ui/tmux.d.ts +5 -0
  74. package/dist/commands/ui/tmux.d.ts.map +1 -0
  75. package/dist/commands/ui/tmux.js +19 -0
  76. package/dist/commands/ui/tmux.js.map +1 -0
  77. package/dist/cortex.d.ts +12 -0
  78. package/dist/cortex.d.ts.map +1 -0
  79. package/dist/cortex.js +320 -0
  80. package/dist/cortex.js.map +1 -0
  81. package/dist/index.d.ts +3 -0
  82. package/dist/index.d.ts.map +1 -0
  83. package/dist/index.js +112 -0
  84. package/dist/index.js.map +1 -0
  85. package/dist/ink-ui/CortexApp.d.ts +28 -0
  86. package/dist/ink-ui/CortexApp.d.ts.map +1 -0
  87. package/dist/ink-ui/CortexApp.js +2291 -0
  88. package/dist/ink-ui/CortexApp.js.map +1 -0
  89. package/dist/ink-ui/SimpleInputBuffer.d.ts +63 -0
  90. package/dist/ink-ui/SimpleInputBuffer.d.ts.map +1 -0
  91. package/dist/ink-ui/SimpleInputBuffer.js +369 -0
  92. package/dist/ink-ui/SimpleInputBuffer.js.map +1 -0
  93. package/dist/ink-ui/commands/slashCommands.d.ts +40 -0
  94. package/dist/ink-ui/commands/slashCommands.d.ts.map +1 -0
  95. package/dist/ink-ui/commands/slashCommands.js +111 -0
  96. package/dist/ink-ui/commands/slashCommands.js.map +1 -0
  97. package/dist/ink-ui/commands/types.d.ts +161 -0
  98. package/dist/ink-ui/commands/types.d.ts.map +1 -0
  99. package/dist/ink-ui/commands/types.js +12 -0
  100. package/dist/ink-ui/commands/types.js.map +1 -0
  101. package/dist/ink-ui/components/ApprovalDialog.d.ts +21 -0
  102. package/dist/ink-ui/components/ApprovalDialog.d.ts.map +1 -0
  103. package/dist/ink-ui/components/ApprovalDialog.js +81 -0
  104. package/dist/ink-ui/components/ApprovalDialog.js.map +1 -0
  105. package/dist/ink-ui/components/CommandSuggestions.d.ts +19 -0
  106. package/dist/ink-ui/components/CommandSuggestions.d.ts.map +1 -0
  107. package/dist/ink-ui/components/CommandSuggestions.js +36 -0
  108. package/dist/ink-ui/components/CommandSuggestions.js.map +1 -0
  109. package/dist/ink-ui/components/DiffPreview.d.ts +60 -0
  110. package/dist/ink-ui/components/DiffPreview.d.ts.map +1 -0
  111. package/dist/ink-ui/components/DiffPreview.js +195 -0
  112. package/dist/ink-ui/components/DiffPreview.js.map +1 -0
  113. package/dist/ink-ui/components/DocumentPreview.d.ts +50 -0
  114. package/dist/ink-ui/components/DocumentPreview.d.ts.map +1 -0
  115. package/dist/ink-ui/components/DocumentPreview.js +92 -0
  116. package/dist/ink-ui/components/DocumentPreview.js.map +1 -0
  117. package/dist/ink-ui/components/MarkdownText.d.ts +27 -0
  118. package/dist/ink-ui/components/MarkdownText.d.ts.map +1 -0
  119. package/dist/ink-ui/components/MarkdownText.js +342 -0
  120. package/dist/ink-ui/components/MarkdownText.js.map +1 -0
  121. package/dist/ink-ui/components/MenuRenderer.d.ts +26 -0
  122. package/dist/ink-ui/components/MenuRenderer.d.ts.map +1 -0
  123. package/dist/ink-ui/components/MenuRenderer.js +264 -0
  124. package/dist/ink-ui/components/MenuRenderer.js.map +1 -0
  125. package/dist/ink-ui/components/ModelPickerDialog.d.ts +33 -0
  126. package/dist/ink-ui/components/ModelPickerDialog.d.ts.map +1 -0
  127. package/dist/ink-ui/components/ModelPickerDialog.js +98 -0
  128. package/dist/ink-ui/components/ModelPickerDialog.js.map +1 -0
  129. package/dist/ink-ui/components/StreamDisplay.d.ts +31 -0
  130. package/dist/ink-ui/components/StreamDisplay.d.ts.map +1 -0
  131. package/dist/ink-ui/components/StreamDisplay.js +573 -0
  132. package/dist/ink-ui/components/StreamDisplay.js.map +1 -0
  133. package/dist/ink-ui/components/SubAgentPanel.d.ts +98 -0
  134. package/dist/ink-ui/components/SubAgentPanel.d.ts.map +1 -0
  135. package/dist/ink-ui/components/SubAgentPanel.js +155 -0
  136. package/dist/ink-ui/components/SubAgentPanel.js.map +1 -0
  137. package/dist/ink-ui/components/ThinkingDisplay.d.ts +46 -0
  138. package/dist/ink-ui/components/ThinkingDisplay.d.ts.map +1 -0
  139. package/dist/ink-ui/components/ThinkingDisplay.js +176 -0
  140. package/dist/ink-ui/components/ThinkingDisplay.js.map +1 -0
  141. package/dist/ink-ui/components/ToolCallDisplay.d.ts +51 -0
  142. package/dist/ink-ui/components/ToolCallDisplay.d.ts.map +1 -0
  143. package/dist/ink-ui/components/ToolCallDisplay.js +378 -0
  144. package/dist/ink-ui/components/ToolCallDisplay.js.map +1 -0
  145. package/dist/ink-ui/components/WritePreview.d.ts +42 -0
  146. package/dist/ink-ui/components/WritePreview.d.ts.map +1 -0
  147. package/dist/ink-ui/components/WritePreview.js +100 -0
  148. package/dist/ink-ui/components/WritePreview.js.map +1 -0
  149. package/dist/ink-ui/contexts/KeypressContext.d.ts +32 -0
  150. package/dist/ink-ui/contexts/KeypressContext.d.ts.map +1 -0
  151. package/dist/ink-ui/contexts/KeypressContext.js +529 -0
  152. package/dist/ink-ui/contexts/KeypressContext.js.map +1 -0
  153. package/dist/ink-ui/contexts/SessionContext.d.ts +46 -0
  154. package/dist/ink-ui/contexts/SessionContext.d.ts.map +1 -0
  155. package/dist/ink-ui/contexts/SessionContext.js +162 -0
  156. package/dist/ink-ui/contexts/SessionContext.js.map +1 -0
  157. package/dist/ink-ui/core-stubs.d.ts +270 -0
  158. package/dist/ink-ui/core-stubs.d.ts.map +1 -0
  159. package/dist/ink-ui/core-stubs.js +276 -0
  160. package/dist/ink-ui/core-stubs.js.map +1 -0
  161. package/dist/ink-ui/cortex-types.d.ts +214 -0
  162. package/dist/ink-ui/cortex-types.d.ts.map +1 -0
  163. package/dist/ink-ui/cortex-types.js +52 -0
  164. package/dist/ink-ui/cortex-types.js.map +1 -0
  165. package/dist/ink-ui/hooks/useCortexStream.d.ts +75 -0
  166. package/dist/ink-ui/hooks/useCortexStream.d.ts.map +1 -0
  167. package/dist/ink-ui/hooks/useCortexStream.js +518 -0
  168. package/dist/ink-ui/hooks/useCortexStream.js.map +1 -0
  169. package/dist/ink-ui/hooks/useFocus.d.ts +11 -0
  170. package/dist/ink-ui/hooks/useFocus.d.ts.map +1 -0
  171. package/dist/ink-ui/hooks/useFocus.js +51 -0
  172. package/dist/ink-ui/hooks/useFocus.js.map +1 -0
  173. package/dist/ink-ui/hooks/useHistoryManager.d.ts +23 -0
  174. package/dist/ink-ui/hooks/useHistoryManager.d.ts.map +1 -0
  175. package/dist/ink-ui/hooks/useHistoryManager.js +63 -0
  176. package/dist/ink-ui/hooks/useHistoryManager.js.map +1 -0
  177. package/dist/ink-ui/hooks/useKeypress.d.ts +18 -0
  178. package/dist/ink-ui/hooks/useKeypress.d.ts.map +1 -0
  179. package/dist/ink-ui/hooks/useKeypress.js +27 -0
  180. package/dist/ink-ui/hooks/useKeypress.js.map +1 -0
  181. package/dist/ink-ui/hooks/useReactApprovalHandler.d.ts +74 -0
  182. package/dist/ink-ui/hooks/useReactApprovalHandler.d.ts.map +1 -0
  183. package/dist/ink-ui/hooks/useReactApprovalHandler.js +83 -0
  184. package/dist/ink-ui/hooks/useReactApprovalHandler.js.map +1 -0
  185. package/dist/ink-ui/hooks/useTerminalSize.d.ts +10 -0
  186. package/dist/ink-ui/hooks/useTerminalSize.d.ts.map +1 -0
  187. package/dist/ink-ui/hooks/useTerminalSize.js +28 -0
  188. package/dist/ink-ui/hooks/useTerminalSize.js.map +1 -0
  189. package/dist/ink-ui/semantic-colors.d.ts +8 -0
  190. package/dist/ink-ui/semantic-colors.d.ts.map +1 -0
  191. package/dist/ink-ui/semantic-colors.js +24 -0
  192. package/dist/ink-ui/semantic-colors.js.map +1 -0
  193. package/dist/ink-ui/state/extensions.d.ts +68 -0
  194. package/dist/ink-ui/state/extensions.d.ts.map +1 -0
  195. package/dist/ink-ui/state/extensions.js +97 -0
  196. package/dist/ink-ui/state/extensions.js.map +1 -0
  197. package/dist/ink-ui/themes/ansi-light.d.ts +8 -0
  198. package/dist/ink-ui/themes/ansi-light.d.ts.map +1 -0
  199. package/dist/ink-ui/themes/ansi-light.js +143 -0
  200. package/dist/ink-ui/themes/ansi-light.js.map +1 -0
  201. package/dist/ink-ui/themes/ansi.d.ts +8 -0
  202. package/dist/ink-ui/themes/ansi.d.ts.map +1 -0
  203. package/dist/ink-ui/themes/ansi.js +153 -0
  204. package/dist/ink-ui/themes/ansi.js.map +1 -0
  205. package/dist/ink-ui/themes/atom-one-dark.d.ts +8 -0
  206. package/dist/ink-ui/themes/atom-one-dark.d.ts.map +1 -0
  207. package/dist/ink-ui/themes/atom-one-dark.js +140 -0
  208. package/dist/ink-ui/themes/atom-one-dark.js.map +1 -0
  209. package/dist/ink-ui/themes/ayu-light.d.ts +8 -0
  210. package/dist/ink-ui/themes/ayu-light.d.ts.map +1 -0
  211. package/dist/ink-ui/themes/ayu-light.js +132 -0
  212. package/dist/ink-ui/themes/ayu-light.js.map +1 -0
  213. package/dist/ink-ui/themes/ayu.d.ts +8 -0
  214. package/dist/ink-ui/themes/ayu.d.ts.map +1 -0
  215. package/dist/ink-ui/themes/ayu.js +106 -0
  216. package/dist/ink-ui/themes/ayu.js.map +1 -0
  217. package/dist/ink-ui/themes/color-utils.d.ts +23 -0
  218. package/dist/ink-ui/themes/color-utils.d.ts.map +1 -0
  219. package/dist/ink-ui/themes/color-utils.js +237 -0
  220. package/dist/ink-ui/themes/color-utils.js.map +1 -0
  221. package/dist/ink-ui/themes/default-light.d.ts +8 -0
  222. package/dist/ink-ui/themes/default-light.d.ts.map +1 -0
  223. package/dist/ink-ui/themes/default-light.js +100 -0
  224. package/dist/ink-ui/themes/default-light.js.map +1 -0
  225. package/dist/ink-ui/themes/default.d.ts +8 -0
  226. package/dist/ink-ui/themes/default.d.ts.map +1 -0
  227. package/dist/ink-ui/themes/default.js +143 -0
  228. package/dist/ink-ui/themes/default.js.map +1 -0
  229. package/dist/ink-ui/themes/dracula.d.ts +8 -0
  230. package/dist/ink-ui/themes/dracula.d.ts.map +1 -0
  231. package/dist/ink-ui/themes/dracula.js +117 -0
  232. package/dist/ink-ui/themes/dracula.js.map +1 -0
  233. package/dist/ink-ui/themes/github-dark.d.ts +8 -0
  234. package/dist/ink-ui/themes/github-dark.d.ts.map +1 -0
  235. package/dist/ink-ui/themes/github-dark.js +140 -0
  236. package/dist/ink-ui/themes/github-dark.js.map +1 -0
  237. package/dist/ink-ui/themes/github-light.d.ts +8 -0
  238. package/dist/ink-ui/themes/github-light.d.ts.map +1 -0
  239. package/dist/ink-ui/themes/github-light.js +142 -0
  240. package/dist/ink-ui/themes/github-light.js.map +1 -0
  241. package/dist/ink-ui/themes/googlecode.d.ts +8 -0
  242. package/dist/ink-ui/themes/googlecode.d.ts.map +1 -0
  243. package/dist/ink-ui/themes/googlecode.js +139 -0
  244. package/dist/ink-ui/themes/googlecode.js.map +1 -0
  245. package/dist/ink-ui/themes/no-color.d.ts +8 -0
  246. package/dist/ink-ui/themes/no-color.d.ts.map +1 -0
  247. package/dist/ink-ui/themes/no-color.js +118 -0
  248. package/dist/ink-ui/themes/no-color.js.map +1 -0
  249. package/dist/ink-ui/themes/semantic-tokens.d.ts +40 -0
  250. package/dist/ink-ui/themes/semantic-tokens.d.ts.map +1 -0
  251. package/dist/ink-ui/themes/semantic-tokens.js +100 -0
  252. package/dist/ink-ui/themes/semantic-tokens.js.map +1 -0
  253. package/dist/ink-ui/themes/shades-of-purple.d.ts +12 -0
  254. package/dist/ink-ui/themes/shades-of-purple.d.ts.map +1 -0
  255. package/dist/ink-ui/themes/shades-of-purple.js +306 -0
  256. package/dist/ink-ui/themes/shades-of-purple.js.map +1 -0
  257. package/dist/ink-ui/themes/theme-manager.d.ts +67 -0
  258. package/dist/ink-ui/themes/theme-manager.d.ts.map +1 -0
  259. package/dist/ink-ui/themes/theme-manager.js +263 -0
  260. package/dist/ink-ui/themes/theme-manager.js.map +1 -0
  261. package/dist/ink-ui/themes/theme.d.ts +134 -0
  262. package/dist/ink-ui/themes/theme.d.ts.map +1 -0
  263. package/dist/ink-ui/themes/theme.js +390 -0
  264. package/dist/ink-ui/themes/theme.js.map +1 -0
  265. package/dist/ink-ui/themes/xcode.d.ts +8 -0
  266. package/dist/ink-ui/themes/xcode.d.ts.map +1 -0
  267. package/dist/ink-ui/themes/xcode.js +147 -0
  268. package/dist/ink-ui/themes/xcode.js.map +1 -0
  269. package/dist/ink-ui/types.d.ts +306 -0
  270. package/dist/ink-ui/types.d.ts.map +1 -0
  271. package/dist/ink-ui/types.js +65 -0
  272. package/dist/ink-ui/types.js.map +1 -0
  273. package/dist/ink-ui/utils/input.d.ts +18 -0
  274. package/dist/ink-ui/utils/input.d.ts.map +1 -0
  275. package/dist/ink-ui/utils/input.js +51 -0
  276. package/dist/ink-ui/utils/input.js.map +1 -0
  277. package/dist/ink-ui/utils/mouse.d.ts +33 -0
  278. package/dist/ink-ui/utils/mouse.d.ts.map +1 -0
  279. package/dist/ink-ui/utils/mouse.js +182 -0
  280. package/dist/ink-ui/utils/mouse.js.map +1 -0
  281. package/dist/services/BuiltinCommandLoader.d.ts +21 -0
  282. package/dist/services/BuiltinCommandLoader.d.ts.map +1 -0
  283. package/dist/services/BuiltinCommandLoader.js +182 -0
  284. package/dist/services/BuiltinCommandLoader.js.map +1 -0
  285. package/dist/services/CommandService.d.ts +39 -0
  286. package/dist/services/CommandService.d.ts.map +1 -0
  287. package/dist/services/CommandService.js +49 -0
  288. package/dist/services/CommandService.js.map +1 -0
  289. package/dist/services/FileCommandLoader.d.ts +16 -0
  290. package/dist/services/FileCommandLoader.d.ts.map +1 -0
  291. package/dist/services/FileCommandLoader.js +19 -0
  292. package/dist/services/FileCommandLoader.js.map +1 -0
  293. package/dist/services/McpPromptLoader.d.ts +16 -0
  294. package/dist/services/McpPromptLoader.d.ts.map +1 -0
  295. package/dist/services/McpPromptLoader.js +19 -0
  296. package/dist/services/McpPromptLoader.js.map +1 -0
  297. package/dist/services/index.d.ts +8 -0
  298. package/dist/services/index.d.ts.map +1 -0
  299. package/dist/services/index.js +8 -0
  300. package/dist/services/index.js.map +1 -0
  301. package/dist/ui/ChalkMenuRenderer.d.ts +22 -0
  302. package/dist/ui/ChalkMenuRenderer.d.ts.map +1 -0
  303. package/dist/ui/ChalkMenuRenderer.js +478 -0
  304. package/dist/ui/ChalkMenuRenderer.js.map +1 -0
  305. package/dist/ui/ChalkModelPicker.d.ts +20 -0
  306. package/dist/ui/ChalkModelPicker.d.ts.map +1 -0
  307. package/dist/ui/ChalkModelPicker.js +363 -0
  308. package/dist/ui/ChalkModelPicker.js.map +1 -0
  309. package/dist/ui/ChalkThemePicker.d.ts +20 -0
  310. package/dist/ui/ChalkThemePicker.d.ts.map +1 -0
  311. package/dist/ui/ChalkThemePicker.js +370 -0
  312. package/dist/ui/ChalkThemePicker.js.map +1 -0
  313. package/dist/ui/InkApprovalDialog.d.ts +8 -0
  314. package/dist/ui/InkApprovalDialog.d.ts.map +1 -0
  315. package/dist/ui/InkApprovalDialog.js +25 -0
  316. package/dist/ui/InkApprovalDialog.js.map +1 -0
  317. package/dist/ui/InkCommandPalette.d.ts +43 -0
  318. package/dist/ui/InkCommandPalette.d.ts.map +1 -0
  319. package/dist/ui/InkCommandPalette.js +105 -0
  320. package/dist/ui/InkCommandPalette.js.map +1 -0
  321. package/dist/ui/InkConfigMenu.d.ts +24 -0
  322. package/dist/ui/InkConfigMenu.d.ts.map +1 -0
  323. package/dist/ui/InkConfigMenu.js +259 -0
  324. package/dist/ui/InkConfigMenu.js.map +1 -0
  325. package/dist/ui/InkHelp.d.ts +25 -0
  326. package/dist/ui/InkHelp.d.ts.map +1 -0
  327. package/dist/ui/InkHelp.js +55 -0
  328. package/dist/ui/InkHelp.js.map +1 -0
  329. package/dist/ui/InkMenuPicker.d.ts +19 -0
  330. package/dist/ui/InkMenuPicker.d.ts.map +1 -0
  331. package/dist/ui/InkMenuPicker.js +33 -0
  332. package/dist/ui/InkMenuPicker.js.map +1 -0
  333. package/dist/ui/InkModelPicker.d.ts +23 -0
  334. package/dist/ui/InkModelPicker.d.ts.map +1 -0
  335. package/dist/ui/InkModelPicker.js +53 -0
  336. package/dist/ui/InkModelPicker.js.map +1 -0
  337. package/dist/ui/PersistentInput.d.ts +91 -0
  338. package/dist/ui/PersistentInput.d.ts.map +1 -0
  339. package/dist/ui/PersistentInput.js +283 -0
  340. package/dist/ui/PersistentInput.js.map +1 -0
  341. package/dist/ui/RawInput.d.ts +27 -0
  342. package/dist/ui/RawInput.d.ts.map +1 -0
  343. package/dist/ui/RawInput.js +731 -0
  344. package/dist/ui/RawInput.js.map +1 -0
  345. package/dist/ui/SlashCommandAutocomplete.d.ts +94 -0
  346. package/dist/ui/SlashCommandAutocomplete.d.ts.map +1 -0
  347. package/dist/ui/SlashCommandAutocomplete.js +274 -0
  348. package/dist/ui/SlashCommandAutocomplete.js.map +1 -0
  349. package/dist/ui/SplashScreen.d.ts +76 -0
  350. package/dist/ui/SplashScreen.d.ts.map +1 -0
  351. package/dist/ui/SplashScreen.js +316 -0
  352. package/dist/ui/SplashScreen.js.map +1 -0
  353. package/dist/ui/components/ArtifactDashboard.d.ts +16 -0
  354. package/dist/ui/components/ArtifactDashboard.d.ts.map +1 -0
  355. package/dist/ui/components/ArtifactDashboard.js +102 -0
  356. package/dist/ui/components/ArtifactDashboard.js.map +1 -0
  357. package/dist/ui/components/ChatInput.d.ts +36 -0
  358. package/dist/ui/components/ChatInput.d.ts.map +1 -0
  359. package/dist/ui/components/ChatInput.js +11 -0
  360. package/dist/ui/components/ChatInput.js.map +1 -0
  361. package/dist/ui/components/ConfigWizard.d.ts +17 -0
  362. package/dist/ui/components/ConfigWizard.d.ts.map +1 -0
  363. package/dist/ui/components/ConfigWizard.js +134 -0
  364. package/dist/ui/components/ConfigWizard.js.map +1 -0
  365. package/dist/ui/components/ContextViewer.d.ts +18 -0
  366. package/dist/ui/components/ContextViewer.d.ts.map +1 -0
  367. package/dist/ui/components/ContextViewer.js +85 -0
  368. package/dist/ui/components/ContextViewer.js.map +1 -0
  369. package/dist/ui/components/MiddlewareDashboard.d.ts +16 -0
  370. package/dist/ui/components/MiddlewareDashboard.d.ts.map +1 -0
  371. package/dist/ui/components/MiddlewareDashboard.js +98 -0
  372. package/dist/ui/components/MiddlewareDashboard.js.map +1 -0
  373. package/dist/ui/components/ModelPicker.d.ts +24 -0
  374. package/dist/ui/components/ModelPicker.d.ts.map +1 -0
  375. package/dist/ui/components/ModelPicker.js +96 -0
  376. package/dist/ui/components/ModelPicker.js.map +1 -0
  377. package/dist/ui/components/MultiLineInput.d.ts +27 -0
  378. package/dist/ui/components/MultiLineInput.d.ts.map +1 -0
  379. package/dist/ui/components/MultiLineInput.js +182 -0
  380. package/dist/ui/components/MultiLineInput.js.map +1 -0
  381. package/dist/ui/components/PermissionsBrowser.d.ts +16 -0
  382. package/dist/ui/components/PermissionsBrowser.d.ts.map +1 -0
  383. package/dist/ui/components/PermissionsBrowser.js +110 -0
  384. package/dist/ui/components/PermissionsBrowser.js.map +1 -0
  385. package/dist/ui/components/SessionBrowser.d.ts +19 -0
  386. package/dist/ui/components/SessionBrowser.d.ts.map +1 -0
  387. package/dist/ui/components/SessionBrowser.js +66 -0
  388. package/dist/ui/components/SessionBrowser.js.map +1 -0
  389. package/dist/ui/components/StatusBar.d.ts +32 -0
  390. package/dist/ui/components/StatusBar.d.ts.map +1 -0
  391. package/dist/ui/components/StatusBar.js +27 -0
  392. package/dist/ui/components/StatusBar.js.map +1 -0
  393. package/dist/ui/components/SystemMessageBrowser.d.ts +11 -0
  394. package/dist/ui/components/SystemMessageBrowser.d.ts.map +1 -0
  395. package/dist/ui/components/SystemMessageBrowser.js +106 -0
  396. package/dist/ui/components/SystemMessageBrowser.js.map +1 -0
  397. package/dist/ui/components/ThemePicker.d.ts +11 -0
  398. package/dist/ui/components/ThemePicker.d.ts.map +1 -0
  399. package/dist/ui/components/ThemePicker.js +62 -0
  400. package/dist/ui/components/ThemePicker.js.map +1 -0
  401. package/dist/ui/components/TmuxBrowser.d.ts +11 -0
  402. package/dist/ui/components/TmuxBrowser.d.ts.map +1 -0
  403. package/dist/ui/components/TmuxBrowser.js +85 -0
  404. package/dist/ui/components/TmuxBrowser.js.map +1 -0
  405. package/dist/ui/components/index.d.ts +22 -0
  406. package/dist/ui/components/index.d.ts.map +1 -0
  407. package/dist/ui/components/index.js +21 -0
  408. package/dist/ui/components/index.js.map +1 -0
  409. package/package.json +70 -0
@@ -0,0 +1,263 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { AyuDark } from './ayu.js';
7
+ import { AyuLight } from './ayu-light.js';
8
+ import { AtomOneDark } from './atom-one-dark.js';
9
+ import { Dracula } from './dracula.js';
10
+ import { GitHubDark } from './github-dark.js';
11
+ import { GitHubLight } from './github-light.js';
12
+ import { GoogleCode } from './googlecode.js';
13
+ import { DefaultLight } from './default-light.js';
14
+ import { DefaultDark } from './default.js';
15
+ import { ShadesOfPurple } from './shades-of-purple.js';
16
+ import { XCode } from './xcode.js';
17
+ import * as fs from 'node:fs';
18
+ import * as path from 'node:path';
19
+ import * as os from 'node:os';
20
+ import { createCustomTheme, validateCustomTheme } from './theme.js';
21
+ import { ANSI } from './ansi.js';
22
+ import { ANSILight } from './ansi-light.js';
23
+ import { NoColorTheme } from './no-color.js';
24
+ import process from 'node:process';
25
+ import { debugLogger } from '../core-stubs.js';
26
+ export const DEFAULT_THEME = DefaultDark;
27
+ class ThemeManager {
28
+ availableThemes;
29
+ activeTheme;
30
+ customThemes = new Map();
31
+ constructor() {
32
+ this.availableThemes = [
33
+ AyuDark,
34
+ AyuLight,
35
+ AtomOneDark,
36
+ Dracula,
37
+ DefaultLight,
38
+ DefaultDark,
39
+ GitHubDark,
40
+ GitHubLight,
41
+ GoogleCode,
42
+ ShadesOfPurple,
43
+ XCode,
44
+ ANSI,
45
+ ANSILight,
46
+ ];
47
+ this.activeTheme = DEFAULT_THEME;
48
+ }
49
+ /**
50
+ * Loads custom themes from settings.
51
+ * @param customThemesSettings Custom themes from settings.
52
+ */
53
+ loadCustomThemes(customThemesSettings) {
54
+ this.customThemes.clear();
55
+ if (!customThemesSettings) {
56
+ return;
57
+ }
58
+ for (const [name, customThemeConfig] of Object.entries(customThemesSettings)) {
59
+ const validation = validateCustomTheme(customThemeConfig);
60
+ if (validation.isValid) {
61
+ if (validation.warning) {
62
+ debugLogger.warn(`Theme "${name}": ${validation.warning}`);
63
+ }
64
+ const themeWithDefaults = {
65
+ ...DEFAULT_THEME.colors,
66
+ ...customThemeConfig,
67
+ name: customThemeConfig.name || name,
68
+ type: 'custom',
69
+ };
70
+ try {
71
+ const theme = createCustomTheme(themeWithDefaults);
72
+ this.customThemes.set(name, theme);
73
+ }
74
+ catch (error) {
75
+ debugLogger.warn(`Failed to load custom theme "${name}":`, error);
76
+ }
77
+ }
78
+ else {
79
+ debugLogger.warn(`Invalid custom theme "${name}": ${validation.error}`);
80
+ }
81
+ }
82
+ // If the current active theme is a custom theme, keep it if still valid
83
+ if (this.activeTheme &&
84
+ this.activeTheme.type === 'custom' &&
85
+ this.customThemes.has(this.activeTheme.name)) {
86
+ this.activeTheme = this.customThemes.get(this.activeTheme.name);
87
+ }
88
+ }
89
+ /**
90
+ * Sets the active theme.
91
+ * @param themeName The name of the theme to set as active.
92
+ * @returns True if the theme was successfully set, false otherwise.
93
+ */
94
+ setActiveTheme(themeName) {
95
+ const theme = this.findThemeByName(themeName);
96
+ if (!theme) {
97
+ return false;
98
+ }
99
+ this.activeTheme = theme;
100
+ return true;
101
+ }
102
+ /**
103
+ * Gets the currently active theme.
104
+ * @returns The active theme.
105
+ */
106
+ getActiveTheme() {
107
+ if (process.env['NO_COLOR']) {
108
+ return NoColorTheme;
109
+ }
110
+ if (this.activeTheme) {
111
+ const isBuiltIn = this.availableThemes.some((t) => t.name === this.activeTheme.name);
112
+ const isCustom = [...this.customThemes.values()].includes(this.activeTheme);
113
+ if (isBuiltIn || isCustom) {
114
+ return this.activeTheme;
115
+ }
116
+ }
117
+ // Fallback to default if no active theme or if it's no longer valid.
118
+ this.activeTheme = DEFAULT_THEME;
119
+ return this.activeTheme;
120
+ }
121
+ /**
122
+ * Gets the semantic colors for the active theme.
123
+ * @returns The semantic colors.
124
+ */
125
+ getSemanticColors() {
126
+ return this.getActiveTheme().semanticColors;
127
+ }
128
+ /**
129
+ * Gets a list of custom theme names.
130
+ * @returns Array of custom theme names.
131
+ */
132
+ getCustomThemeNames() {
133
+ return Array.from(this.customThemes.keys());
134
+ }
135
+ /**
136
+ * Checks if a theme name is a custom theme.
137
+ * @param themeName The theme name to check.
138
+ * @returns True if the theme is custom.
139
+ */
140
+ isCustomTheme(themeName) {
141
+ return this.customThemes.has(themeName);
142
+ }
143
+ /**
144
+ * Returns a list of available theme names.
145
+ */
146
+ getAvailableThemes() {
147
+ const builtInThemes = this.availableThemes.map((theme) => ({
148
+ name: theme.name,
149
+ type: theme.type,
150
+ isCustom: false,
151
+ }));
152
+ const customThemes = Array.from(this.customThemes.values()).map((theme) => ({
153
+ name: theme.name,
154
+ type: theme.type,
155
+ isCustom: true,
156
+ }));
157
+ const allThemes = [...builtInThemes, ...customThemes];
158
+ const sortedThemes = allThemes.sort((a, b) => {
159
+ const typeOrder = (type) => {
160
+ switch (type) {
161
+ case 'dark':
162
+ return 1;
163
+ case 'light':
164
+ return 2;
165
+ case 'ansi':
166
+ return 3;
167
+ case 'custom':
168
+ return 4; // Custom themes at the end
169
+ default:
170
+ return 5;
171
+ }
172
+ };
173
+ const typeComparison = typeOrder(a.type) - typeOrder(b.type);
174
+ if (typeComparison !== 0) {
175
+ return typeComparison;
176
+ }
177
+ return a.name.localeCompare(b.name);
178
+ });
179
+ return sortedThemes;
180
+ }
181
+ /**
182
+ * Gets a theme by name.
183
+ * @param themeName The name of the theme to get.
184
+ * @returns The theme if found, undefined otherwise.
185
+ */
186
+ getTheme(themeName) {
187
+ return this.findThemeByName(themeName);
188
+ }
189
+ isPath(themeName) {
190
+ return (themeName.endsWith('.json') ||
191
+ themeName.startsWith('.') ||
192
+ path.isAbsolute(themeName));
193
+ }
194
+ loadThemeFromFile(themePath) {
195
+ try {
196
+ // realpathSync resolves the path and throws if it doesn't exist.
197
+ const canonicalPath = fs.realpathSync(path.resolve(themePath));
198
+ // 1. Check cache using the canonical path.
199
+ if (this.customThemes.has(canonicalPath)) {
200
+ return this.customThemes.get(canonicalPath);
201
+ }
202
+ // 2. Perform security check.
203
+ const homeDir = path.resolve(os.homedir());
204
+ if (!canonicalPath.startsWith(homeDir)) {
205
+ debugLogger.warn(`Theme file at "${themePath}" is outside your home directory. ` +
206
+ `Only load themes from trusted sources.`);
207
+ return undefined;
208
+ }
209
+ // 3. Read, parse, and validate the theme file.
210
+ const themeContent = fs.readFileSync(canonicalPath, 'utf-8');
211
+ const customThemeConfig = JSON.parse(themeContent);
212
+ const validation = validateCustomTheme(customThemeConfig);
213
+ if (!validation.isValid) {
214
+ debugLogger.warn(`Invalid custom theme from file "${themePath}": ${validation.error}`);
215
+ return undefined;
216
+ }
217
+ if (validation.warning) {
218
+ debugLogger.warn(`Theme from "${themePath}": ${validation.warning}`);
219
+ }
220
+ // 4. Create and cache the theme.
221
+ const themeWithDefaults = {
222
+ ...DEFAULT_THEME.colors,
223
+ ...customThemeConfig,
224
+ name: customThemeConfig.name || canonicalPath,
225
+ type: 'custom',
226
+ };
227
+ const theme = createCustomTheme(themeWithDefaults);
228
+ this.customThemes.set(canonicalPath, theme); // Cache by canonical path
229
+ return theme;
230
+ }
231
+ catch (error) {
232
+ // Any error in the process (file not found, bad JSON, etc.) is caught here.
233
+ // We can return undefined silently for file-not-found, and warn for others.
234
+ if (!(error instanceof Error && 'code' in error && error.code === 'ENOENT')) {
235
+ debugLogger.warn(`Could not load theme from file "${themePath}":`, error);
236
+ }
237
+ return undefined;
238
+ }
239
+ }
240
+ findThemeByName(themeName) {
241
+ if (!themeName) {
242
+ return DEFAULT_THEME;
243
+ }
244
+ // First check built-in themes
245
+ const builtInTheme = this.availableThemes.find((theme) => theme.name === themeName);
246
+ if (builtInTheme) {
247
+ return builtInTheme;
248
+ }
249
+ // Then check custom themes that have been loaded from settings, or file paths
250
+ if (this.isPath(themeName)) {
251
+ return this.loadThemeFromFile(themeName);
252
+ }
253
+ if (this.customThemes.has(themeName)) {
254
+ return this.customThemes.get(themeName);
255
+ }
256
+ // If it's not a built-in, not in cache, and not a valid file path,
257
+ // it's not a valid theme.
258
+ return undefined;
259
+ }
260
+ }
261
+ // Export an instance of the ThemeManager
262
+ export const themeManager = new ThemeManager();
263
+ //# sourceMappingURL=theme-manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-manager.js","sourceRoot":"","sources":["../../../src/ink-ui/themes/theme-manager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEpE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EA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,CAAC"}
@@ -0,0 +1,134 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { CSSProperties } from 'react';
7
+ import type { SemanticColors } from './semantic-tokens.js';
8
+ export type ThemeType = 'light' | 'dark' | 'ansi' | 'custom';
9
+ export interface ColorsTheme {
10
+ type: ThemeType;
11
+ Background: string;
12
+ Foreground: string;
13
+ LightBlue: string;
14
+ AccentBlue: string;
15
+ AccentPurple: string;
16
+ AccentCyan: string;
17
+ AccentGreen: string;
18
+ AccentYellow: string;
19
+ AccentRed: string;
20
+ DiffAdded: string;
21
+ DiffRemoved: string;
22
+ Comment: string;
23
+ Gray: string;
24
+ DarkGray: string;
25
+ GradientColors?: string[];
26
+ }
27
+ export interface CustomTheme {
28
+ type: 'custom';
29
+ name: string;
30
+ text?: {
31
+ primary?: string;
32
+ secondary?: string;
33
+ link?: string;
34
+ accent?: string;
35
+ response?: string;
36
+ };
37
+ background?: {
38
+ primary?: string;
39
+ diff?: {
40
+ added?: string;
41
+ removed?: string;
42
+ };
43
+ };
44
+ border?: {
45
+ default?: string;
46
+ focused?: string;
47
+ };
48
+ ui?: {
49
+ comment?: string;
50
+ symbol?: string;
51
+ gradient?: string[];
52
+ };
53
+ status?: {
54
+ error?: string;
55
+ success?: string;
56
+ warning?: string;
57
+ };
58
+ Background?: string;
59
+ Foreground?: string;
60
+ LightBlue?: string;
61
+ AccentBlue?: string;
62
+ AccentPurple?: string;
63
+ AccentCyan?: string;
64
+ AccentGreen?: string;
65
+ AccentYellow?: string;
66
+ AccentRed?: string;
67
+ DiffAdded?: string;
68
+ DiffRemoved?: string;
69
+ Comment?: string;
70
+ Gray?: string;
71
+ DarkGray?: string;
72
+ GradientColors?: string[];
73
+ }
74
+ export declare const lightTheme: ColorsTheme;
75
+ export declare const darkTheme: ColorsTheme;
76
+ export declare const ansiTheme: ColorsTheme;
77
+ export declare class Theme {
78
+ readonly name: string;
79
+ readonly type: ThemeType;
80
+ readonly colors: ColorsTheme;
81
+ /**
82
+ * The default foreground color for text when no specific highlight rule applies.
83
+ * This is an Ink-compatible color string (hex or name).
84
+ */
85
+ readonly defaultColor: string;
86
+ /**
87
+ * Stores the mapping from highlight.js class names (e.g., 'hljs-keyword')
88
+ * to Ink-compatible color strings (hex or name).
89
+ */
90
+ protected readonly _colorMap: Readonly<Record<string, string>>;
91
+ readonly semanticColors: SemanticColors;
92
+ /**
93
+ * Creates a new Theme instance.
94
+ * @param name The name of the theme.
95
+ * @param rawMappings The raw CSSProperties mappings from a react-syntax-highlighter theme object.
96
+ */
97
+ constructor(name: string, type: ThemeType, rawMappings: Record<string, CSSProperties>, colors: ColorsTheme, semanticColors?: SemanticColors);
98
+ /**
99
+ * Gets the Ink-compatible color string for a given highlight.js class name.
100
+ * @param hljsClass The highlight.js class name (e.g., 'hljs-keyword', 'hljs-string').
101
+ * @returns The corresponding Ink color string (hex or name) if it exists.
102
+ */
103
+ getInkColor(hljsClass: string): string | undefined;
104
+ /**
105
+ * Resolves a CSS color value (name or hex) into an Ink-compatible color string.
106
+ * @param colorValue The raw color string (e.g., 'blue', '#ff0000', 'darkkhaki').
107
+ * @returns An Ink-compatible color string (hex or name), or undefined if not resolvable.
108
+ */
109
+ private static _resolveColor;
110
+ /**
111
+ * Builds the internal map from highlight.js class names to Ink-compatible color strings.
112
+ * This method is protected and primarily intended for use by the constructor.
113
+ * @param hljsTheme The raw CSSProperties mappings from a react-syntax-highlighter theme object.
114
+ * @returns An Ink-compatible theme map (Record<string, string>).
115
+ */
116
+ protected _buildColorMap(hljsTheme: Record<string, CSSProperties>): Record<string, string>;
117
+ }
118
+ /**
119
+ * Creates a Theme instance from a custom theme configuration.
120
+ * @param customTheme The custom theme configuration.
121
+ * @returns A new Theme instance.
122
+ */
123
+ export declare function createCustomTheme(customTheme: CustomTheme): Theme;
124
+ /**
125
+ * Validates a custom theme configuration.
126
+ * @param customTheme The custom theme to validate.
127
+ * @returns An object with isValid boolean and error message if invalid.
128
+ */
129
+ export declare function validateCustomTheme(customTheme: Partial<CustomTheme>): {
130
+ isValid: boolean;
131
+ error?: string;
132
+ warning?: string;
133
+ };
134
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/ink-ui/themes/theme.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAG3D,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE7D,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,SAAS,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IAEb,IAAI,CAAC,EAAE;QACL,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB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