@hibanacloud/cli 0.3.15

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 (1476) hide show
  1. package/dist/.last_build +0 -0
  2. package/dist/index.d.ts +7 -0
  3. package/dist/index.js +29 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/package.json +115 -0
  6. package/dist/src/commands/extensions/disable.d.ts +13 -0
  7. package/dist/src/commands/extensions/disable.js +56 -0
  8. package/dist/src/commands/extensions/disable.js.map +1 -0
  9. package/dist/src/commands/extensions/enable.d.ts +13 -0
  10. package/dist/src/commands/extensions/enable.js +59 -0
  11. package/dist/src/commands/extensions/enable.js.map +1 -0
  12. package/dist/src/commands/extensions/examples/context/QWEN.md +8 -0
  13. package/dist/src/commands/extensions/examples/context/qwen-extension.json +4 -0
  14. package/dist/src/commands/extensions/examples/custom-commands/commands/fs/grep-code.toml +6 -0
  15. package/dist/src/commands/extensions/examples/custom-commands/qwen-extension.json +4 -0
  16. package/dist/src/commands/extensions/examples/exclude-tools/qwen-extension.json +5 -0
  17. package/dist/src/commands/extensions/examples/mcp-server/example.ts +60 -0
  18. package/dist/src/commands/extensions/examples/mcp-server/package.json +18 -0
  19. package/dist/src/commands/extensions/examples/mcp-server/qwen-extension.json +11 -0
  20. package/dist/src/commands/extensions/examples/mcp-server/tsconfig.json +13 -0
  21. package/dist/src/commands/extensions/install.d.ts +14 -0
  22. package/dist/src/commands/extensions/install.js +78 -0
  23. package/dist/src/commands/extensions/install.js.map +1 -0
  24. package/dist/src/commands/extensions/install.test.d.ts +6 -0
  25. package/dist/src/commands/extensions/install.test.js +102 -0
  26. package/dist/src/commands/extensions/install.test.js.map +1 -0
  27. package/dist/src/commands/extensions/link.d.ts +12 -0
  28. package/dist/src/commands/extensions/link.js +37 -0
  29. package/dist/src/commands/extensions/link.js.map +1 -0
  30. package/dist/src/commands/extensions/list.d.ts +8 -0
  31. package/dist/src/commands/extensions/list.js +32 -0
  32. package/dist/src/commands/extensions/list.js.map +1 -0
  33. package/dist/src/commands/extensions/new.d.ts +7 -0
  34. package/dist/src/commands/extensions/new.js +90 -0
  35. package/dist/src/commands/extensions/new.js.map +1 -0
  36. package/dist/src/commands/extensions/new.test.d.ts +6 -0
  37. package/dist/src/commands/extensions/new.test.js +59 -0
  38. package/dist/src/commands/extensions/new.test.js.map +1 -0
  39. package/dist/src/commands/extensions/uninstall.d.ts +12 -0
  40. package/dist/src/commands/extensions/uninstall.js +38 -0
  41. package/dist/src/commands/extensions/uninstall.js.map +1 -0
  42. package/dist/src/commands/extensions/uninstall.test.d.ts +6 -0
  43. package/dist/src/commands/extensions/uninstall.test.js +18 -0
  44. package/dist/src/commands/extensions/uninstall.test.js.map +1 -0
  45. package/dist/src/commands/extensions/update.d.ts +13 -0
  46. package/dist/src/commands/extensions/update.js +104 -0
  47. package/dist/src/commands/extensions/update.js.map +1 -0
  48. package/dist/src/commands/extensions.d.ts +7 -0
  49. package/dist/src/commands/extensions.js +33 -0
  50. package/dist/src/commands/extensions.js.map +1 -0
  51. package/dist/src/commands/mcp/add.d.ts +7 -0
  52. package/dist/src/commands/mcp/add.js +171 -0
  53. package/dist/src/commands/mcp/add.js.map +1 -0
  54. package/dist/src/commands/mcp/list.d.ts +8 -0
  55. package/dist/src/commands/mcp/list.js +111 -0
  56. package/dist/src/commands/mcp/list.js.map +1 -0
  57. package/dist/src/commands/mcp/remove.d.ts +7 -0
  58. package/dist/src/commands/mcp/remove.js +44 -0
  59. package/dist/src/commands/mcp/remove.js.map +1 -0
  60. package/dist/src/commands/mcp.d.ts +7 -0
  61. package/dist/src/commands/mcp.js +23 -0
  62. package/dist/src/commands/mcp.js.map +1 -0
  63. package/dist/src/config/auth.d.ts +6 -0
  64. package/dist/src/config/auth.js +28 -0
  65. package/dist/src/config/auth.js.map +1 -0
  66. package/dist/src/config/auth.test.d.ts +6 -0
  67. package/dist/src/config/auth.test.js +37 -0
  68. package/dist/src/config/auth.test.js.map +1 -0
  69. package/dist/src/config/config.d.ts +58 -0
  70. package/dist/src/config/config.js +678 -0
  71. package/dist/src/config/config.js.map +1 -0
  72. package/dist/src/config/extension.d.ts +83 -0
  73. package/dist/src/config/extension.js +534 -0
  74. package/dist/src/config/extension.js.map +1 -0
  75. package/dist/src/config/extensions/extensionEnablement.d.ts +47 -0
  76. package/dist/src/config/extensions/extensionEnablement.js +189 -0
  77. package/dist/src/config/extensions/extensionEnablement.js.map +1 -0
  78. package/dist/src/config/extensions/extensionEnablement.test.d.ts +6 -0
  79. package/dist/src/config/extensions/extensionEnablement.test.js +333 -0
  80. package/dist/src/config/extensions/extensionEnablement.test.js.map +1 -0
  81. package/dist/src/config/extensions/github.d.ts +30 -0
  82. package/dist/src/config/extensions/github.js +322 -0
  83. package/dist/src/config/extensions/github.js.map +1 -0
  84. package/dist/src/config/extensions/github.test.d.ts +6 -0
  85. package/dist/src/config/extensions/github.test.js +334 -0
  86. package/dist/src/config/extensions/github.test.js.map +1 -0
  87. package/dist/src/config/extensions/update.d.ts +19 -0
  88. package/dist/src/config/extensions/update.js +113 -0
  89. package/dist/src/config/extensions/update.js.map +1 -0
  90. package/dist/src/config/extensions/update.test.d.ts +6 -0
  91. package/dist/src/config/extensions/update.test.js +342 -0
  92. package/dist/src/config/extensions/update.test.js.map +1 -0
  93. package/dist/src/config/extensions/variableSchema.d.ts +36 -0
  94. package/dist/src/config/extensions/variableSchema.js +22 -0
  95. package/dist/src/config/extensions/variableSchema.js.map +1 -0
  96. package/dist/src/config/extensions/variables.d.ts +17 -0
  97. package/dist/src/config/extensions/variables.js +40 -0
  98. package/dist/src/config/extensions/variables.js.map +1 -0
  99. package/dist/src/config/extensions/variables.test.d.ts +6 -0
  100. package/dist/src/config/extensions/variables.test.js +17 -0
  101. package/dist/src/config/extensions/variables.test.js.map +1 -0
  102. package/dist/src/config/keyBindings.d.ts +70 -0
  103. package/dist/src/config/keyBindings.js +130 -0
  104. package/dist/src/config/keyBindings.js.map +1 -0
  105. package/dist/src/config/keyBindings.test.d.ts +6 -0
  106. package/dist/src/config/keyBindings.test.js +51 -0
  107. package/dist/src/config/keyBindings.test.js.map +1 -0
  108. package/dist/src/config/migration.d.ts +10 -0
  109. package/dist/src/config/migration.js +45 -0
  110. package/dist/src/config/migration.js.map +1 -0
  111. package/dist/src/config/sandboxConfig.d.ts +13 -0
  112. package/dist/src/config/sandboxConfig.js +73 -0
  113. package/dist/src/config/sandboxConfig.js.map +1 -0
  114. package/dist/src/config/settings.d.ts +72 -0
  115. package/dist/src/config/settings.js +631 -0
  116. package/dist/src/config/settings.js.map +1 -0
  117. package/dist/src/config/settingsSchema.d.ts +1174 -0
  118. package/dist/src/config/settingsSchema.js +1118 -0
  119. package/dist/src/config/settingsSchema.js.map +1 -0
  120. package/dist/src/config/settingsSchema.test.d.ts +6 -0
  121. package/dist/src/config/settingsSchema.test.js +201 -0
  122. package/dist/src/config/settingsSchema.test.js.map +1 -0
  123. package/dist/src/config/trustedFolders.d.ts +56 -0
  124. package/dist/src/config/trustedFolders.js +168 -0
  125. package/dist/src/config/trustedFolders.js.map +1 -0
  126. package/dist/src/config/trustedFolders.test.d.ts +6 -0
  127. package/dist/src/config/trustedFolders.test.js +340 -0
  128. package/dist/src/config/trustedFolders.test.js.map +1 -0
  129. package/dist/src/config/webSearch.d.ts +35 -0
  130. package/dist/src/config/webSearch.js +87 -0
  131. package/dist/src/config/webSearch.js.map +1 -0
  132. package/dist/src/core/auth.d.ts +13 -0
  133. package/dist/src/core/auth.js +34 -0
  134. package/dist/src/core/auth.js.map +1 -0
  135. package/dist/src/core/initializer.d.ts +21 -0
  136. package/dist/src/core/initializer.js +48 -0
  137. package/dist/src/core/initializer.js.map +1 -0
  138. package/dist/src/core/theme.d.ts +12 -0
  139. package/dist/src/core/theme.js +23 -0
  140. package/dist/src/core/theme.js.map +1 -0
  141. package/dist/src/gemini.d.ts +14 -0
  142. package/dist/src/gemini.js +327 -0
  143. package/dist/src/gemini.js.map +1 -0
  144. package/dist/src/gemini.test.d.ts +6 -0
  145. package/dist/src/gemini.test.js +507 -0
  146. package/dist/src/gemini.test.js.map +1 -0
  147. package/dist/src/generated/git-commit.d.ts +7 -0
  148. package/dist/src/generated/git-commit.js +10 -0
  149. package/dist/src/generated/git-commit.js.map +1 -0
  150. package/dist/src/i18n/index.d.ts +18 -0
  151. package/dist/src/i18n/index.js +184 -0
  152. package/dist/src/i18n/index.js.map +1 -0
  153. package/dist/src/i18n/locales/en.js +1129 -0
  154. package/dist/src/i18n/locales/zh.js +1052 -0
  155. package/dist/src/nonInteractive/control/ControlContext.d.ts +63 -0
  156. package/dist/src/nonInteractive/control/ControlContext.js +31 -0
  157. package/dist/src/nonInteractive/control/ControlContext.js.map +1 -0
  158. package/dist/src/nonInteractive/control/ControlDispatcher.d.ts +86 -0
  159. package/dist/src/nonInteractive/control/ControlDispatcher.js +238 -0
  160. package/dist/src/nonInteractive/control/ControlDispatcher.js.map +1 -0
  161. package/dist/src/nonInteractive/control/ControlDispatcher.test.d.ts +6 -0
  162. package/dist/src/nonInteractive/control/ControlDispatcher.test.js +549 -0
  163. package/dist/src/nonInteractive/control/ControlDispatcher.test.js.map +1 -0
  164. package/dist/src/nonInteractive/control/ControlService.d.ts +78 -0
  165. package/dist/src/nonInteractive/control/ControlService.js +154 -0
  166. package/dist/src/nonInteractive/control/ControlService.js.map +1 -0
  167. package/dist/src/nonInteractive/control/controllers/baseController.d.ts +50 -0
  168. package/dist/src/nonInteractive/control/controllers/baseController.js +102 -0
  169. package/dist/src/nonInteractive/control/controllers/baseController.js.map +1 -0
  170. package/dist/src/nonInteractive/control/controllers/hookController.d.ts +25 -0
  171. package/dist/src/nonInteractive/control/controllers/hookController.js +42 -0
  172. package/dist/src/nonInteractive/control/controllers/hookController.js.map +1 -0
  173. package/dist/src/nonInteractive/control/controllers/mcpController.d.ts +42 -0
  174. package/dist/src/nonInteractive/control/controllers/mcpController.js +205 -0
  175. package/dist/src/nonInteractive/control/controllers/mcpController.js.map +1 -0
  176. package/dist/src/nonInteractive/control/controllers/permissionController.d.ts +78 -0
  177. package/dist/src/nonInteractive/control/controllers/permissionController.js +358 -0
  178. package/dist/src/nonInteractive/control/controllers/permissionController.js.map +1 -0
  179. package/dist/src/nonInteractive/control/controllers/systemController.d.ts +56 -0
  180. package/dist/src/nonInteractive/control/controllers/systemController.js +166 -0
  181. package/dist/src/nonInteractive/control/controllers/systemController.js.map +1 -0
  182. package/dist/src/nonInteractive/control/types/serviceAPIs.d.ts +120 -0
  183. package/dist/src/nonInteractive/control/types/serviceAPIs.js +7 -0
  184. package/dist/src/nonInteractive/control/types/serviceAPIs.js.map +1 -0
  185. package/dist/src/nonInteractive/io/BaseJsonOutputAdapter.d.ts +446 -0
  186. package/dist/src/nonInteractive/io/BaseJsonOutputAdapter.js +891 -0
  187. package/dist/src/nonInteractive/io/BaseJsonOutputAdapter.js.map +1 -0
  188. package/dist/src/nonInteractive/io/BaseJsonOutputAdapter.test.d.ts +6 -0
  189. package/dist/src/nonInteractive/io/BaseJsonOutputAdapter.test.js +1197 -0
  190. package/dist/src/nonInteractive/io/BaseJsonOutputAdapter.test.js.map +1 -0
  191. package/dist/src/nonInteractive/io/JsonOutputAdapter.d.ts +29 -0
  192. package/dist/src/nonInteractive/io/JsonOutputAdapter.js +56 -0
  193. package/dist/src/nonInteractive/io/JsonOutputAdapter.js.map +1 -0
  194. package/dist/src/nonInteractive/io/JsonOutputAdapter.test.d.ts +6 -0
  195. package/dist/src/nonInteractive/io/JsonOutputAdapter.test.js +624 -0
  196. package/dist/src/nonInteractive/io/JsonOutputAdapter.test.js.map +1 -0
  197. package/dist/src/nonInteractive/io/StreamJsonInputReader.d.ts +16 -0
  198. package/dist/src/nonInteractive/io/StreamJsonInputReader.js +54 -0
  199. package/dist/src/nonInteractive/io/StreamJsonInputReader.js.map +1 -0
  200. package/dist/src/nonInteractive/io/StreamJsonInputReader.test.d.ts +6 -0
  201. package/dist/src/nonInteractive/io/StreamJsonInputReader.test.js +178 -0
  202. package/dist/src/nonInteractive/io/StreamJsonInputReader.test.js.map +1 -0
  203. package/dist/src/nonInteractive/io/StreamJsonOutputAdapter.d.ts +69 -0
  204. package/dist/src/nonInteractive/io/StreamJsonOutputAdapter.js +185 -0
  205. package/dist/src/nonInteractive/io/StreamJsonOutputAdapter.js.map +1 -0
  206. package/dist/src/nonInteractive/io/StreamJsonOutputAdapter.test.d.ts +6 -0
  207. package/dist/src/nonInteractive/io/StreamJsonOutputAdapter.test.js +808 -0
  208. package/dist/src/nonInteractive/io/StreamJsonOutputAdapter.test.js.map +1 -0
  209. package/dist/src/nonInteractive/session.d.ts +23 -0
  210. package/dist/src/nonInteractive/session.js +549 -0
  211. package/dist/src/nonInteractive/session.js.map +1 -0
  212. package/dist/src/nonInteractive/session.test.d.ts +6 -0
  213. package/dist/src/nonInteractive/session.test.js +407 -0
  214. package/dist/src/nonInteractive/session.test.js.map +1 -0
  215. package/dist/src/nonInteractive/types.d.ts +344 -0
  216. package/dist/src/nonInteractive/types.js +78 -0
  217. package/dist/src/nonInteractive/types.js.map +1 -0
  218. package/dist/src/nonInteractiveCli.d.ts +28 -0
  219. package/dist/src/nonInteractiveCli.js +268 -0
  220. package/dist/src/nonInteractiveCli.js.map +1 -0
  221. package/dist/src/nonInteractiveCliCommands.d.ts +35 -0
  222. package/dist/src/nonInteractiveCliCommands.js +144 -0
  223. package/dist/src/nonInteractiveCliCommands.js.map +1 -0
  224. package/dist/src/patches/is-in-ci.d.ts +7 -0
  225. package/dist/src/patches/is-in-ci.js +15 -0
  226. package/dist/src/patches/is-in-ci.js.map +1 -0
  227. package/dist/src/patches/punycode-shim.d.ts +6 -0
  228. package/dist/src/patches/punycode-shim.js +20 -0
  229. package/dist/src/patches/punycode-shim.js.map +1 -0
  230. package/dist/src/services/BuiltinCommandLoader.d.ts +24 -0
  231. package/dist/src/services/BuiltinCommandLoader.js +99 -0
  232. package/dist/src/services/BuiltinCommandLoader.js.map +1 -0
  233. package/dist/src/services/BuiltinCommandLoader.test.d.ts +6 -0
  234. package/dist/src/services/BuiltinCommandLoader.test.js +167 -0
  235. package/dist/src/services/BuiltinCommandLoader.test.js.map +1 -0
  236. package/dist/src/services/CommandService.d.ts +55 -0
  237. package/dist/src/services/CommandService.js +90 -0
  238. package/dist/src/services/CommandService.js.map +1 -0
  239. package/dist/src/services/CommandService.test.d.ts +6 -0
  240. package/dist/src/services/CommandService.test.js +233 -0
  241. package/dist/src/services/CommandService.test.js.map +1 -0
  242. package/dist/src/services/FileCommandLoader.d.ts +51 -0
  243. package/dist/src/services/FileCommandLoader.js +230 -0
  244. package/dist/src/services/FileCommandLoader.js.map +1 -0
  245. package/dist/src/services/McpPromptLoader.d.ts +35 -0
  246. package/dist/src/services/McpPromptLoader.js +254 -0
  247. package/dist/src/services/McpPromptLoader.js.map +1 -0
  248. package/dist/src/services/McpPromptLoader.test.d.ts +6 -0
  249. package/dist/src/services/McpPromptLoader.test.js +341 -0
  250. package/dist/src/services/McpPromptLoader.test.js.map +1 -0
  251. package/dist/src/services/prompt-processors/argumentProcessor.d.ts +16 -0
  252. package/dist/src/services/prompt-processors/argumentProcessor.js +21 -0
  253. package/dist/src/services/prompt-processors/argumentProcessor.js.map +1 -0
  254. package/dist/src/services/prompt-processors/atFileProcessor.d.ts +12 -0
  255. package/dist/src/services/prompt-processors/atFileProcessor.js +62 -0
  256. package/dist/src/services/prompt-processors/atFileProcessor.js.map +1 -0
  257. package/dist/src/services/prompt-processors/atFileProcessor.test.d.ts +6 -0
  258. package/dist/src/services/prompt-processors/atFileProcessor.test.js +174 -0
  259. package/dist/src/services/prompt-processors/atFileProcessor.test.js.map +1 -0
  260. package/dist/src/services/prompt-processors/injectionParser.d.ts +29 -0
  261. package/dist/src/services/prompt-processors/injectionParser.js +60 -0
  262. package/dist/src/services/prompt-processors/injectionParser.js.map +1 -0
  263. package/dist/src/services/prompt-processors/injectionParser.test.d.ts +6 -0
  264. package/dist/src/services/prompt-processors/injectionParser.test.js +189 -0
  265. package/dist/src/services/prompt-processors/injectionParser.test.js.map +1 -0
  266. package/dist/src/services/prompt-processors/shellProcessor.d.ts +27 -0
  267. package/dist/src/services/prompt-processors/shellProcessor.js +128 -0
  268. package/dist/src/services/prompt-processors/shellProcessor.js.map +1 -0
  269. package/dist/src/services/prompt-processors/types.d.ts +45 -0
  270. package/dist/src/services/prompt-processors/types.js +20 -0
  271. package/dist/src/services/prompt-processors/types.js.map +1 -0
  272. package/dist/src/services/types.d.ts +22 -0
  273. package/dist/src/services/types.js +7 -0
  274. package/dist/src/services/types.js.map +1 -0
  275. package/dist/src/test-utils/createExtension.d.ts +15 -0
  276. package/dist/src/test-utils/createExtension.js +25 -0
  277. package/dist/src/test-utils/createExtension.js.map +1 -0
  278. package/dist/src/test-utils/customMatchers.d.ts +14 -0
  279. package/dist/src/test-utils/customMatchers.js +40 -0
  280. package/dist/src/test-utils/customMatchers.js.map +1 -0
  281. package/dist/src/test-utils/mockCommandContext.d.ts +18 -0
  282. package/dist/src/test-utils/mockCommandContext.js +93 -0
  283. package/dist/src/test-utils/mockCommandContext.js.map +1 -0
  284. package/dist/src/test-utils/mockCommandContext.test.d.ts +6 -0
  285. package/dist/src/test-utils/mockCommandContext.test.js +51 -0
  286. package/dist/src/test-utils/mockCommandContext.test.js.map +1 -0
  287. package/dist/src/test-utils/render.d.ts +12 -0
  288. package/dist/src/test-utils/render.js +14 -0
  289. package/dist/src/test-utils/render.js.map +1 -0
  290. package/dist/src/ui/App.d.ts +6 -0
  291. package/dist/src/ui/App.js +37 -0
  292. package/dist/src/ui/App.js.map +1 -0
  293. package/dist/src/ui/AppContainer.d.ts +17 -0
  294. package/dist/src/ui/AppContainer.js +1074 -0
  295. package/dist/src/ui/AppContainer.js.map +1 -0
  296. package/dist/src/ui/AppContainer.test.d.ts +6 -0
  297. package/dist/src/ui/AppContainer.test.js +831 -0
  298. package/dist/src/ui/AppContainer.test.js.map +1 -0
  299. package/dist/src/ui/IdeIntegrationNudge.d.ts +16 -0
  300. package/dist/src/ui/IdeIntegrationNudge.js +50 -0
  301. package/dist/src/ui/IdeIntegrationNudge.js.map +1 -0
  302. package/dist/src/ui/auth/AuthDialog.d.ts +7 -0
  303. package/dist/src/ui/auth/AuthDialog.js +63 -0
  304. package/dist/src/ui/auth/AuthDialog.js.map +1 -0
  305. package/dist/src/ui/auth/AuthDialog.test.d.ts +6 -0
  306. package/dist/src/ui/auth/AuthDialog.test.js +391 -0
  307. package/dist/src/ui/auth/AuthDialog.test.js.map +1 -0
  308. package/dist/src/ui/auth/AuthInProgress.d.ts +11 -0
  309. package/dist/src/ui/auth/AuthInProgress.js +24 -0
  310. package/dist/src/ui/auth/AuthInProgress.js.map +1 -0
  311. package/dist/src/ui/auth/OAuthFlow.d.ts +14 -0
  312. package/dist/src/ui/auth/OAuthFlow.js +48 -0
  313. package/dist/src/ui/auth/OAuthFlow.js.map +1 -0
  314. package/dist/src/ui/auth/useAuth.d.ts +27 -0
  315. package/dist/src/ui/auth/useAuth.js +244 -0
  316. package/dist/src/ui/auth/useAuth.js.map +1 -0
  317. package/dist/src/ui/colors.d.ts +7 -0
  318. package/dist/src/ui/colors.js +54 -0
  319. package/dist/src/ui/colors.js.map +1 -0
  320. package/dist/src/ui/commands/aboutCommand.d.ts +7 -0
  321. package/dist/src/ui/commands/aboutCommand.js +25 -0
  322. package/dist/src/ui/commands/aboutCommand.js.map +1 -0
  323. package/dist/src/ui/commands/agentsCommand.d.ts +7 -0
  324. package/dist/src/ui/commands/agentsCommand.js +39 -0
  325. package/dist/src/ui/commands/agentsCommand.js.map +1 -0
  326. package/dist/src/ui/commands/approvalModeCommand.d.ts +7 -0
  327. package/dist/src/ui/commands/approvalModeCommand.js +19 -0
  328. package/dist/src/ui/commands/approvalModeCommand.js.map +1 -0
  329. package/dist/src/ui/commands/approvalModeCommand.test.d.ts +6 -0
  330. package/dist/src/ui/commands/approvalModeCommand.test.js +49 -0
  331. package/dist/src/ui/commands/approvalModeCommand.test.js.map +1 -0
  332. package/dist/src/ui/commands/authCommand.d.ts +7 -0
  333. package/dist/src/ui/commands/authCommand.js +19 -0
  334. package/dist/src/ui/commands/authCommand.js.map +1 -0
  335. package/dist/src/ui/commands/bugCommand.d.ts +7 -0
  336. package/dist/src/ui/commands/bugCommand.js +51 -0
  337. package/dist/src/ui/commands/bugCommand.js.map +1 -0
  338. package/dist/src/ui/commands/chatCommand.d.ts +9 -0
  339. package/dist/src/ui/commands/chatCommand.js +351 -0
  340. package/dist/src/ui/commands/chatCommand.js.map +1 -0
  341. package/dist/src/ui/commands/clearCommand.d.ts +7 -0
  342. package/dist/src/ui/commands/clearCommand.js +30 -0
  343. package/dist/src/ui/commands/clearCommand.js.map +1 -0
  344. package/dist/src/ui/commands/compressCommand.d.ts +7 -0
  345. package/dist/src/ui/commands/compressCommand.js +71 -0
  346. package/dist/src/ui/commands/compressCommand.js.map +1 -0
  347. package/dist/src/ui/commands/copyCommand.d.ts +7 -0
  348. package/dist/src/ui/commands/copyCommand.js +62 -0
  349. package/dist/src/ui/commands/copyCommand.js.map +1 -0
  350. package/dist/src/ui/commands/corgiCommand.d.ts +7 -0
  351. package/dist/src/ui/commands/corgiCommand.js +16 -0
  352. package/dist/src/ui/commands/corgiCommand.js.map +1 -0
  353. package/dist/src/ui/commands/directoryCommand.d.ts +8 -0
  354. package/dist/src/ui/commands/directoryCommand.js +153 -0
  355. package/dist/src/ui/commands/directoryCommand.js.map +1 -0
  356. package/dist/src/ui/commands/docsCommand.d.ts +7 -0
  357. package/dist/src/ui/commands/docsCommand.js +39 -0
  358. package/dist/src/ui/commands/docsCommand.js.map +1 -0
  359. package/dist/src/ui/commands/editorCommand.d.ts +7 -0
  360. package/dist/src/ui/commands/editorCommand.js +19 -0
  361. package/dist/src/ui/commands/editorCommand.js.map +1 -0
  362. package/dist/src/ui/commands/extensionsCommand.d.ts +7 -0
  363. package/dist/src/ui/commands/extensionsCommand.js +115 -0
  364. package/dist/src/ui/commands/extensionsCommand.js.map +1 -0
  365. package/dist/src/ui/commands/helpCommand.d.ts +7 -0
  366. package/dist/src/ui/commands/helpCommand.js +24 -0
  367. package/dist/src/ui/commands/helpCommand.js.map +1 -0
  368. package/dist/src/ui/commands/ideCommand.d.ts +7 -0
  369. package/dist/src/ui/commands/ideCommand.js +241 -0
  370. package/dist/src/ui/commands/ideCommand.js.map +1 -0
  371. package/dist/src/ui/commands/initCommand.d.ts +7 -0
  372. package/dist/src/ui/commands/initCommand.js +118 -0
  373. package/dist/src/ui/commands/initCommand.js.map +1 -0
  374. package/dist/src/ui/commands/languageCommand.d.ts +7 -0
  375. package/dist/src/ui/commands/languageCommand.js +386 -0
  376. package/dist/src/ui/commands/languageCommand.js.map +1 -0
  377. package/dist/src/ui/commands/mcpCommand.d.ts +7 -0
  378. package/dist/src/ui/commands/mcpCommand.js +269 -0
  379. package/dist/src/ui/commands/mcpCommand.js.map +1 -0
  380. package/dist/src/ui/commands/memoryCommand.d.ts +7 -0
  381. package/dist/src/ui/commands/memoryCommand.js +254 -0
  382. package/dist/src/ui/commands/memoryCommand.js.map +1 -0
  383. package/dist/src/ui/commands/modelCommand.d.ts +7 -0
  384. package/dist/src/ui/commands/modelCommand.js +48 -0
  385. package/dist/src/ui/commands/modelCommand.js.map +1 -0
  386. package/dist/src/ui/commands/modelCommand.test.d.ts +6 -0
  387. package/dist/src/ui/commands/modelCommand.test.js +137 -0
  388. package/dist/src/ui/commands/modelCommand.test.js.map +1 -0
  389. package/dist/src/ui/commands/openaiProfileCommand.d.ts +7 -0
  390. package/dist/src/ui/commands/openaiProfileCommand.js +135 -0
  391. package/dist/src/ui/commands/openaiProfileCommand.js.map +1 -0
  392. package/dist/src/ui/commands/permissionsCommand.d.ts +7 -0
  393. package/dist/src/ui/commands/permissionsCommand.js +19 -0
  394. package/dist/src/ui/commands/permissionsCommand.js.map +1 -0
  395. package/dist/src/ui/commands/permissionsCommand.test.d.ts +6 -0
  396. package/dist/src/ui/commands/permissionsCommand.test.js +30 -0
  397. package/dist/src/ui/commands/permissionsCommand.test.js.map +1 -0
  398. package/dist/src/ui/commands/quitCommand.d.ts +8 -0
  399. package/dist/src/ui/commands/quitCommand.js +64 -0
  400. package/dist/src/ui/commands/quitCommand.js.map +1 -0
  401. package/dist/src/ui/commands/restoreCommand.d.ts +8 -0
  402. package/dist/src/ui/commands/restoreCommand.js +124 -0
  403. package/dist/src/ui/commands/restoreCommand.js.map +1 -0
  404. package/dist/src/ui/commands/settingsCommand.d.ts +7 -0
  405. package/dist/src/ui/commands/settingsCommand.js +19 -0
  406. package/dist/src/ui/commands/settingsCommand.js.map +1 -0
  407. package/dist/src/ui/commands/setupGithubCommand.d.ts +9 -0
  408. package/dist/src/ui/commands/setupGithubCommand.js +157 -0
  409. package/dist/src/ui/commands/setupGithubCommand.js.map +1 -0
  410. package/dist/src/ui/commands/setupGithubCommand.test.d.ts +6 -0
  411. package/dist/src/ui/commands/setupGithubCommand.test.js +167 -0
  412. package/dist/src/ui/commands/setupGithubCommand.test.js.map +1 -0
  413. package/dist/src/ui/commands/spCommand.d.ts +7 -0
  414. package/dist/src/ui/commands/spCommand.js +352 -0
  415. package/dist/src/ui/commands/spCommand.js.map +1 -0
  416. package/dist/src/ui/commands/statsCommand.d.ts +7 -0
  417. package/dist/src/ui/commands/statsCommand.js +61 -0
  418. package/dist/src/ui/commands/statsCommand.js.map +1 -0
  419. package/dist/src/ui/commands/summaryCommand.d.ts +7 -0
  420. package/dist/src/ui/commands/summaryCommand.js +156 -0
  421. package/dist/src/ui/commands/summaryCommand.js.map +1 -0
  422. package/dist/src/ui/commands/systemPromptCommand.d.ts +7 -0
  423. package/dist/src/ui/commands/systemPromptCommand.js +322 -0
  424. package/dist/src/ui/commands/systemPromptCommand.js.map +1 -0
  425. package/dist/src/ui/commands/terminalSetupCommand.d.ts +13 -0
  426. package/dist/src/ui/commands/terminalSetupCommand.js +47 -0
  427. package/dist/src/ui/commands/terminalSetupCommand.js.map +1 -0
  428. package/dist/src/ui/commands/themeCommand.d.ts +7 -0
  429. package/dist/src/ui/commands/themeCommand.js +19 -0
  430. package/dist/src/ui/commands/themeCommand.js.map +1 -0
  431. package/dist/src/ui/commands/toolsCommand.d.ts +7 -0
  432. package/dist/src/ui/commands/toolsCommand.js +45 -0
  433. package/dist/src/ui/commands/toolsCommand.js.map +1 -0
  434. package/dist/src/ui/commands/types.d.ts +160 -0
  435. package/dist/src/ui/commands/types.js +12 -0
  436. package/dist/src/ui/commands/types.js.map +1 -0
  437. package/dist/src/ui/commands/vimCommand.d.ts +7 -0
  438. package/dist/src/ui/commands/vimCommand.js +26 -0
  439. package/dist/src/ui/commands/vimCommand.js.map +1 -0
  440. package/dist/src/ui/components/AboutBox.d.ts +10 -0
  441. package/dist/src/ui/components/AboutBox.js +10 -0
  442. package/dist/src/ui/components/AboutBox.js.map +1 -0
  443. package/dist/src/ui/components/AnsiOutput.d.ts +13 -0
  444. package/dist/src/ui/components/AnsiOutput.js +12 -0
  445. package/dist/src/ui/components/AnsiOutput.js.map +1 -0
  446. package/dist/src/ui/components/AnsiOutput.test.d.ts +6 -0
  447. package/dist/src/ui/components/AnsiOutput.test.js +97 -0
  448. package/dist/src/ui/components/AnsiOutput.test.js.map +1 -0
  449. package/dist/src/ui/components/AppHeader.d.ts +10 -0
  450. package/dist/src/ui/components/AppHeader.js +19 -0
  451. package/dist/src/ui/components/AppHeader.js.map +1 -0
  452. package/dist/src/ui/components/ApprovalModeDialog.d.ts +21 -0
  453. package/dist/src/ui/components/ApprovalModeDialog.js +68 -0
  454. package/dist/src/ui/components/ApprovalModeDialog.js.map +1 -0
  455. package/dist/src/ui/components/AsciiArt.d.ts +8 -0
  456. package/dist/src/ui/components/AsciiArt.js +30 -0
  457. package/dist/src/ui/components/AsciiArt.js.map +1 -0
  458. package/dist/src/ui/components/AutoAcceptIndicator.d.ts +12 -0
  459. package/dist/src/ui/components/AutoAcceptIndicator.js +32 -0
  460. package/dist/src/ui/components/AutoAcceptIndicator.js.map +1 -0
  461. package/dist/src/ui/components/Composer.d.ts +6 -0
  462. package/dist/src/ui/components/Composer.js +55 -0
  463. package/dist/src/ui/components/Composer.js.map +1 -0
  464. package/dist/src/ui/components/Composer.test.d.ts +6 -0
  465. package/dist/src/ui/components/Composer.test.js +337 -0
  466. package/dist/src/ui/components/Composer.test.js.map +1 -0
  467. package/dist/src/ui/components/ConfigInitDisplay.d.ts +6 -0
  468. package/dist/src/ui/components/ConfigInitDisplay.js +42 -0
  469. package/dist/src/ui/components/ConfigInitDisplay.js.map +1 -0
  470. package/dist/src/ui/components/ConsentPrompt.d.ts +13 -0
  471. package/dist/src/ui/components/ConsentPrompt.js +19 -0
  472. package/dist/src/ui/components/ConsentPrompt.js.map +1 -0
  473. package/dist/src/ui/components/ConsentPrompt.test.d.ts +6 -0
  474. package/dist/src/ui/components/ConsentPrompt.test.js +67 -0
  475. package/dist/src/ui/components/ConsentPrompt.test.js.map +1 -0
  476. package/dist/src/ui/components/ConsoleSummaryDisplay.d.ts +11 -0
  477. package/dist/src/ui/components/ConsoleSummaryDisplay.js +11 -0
  478. package/dist/src/ui/components/ConsoleSummaryDisplay.js.map +1 -0
  479. package/dist/src/ui/components/ContextSummaryDisplay.d.ts +20 -0
  480. package/dist/src/ui/components/ContextSummaryDisplay.js +90 -0
  481. package/dist/src/ui/components/ContextSummaryDisplay.js.map +1 -0
  482. package/dist/src/ui/components/ContextUsageDisplay.d.ts +10 -0
  483. package/dist/src/ui/components/ContextUsageDisplay.js +16 -0
  484. package/dist/src/ui/components/ContextUsageDisplay.js.map +1 -0
  485. package/dist/src/ui/components/DebugProfiler.d.ts +6 -0
  486. package/dist/src/ui/components/DebugProfiler.js +27 -0
  487. package/dist/src/ui/components/DebugProfiler.js.map +1 -0
  488. package/dist/src/ui/components/DetailedMessagesDisplay.d.ts +14 -0
  489. package/dist/src/ui/components/DetailedMessagesDisplay.js +34 -0
  490. package/dist/src/ui/components/DetailedMessagesDisplay.js.map +1 -0
  491. package/dist/src/ui/components/DialogManager.d.ts +12 -0
  492. package/dist/src/ui/components/DialogManager.js +158 -0
  493. package/dist/src/ui/components/DialogManager.js.map +1 -0
  494. package/dist/src/ui/components/EditorSettingsDialog.d.ts +16 -0
  495. package/dist/src/ui/components/EditorSettingsDialog.js +85 -0
  496. package/dist/src/ui/components/EditorSettingsDialog.js.map +1 -0
  497. package/dist/src/ui/components/ExitWarning.d.ts +7 -0
  498. package/dist/src/ui/components/ExitWarning.js +9 -0
  499. package/dist/src/ui/components/ExitWarning.js.map +1 -0
  500. package/dist/src/ui/components/FolderTrustDialog.d.ts +17 -0
  501. package/dist/src/ui/components/FolderTrustDialog.js +58 -0
  502. package/dist/src/ui/components/FolderTrustDialog.js.map +1 -0
  503. package/dist/src/ui/components/FolderTrustDialog.test.d.ts +6 -0
  504. package/dist/src/ui/components/FolderTrustDialog.test.js +88 -0
  505. package/dist/src/ui/components/FolderTrustDialog.test.js.map +1 -0
  506. package/dist/src/ui/components/Footer.d.ts +7 -0
  507. package/dist/src/ui/components/Footer.js +48 -0
  508. package/dist/src/ui/components/Footer.js.map +1 -0
  509. package/dist/src/ui/components/GeminiRespondingSpinner.d.ts +21 -0
  510. package/dist/src/ui/components/GeminiRespondingSpinner.js +23 -0
  511. package/dist/src/ui/components/GeminiRespondingSpinner.js.map +1 -0
  512. package/dist/src/ui/components/Header.d.ts +13 -0
  513. package/dist/src/ui/components/Header.js +28 -0
  514. package/dist/src/ui/components/Header.js.map +1 -0
  515. package/dist/src/ui/components/Header.test.d.ts +6 -0
  516. package/dist/src/ui/components/Header.test.js +37 -0
  517. package/dist/src/ui/components/Header.test.js.map +1 -0
  518. package/dist/src/ui/components/Help.d.ts +12 -0
  519. package/dist/src/ui/components/Help.js +23 -0
  520. package/dist/src/ui/components/Help.js.map +1 -0
  521. package/dist/src/ui/components/Help.test.d.ts +6 -0
  522. package/dist/src/ui/components/Help.test.js +57 -0
  523. package/dist/src/ui/components/Help.test.js.map +1 -0
  524. package/dist/src/ui/components/HistoryItemDisplay.d.ts +21 -0
  525. package/dist/src/ui/components/HistoryItemDisplay.js +31 -0
  526. package/dist/src/ui/components/HistoryItemDisplay.js.map +1 -0
  527. package/dist/src/ui/components/HistoryItemDisplay.test.d.ts +6 -0
  528. package/dist/src/ui/components/HistoryItemDisplay.test.js +183 -0
  529. package/dist/src/ui/components/HistoryItemDisplay.test.js.map +1 -0
  530. package/dist/src/ui/components/IdeTrustChangeDialog.d.ts +11 -0
  531. package/dist/src/ui/components/IdeTrustChangeDialog.js +32 -0
  532. package/dist/src/ui/components/IdeTrustChangeDialog.js.map +1 -0
  533. package/dist/src/ui/components/IdeTrustChangeDialog.test.d.ts +6 -0
  534. package/dist/src/ui/components/IdeTrustChangeDialog.test.js +57 -0
  535. package/dist/src/ui/components/IdeTrustChangeDialog.test.js.map +1 -0
  536. package/dist/src/ui/components/InputPrompt.d.ts +37 -0
  537. package/dist/src/ui/components/InputPrompt.js +583 -0
  538. package/dist/src/ui/components/InputPrompt.js.map +1 -0
  539. package/dist/src/ui/components/LoadingIndicator.d.ts +15 -0
  540. package/dist/src/ui/components/LoadingIndicator.js +30 -0
  541. package/dist/src/ui/components/LoadingIndicator.js.map +1 -0
  542. package/dist/src/ui/components/LoadingIndicator.test.d.ts +6 -0
  543. package/dist/src/ui/components/LoadingIndicator.test.js +194 -0
  544. package/dist/src/ui/components/LoadingIndicator.test.js.map +1 -0
  545. package/dist/src/ui/components/LoopDetectionConfirmation.d.ts +13 -0
  546. package/dist/src/ui/components/LoopDetectionConfirmation.js +37 -0
  547. package/dist/src/ui/components/LoopDetectionConfirmation.js.map +1 -0
  548. package/dist/src/ui/components/LoopDetectionConfirmation.test.d.ts +6 -0
  549. package/dist/src/ui/components/LoopDetectionConfirmation.test.js +28 -0
  550. package/dist/src/ui/components/LoopDetectionConfirmation.test.js.map +1 -0
  551. package/dist/src/ui/components/MainContent.d.ts +6 -0
  552. package/dist/src/ui/components/MainContent.js +28 -0
  553. package/dist/src/ui/components/MainContent.js.map +1 -0
  554. package/dist/src/ui/components/MemoryUsageDisplay.d.ts +7 -0
  555. package/dist/src/ui/components/MemoryUsageDisplay.js +24 -0
  556. package/dist/src/ui/components/MemoryUsageDisplay.js.map +1 -0
  557. package/dist/src/ui/components/ModelDialog.d.ts +11 -0
  558. package/dist/src/ui/components/ModelDialog.js +99 -0
  559. package/dist/src/ui/components/ModelDialog.js.map +1 -0
  560. package/dist/src/ui/components/ModelDialog.test.d.ts +6 -0
  561. package/dist/src/ui/components/ModelDialog.test.js +158 -0
  562. package/dist/src/ui/components/ModelDialog.test.js.map +1 -0
  563. package/dist/src/ui/components/ModelStatsDisplay.d.ts +7 -0
  564. package/dist/src/ui/components/ModelStatsDisplay.js +34 -0
  565. package/dist/src/ui/components/ModelStatsDisplay.js.map +1 -0
  566. package/dist/src/ui/components/ModelSwitchDialog.d.ts +15 -0
  567. package/dist/src/ui/components/ModelSwitchDialog.js +40 -0
  568. package/dist/src/ui/components/ModelSwitchDialog.js.map +1 -0
  569. package/dist/src/ui/components/ModelSwitchDialog.test.d.ts +6 -0
  570. package/dist/src/ui/components/ModelSwitchDialog.test.js +128 -0
  571. package/dist/src/ui/components/ModelSwitchDialog.test.js.map +1 -0
  572. package/dist/src/ui/components/Notifications.d.ts +6 -0
  573. package/dist/src/ui/components/Notifications.js +23 -0
  574. package/dist/src/ui/components/Notifications.js.map +1 -0
  575. package/dist/src/ui/components/OpenAIKeyPrompt.d.ts +25 -0
  576. package/dist/src/ui/components/OpenAIKeyPrompt.js +90 -0
  577. package/dist/src/ui/components/OpenAIKeyPrompt.js.map +1 -0
  578. package/dist/src/ui/components/OpenAIKeyPrompt.test.d.ts +6 -0
  579. package/dist/src/ui/components/OpenAIKeyPrompt.test.js +51 -0
  580. package/dist/src/ui/components/OpenAIKeyPrompt.test.js.map +1 -0
  581. package/dist/src/ui/components/PermissionsModifyTrustDialog.d.ts +13 -0
  582. package/dist/src/ui/components/PermissionsModifyTrustDialog.js +48 -0
  583. package/dist/src/ui/components/PermissionsModifyTrustDialog.js.map +1 -0
  584. package/dist/src/ui/components/PermissionsModifyTrustDialog.test.d.ts +6 -0
  585. package/dist/src/ui/components/PermissionsModifyTrustDialog.test.js +154 -0
  586. package/dist/src/ui/components/PermissionsModifyTrustDialog.test.js.map +1 -0
  587. package/dist/src/ui/components/PlanSummaryDisplay.d.ts +14 -0
  588. package/dist/src/ui/components/PlanSummaryDisplay.js +9 -0
  589. package/dist/src/ui/components/PlanSummaryDisplay.js.map +1 -0
  590. package/dist/src/ui/components/PrepareLabel.d.ts +15 -0
  591. package/dist/src/ui/components/PrepareLabel.js +72 -0
  592. package/dist/src/ui/components/PrepareLabel.js.map +1 -0
  593. package/dist/src/ui/components/PrepareLabel.test.d.ts +6 -0
  594. package/dist/src/ui/components/PrepareLabel.test.js +71 -0
  595. package/dist/src/ui/components/PrepareLabel.test.js.map +1 -0
  596. package/dist/src/ui/components/ProQuotaDialog.d.ts +13 -0
  597. package/dist/src/ui/components/ProQuotaDialog.js +24 -0
  598. package/dist/src/ui/components/ProQuotaDialog.js.map +1 -0
  599. package/dist/src/ui/components/ProQuotaDialog.test.d.ts +6 -0
  600. package/dist/src/ui/components/ProQuotaDialog.test.js +58 -0
  601. package/dist/src/ui/components/ProQuotaDialog.test.js.map +1 -0
  602. package/dist/src/ui/components/QueuedMessageDisplay.d.ts +9 -0
  603. package/dist/src/ui/components/QueuedMessageDisplay.js +20 -0
  604. package/dist/src/ui/components/QueuedMessageDisplay.js.map +1 -0
  605. package/dist/src/ui/components/QueuedMessageDisplay.test.d.ts +6 -0
  606. package/dist/src/ui/components/QueuedMessageDisplay.test.js +56 -0
  607. package/dist/src/ui/components/QueuedMessageDisplay.test.js.map +1 -0
  608. package/dist/src/ui/components/QuitConfirmationDialog.d.ts +17 -0
  609. package/dist/src/ui/components/QuitConfirmationDialog.js +49 -0
  610. package/dist/src/ui/components/QuitConfirmationDialog.js.map +1 -0
  611. package/dist/src/ui/components/QuittingDisplay.d.ts +6 -0
  612. package/dist/src/ui/components/QuittingDisplay.js +20 -0
  613. package/dist/src/ui/components/QuittingDisplay.js.map +1 -0
  614. package/dist/src/ui/components/QwenOAuthProgress.d.ts +16 -0
  615. package/dist/src/ui/components/QwenOAuthProgress.js +111 -0
  616. package/dist/src/ui/components/QwenOAuthProgress.js.map +1 -0
  617. package/dist/src/ui/components/QwenOAuthProgress.test.d.ts +6 -0
  618. package/dist/src/ui/components/QwenOAuthProgress.test.js +364 -0
  619. package/dist/src/ui/components/QwenOAuthProgress.test.js.map +1 -0
  620. package/dist/src/ui/components/SessionSummaryDisplay.d.ts +11 -0
  621. package/dist/src/ui/components/SessionSummaryDisplay.js +5 -0
  622. package/dist/src/ui/components/SessionSummaryDisplay.js.map +1 -0
  623. package/dist/src/ui/components/SettingsDialog.d.ts +18 -0
  624. package/dist/src/ui/components/SettingsDialog.js +647 -0
  625. package/dist/src/ui/components/SettingsDialog.js.map +1 -0
  626. package/dist/src/ui/components/SettingsDialog.test.d.ts +6 -0
  627. package/dist/src/ui/components/SettingsDialog.test.js +1037 -0
  628. package/dist/src/ui/components/SettingsDialog.test.js.map +1 -0
  629. package/dist/src/ui/components/ShellConfirmationDialog.d.ts +15 -0
  630. package/dist/src/ui/components/ShellConfirmationDialog.js +50 -0
  631. package/dist/src/ui/components/ShellConfirmationDialog.js.map +1 -0
  632. package/dist/src/ui/components/ShellConfirmationDialog.test.d.ts +6 -0
  633. package/dist/src/ui/components/ShellConfirmationDialog.test.js +40 -0
  634. package/dist/src/ui/components/ShellConfirmationDialog.test.js.map +1 -0
  635. package/dist/src/ui/components/ShellInputPrompt.d.ts +11 -0
  636. package/dist/src/ui/components/ShellInputPrompt.js +36 -0
  637. package/dist/src/ui/components/ShellInputPrompt.js.map +1 -0
  638. package/dist/src/ui/components/ShellModeIndicator.d.ts +7 -0
  639. package/dist/src/ui/components/ShellModeIndicator.js +5 -0
  640. package/dist/src/ui/components/ShellModeIndicator.js.map +1 -0
  641. package/dist/src/ui/components/ShowMoreLines.d.ts +10 -0
  642. package/dist/src/ui/components/ShowMoreLines.js +24 -0
  643. package/dist/src/ui/components/ShowMoreLines.js.map +1 -0
  644. package/dist/src/ui/components/StatsDisplay.d.ts +12 -0
  645. package/dist/src/ui/components/StatsDisplay.js +44 -0
  646. package/dist/src/ui/components/StatsDisplay.js.map +1 -0
  647. package/dist/src/ui/components/SuggestionsDisplay.d.ts +27 -0
  648. package/dist/src/ui/components/SuggestionsDisplay.js +40 -0
  649. package/dist/src/ui/components/SuggestionsDisplay.js.map +1 -0
  650. package/dist/src/ui/components/ThemeDialog.d.ts +20 -0
  651. package/dist/src/ui/components/ThemeDialog.js +126 -0
  652. package/dist/src/ui/components/ThemeDialog.js.map +1 -0
  653. package/dist/src/ui/components/ThemeDialog.test.d.ts +6 -0
  654. package/dist/src/ui/components/ThemeDialog.test.js +75 -0
  655. package/dist/src/ui/components/ThemeDialog.test.js.map +1 -0
  656. package/dist/src/ui/components/Tips.d.ts +12 -0
  657. package/dist/src/ui/components/Tips.js +10 -0
  658. package/dist/src/ui/components/Tips.js.map +1 -0
  659. package/dist/src/ui/components/TodoDisplay.d.ts +16 -0
  660. package/dist/src/ui/components/TodoDisplay.js +27 -0
  661. package/dist/src/ui/components/TodoDisplay.js.map +1 -0
  662. package/dist/src/ui/components/TodoDisplay.test.d.ts +6 -0
  663. package/dist/src/ui/components/TodoDisplay.test.js +77 -0
  664. package/dist/src/ui/components/TodoDisplay.test.js.map +1 -0
  665. package/dist/src/ui/components/ToolStatsDisplay.d.ts +7 -0
  666. package/dist/src/ui/components/ToolStatsDisplay.js +42 -0
  667. package/dist/src/ui/components/ToolStatsDisplay.js.map +1 -0
  668. package/dist/src/ui/components/UpdateNotification.d.ts +10 -0
  669. package/dist/src/ui/components/UpdateNotification.js +10 -0
  670. package/dist/src/ui/components/UpdateNotification.js.map +1 -0
  671. package/dist/src/ui/components/WelcomeBackDialog.d.ts +13 -0
  672. package/dist/src/ui/components/WelcomeBackDialog.js +43 -0
  673. package/dist/src/ui/components/WelcomeBackDialog.js.map +1 -0
  674. package/dist/src/ui/components/WorkspaceMigrationDialog.d.ts +11 -0
  675. package/dist/src/ui/components/WorkspaceMigrationDialog.js +45 -0
  676. package/dist/src/ui/components/WorkspaceMigrationDialog.js.map +1 -0
  677. package/dist/src/ui/components/messages/CompressionMessage.d.ts +10 -0
  678. package/dist/src/ui/components/messages/CompressionMessage.js +50 -0
  679. package/dist/src/ui/components/messages/CompressionMessage.js.map +1 -0
  680. package/dist/src/ui/components/messages/CompressionMessage.test.d.ts +6 -0
  681. package/dist/src/ui/components/messages/CompressionMessage.test.js +160 -0
  682. package/dist/src/ui/components/messages/CompressionMessage.test.js.map +1 -0
  683. package/dist/src/ui/components/messages/DiffRenderer.d.ts +17 -0
  684. package/dist/src/ui/components/messages/DiffRenderer.js +218 -0
  685. package/dist/src/ui/components/messages/DiffRenderer.js.map +1 -0
  686. package/dist/src/ui/components/messages/DiffRenderer.test.d.ts +6 -0
  687. package/dist/src/ui/components/messages/DiffRenderer.test.js +239 -0
  688. package/dist/src/ui/components/messages/DiffRenderer.test.js.map +1 -0
  689. package/dist/src/ui/components/messages/ErrorMessage.d.ts +11 -0
  690. package/dist/src/ui/components/messages/ErrorMessage.js +9 -0
  691. package/dist/src/ui/components/messages/ErrorMessage.js.map +1 -0
  692. package/dist/src/ui/components/messages/GeminiMessage.d.ts +14 -0
  693. package/dist/src/ui/components/messages/GeminiMessage.js +11 -0
  694. package/dist/src/ui/components/messages/GeminiMessage.js.map +1 -0
  695. package/dist/src/ui/components/messages/GeminiMessageContent.d.ts +14 -0
  696. package/dist/src/ui/components/messages/GeminiMessageContent.js +15 -0
  697. package/dist/src/ui/components/messages/GeminiMessageContent.js.map +1 -0
  698. package/dist/src/ui/components/messages/InfoMessage.d.ts +11 -0
  699. package/dist/src/ui/components/messages/InfoMessage.js +14 -0
  700. package/dist/src/ui/components/messages/InfoMessage.js.map +1 -0
  701. package/dist/src/ui/components/messages/SummaryMessage.d.ts +11 -0
  702. package/dist/src/ui/components/messages/SummaryMessage.js +35 -0
  703. package/dist/src/ui/components/messages/SummaryMessage.js.map +1 -0
  704. package/dist/src/ui/components/messages/ToolConfirmationMessage.d.ts +16 -0
  705. package/dist/src/ui/components/messages/ToolConfirmationMessage.js +245 -0
  706. package/dist/src/ui/components/messages/ToolConfirmationMessage.js.map +1 -0
  707. package/dist/src/ui/components/messages/ToolConfirmationMessage.test.d.ts +6 -0
  708. package/dist/src/ui/components/messages/ToolConfirmationMessage.test.js +165 -0
  709. package/dist/src/ui/components/messages/ToolConfirmationMessage.test.js.map +1 -0
  710. package/dist/src/ui/components/messages/ToolGroupMessage.d.ts +19 -0
  711. package/dist/src/ui/components/messages/ToolGroupMessage.js +58 -0
  712. package/dist/src/ui/components/messages/ToolGroupMessage.js.map +1 -0
  713. package/dist/src/ui/components/messages/ToolGroupMessage.test.d.ts +6 -0
  714. package/dist/src/ui/components/messages/ToolGroupMessage.test.js +261 -0
  715. package/dist/src/ui/components/messages/ToolGroupMessage.test.js.map +1 -0
  716. package/dist/src/ui/components/messages/ToolMessage.d.ts +19 -0
  717. package/dist/src/ui/components/messages/ToolMessage.js +180 -0
  718. package/dist/src/ui/components/messages/ToolMessage.js.map +1 -0
  719. package/dist/src/ui/components/messages/ToolMessage.test.d.ts +6 -0
  720. package/dist/src/ui/components/messages/ToolMessage.test.js +182 -0
  721. package/dist/src/ui/components/messages/ToolMessage.test.js.map +1 -0
  722. package/dist/src/ui/components/messages/UserMessage.d.ts +11 -0
  723. package/dist/src/ui/components/messages/UserMessage.js +13 -0
  724. package/dist/src/ui/components/messages/UserMessage.js.map +1 -0
  725. package/dist/src/ui/components/messages/UserShellMessage.d.ts +11 -0
  726. package/dist/src/ui/components/messages/UserShellMessage.js +9 -0
  727. package/dist/src/ui/components/messages/UserShellMessage.js.map +1 -0
  728. package/dist/src/ui/components/messages/WarningMessage.d.ts +11 -0
  729. package/dist/src/ui/components/messages/WarningMessage.js +10 -0
  730. package/dist/src/ui/components/messages/WarningMessage.js.map +1 -0
  731. package/dist/src/ui/components/shared/BaseSelectionList.d.ts +38 -0
  732. package/dist/src/ui/components/shared/BaseSelectionList.js +72 -0
  733. package/dist/src/ui/components/shared/BaseSelectionList.js.map +1 -0
  734. package/dist/src/ui/components/shared/BaseSelectionList.test.d.ts +6 -0
  735. package/dist/src/ui/components/shared/BaseSelectionList.test.js +376 -0
  736. package/dist/src/ui/components/shared/BaseSelectionList.test.js.map +1 -0
  737. package/dist/src/ui/components/shared/DescriptiveRadioButtonSelect.d.ts +35 -0
  738. package/dist/src/ui/components/shared/DescriptiveRadioButtonSelect.js +13 -0
  739. package/dist/src/ui/components/shared/DescriptiveRadioButtonSelect.js.map +1 -0
  740. package/dist/src/ui/components/shared/DescriptiveRadioButtonSelect.test.d.ts +6 -0
  741. package/dist/src/ui/components/shared/DescriptiveRadioButtonSelect.test.js +79 -0
  742. package/dist/src/ui/components/shared/DescriptiveRadioButtonSelect.test.js.map +1 -0
  743. package/dist/src/ui/components/shared/EnumSelector.d.ts +18 -0
  744. package/dist/src/ui/components/shared/EnumSelector.js +44 -0
  745. package/dist/src/ui/components/shared/EnumSelector.js.map +1 -0
  746. package/dist/src/ui/components/shared/EnumSelector.test.d.ts +6 -0
  747. package/dist/src/ui/components/shared/EnumSelector.test.js +70 -0
  748. package/dist/src/ui/components/shared/EnumSelector.test.js.map +1 -0
  749. package/dist/src/ui/components/shared/MaxSizedBox.d.ts +61 -0
  750. package/dist/src/ui/components/shared/MaxSizedBox.js +451 -0
  751. package/dist/src/ui/components/shared/MaxSizedBox.js.map +1 -0
  752. package/dist/src/ui/components/shared/MaxSizedBox.test.d.ts +6 -0
  753. package/dist/src/ui/components/shared/MaxSizedBox.test.js +154 -0
  754. package/dist/src/ui/components/shared/MaxSizedBox.test.js.map +1 -0
  755. package/dist/src/ui/components/shared/RadioButtonSelect.d.ts +45 -0
  756. package/dist/src/ui/components/shared/RadioButtonSelect.js +21 -0
  757. package/dist/src/ui/components/shared/RadioButtonSelect.js.map +1 -0
  758. package/dist/src/ui/components/shared/RadioButtonSelect.test.d.ts +6 -0
  759. package/dist/src/ui/components/shared/RadioButtonSelect.test.js +134 -0
  760. package/dist/src/ui/components/shared/RadioButtonSelect.test.js.map +1 -0
  761. package/dist/src/ui/components/shared/ScopeSelector.d.ts +19 -0
  762. package/dist/src/ui/components/shared/ScopeSelector.js +16 -0
  763. package/dist/src/ui/components/shared/ScopeSelector.js.map +1 -0
  764. package/dist/src/ui/components/shared/TextInput.d.ts +16 -0
  765. package/dist/src/ui/components/shared/TextInput.js +127 -0
  766. package/dist/src/ui/components/shared/TextInput.js.map +1 -0
  767. package/dist/src/ui/components/shared/text-buffer.d.ts +490 -0
  768. package/dist/src/ui/components/shared/text-buffer.js +1598 -0
  769. package/dist/src/ui/components/shared/text-buffer.js.map +1 -0
  770. package/dist/src/ui/components/shared/vim-buffer-actions.d.ts +72 -0
  771. package/dist/src/ui/components/shared/vim-buffer-actions.js +552 -0
  772. package/dist/src/ui/components/shared/vim-buffer-actions.js.map +1 -0
  773. package/dist/src/ui/components/subagents/constants.d.ts +23 -0
  774. package/dist/src/ui/components/subagents/constants.js +67 -0
  775. package/dist/src/ui/components/subagents/constants.js.map +1 -0
  776. package/dist/src/ui/components/subagents/create/AgentCreationWizard.d.ts +15 -0
  777. package/dist/src/ui/components/subagents/create/AgentCreationWizard.js +186 -0
  778. package/dist/src/ui/components/subagents/create/AgentCreationWizard.js.map +1 -0
  779. package/dist/src/ui/components/subagents/create/ColorSelector.d.ts +15 -0
  780. package/dist/src/ui/components/subagents/create/ColorSelector.js +43 -0
  781. package/dist/src/ui/components/subagents/create/ColorSelector.js.map +1 -0
  782. package/dist/src/ui/components/subagents/create/CreationSummary.d.ts +10 -0
  783. package/dist/src/ui/components/subagents/create/CreationSummary.js +174 -0
  784. package/dist/src/ui/components/subagents/create/CreationSummary.js.map +1 -0
  785. package/dist/src/ui/components/subagents/create/DescriptionInput.d.ts +10 -0
  786. package/dist/src/ui/components/subagents/create/DescriptionInput.js +107 -0
  787. package/dist/src/ui/components/subagents/create/DescriptionInput.js.map +1 -0
  788. package/dist/src/ui/components/subagents/create/GenerationMethodSelector.d.ts +10 -0
  789. package/dist/src/ui/components/subagents/create/GenerationMethodSelector.js +39 -0
  790. package/dist/src/ui/components/subagents/create/GenerationMethodSelector.js.map +1 -0
  791. package/dist/src/ui/components/subagents/create/LocationSelector.d.ts +10 -0
  792. package/dist/src/ui/components/subagents/create/LocationSelector.js +39 -0
  793. package/dist/src/ui/components/subagents/create/LocationSelector.js.map +1 -0
  794. package/dist/src/ui/components/subagents/create/TextEntryStep.d.ts +26 -0
  795. package/dist/src/ui/components/subagents/create/TextEntryStep.js +28 -0
  796. package/dist/src/ui/components/subagents/create/TextEntryStep.js.map +1 -0
  797. package/dist/src/ui/components/subagents/create/ToolSelector.d.ts +16 -0
  798. package/dist/src/ui/components/subagents/create/ToolSelector.js +145 -0
  799. package/dist/src/ui/components/subagents/create/ToolSelector.js.map +1 -0
  800. package/dist/src/ui/components/subagents/index.d.ts +8 -0
  801. package/dist/src/ui/components/subagents/index.js +12 -0
  802. package/dist/src/ui/components/subagents/index.js.map +1 -0
  803. package/dist/src/ui/components/subagents/manage/ActionSelectionStep.d.ts +13 -0
  804. package/dist/src/ui/components/subagents/manage/ActionSelectionStep.js +71 -0
  805. package/dist/src/ui/components/subagents/manage/ActionSelectionStep.js.map +1 -0
  806. package/dist/src/ui/components/subagents/manage/AgentDeleteStep.d.ts +13 -0
  807. package/dist/src/ui/components/subagents/manage/AgentDeleteStep.js +36 -0
  808. package/dist/src/ui/components/subagents/manage/AgentDeleteStep.js.map +1 -0
  809. package/dist/src/ui/components/subagents/manage/AgentEditStep.d.ts +15 -0
  810. package/dist/src/ui/components/subagents/manage/AgentEditStep.js +73 -0
  811. package/dist/src/ui/components/subagents/manage/AgentEditStep.js.map +1 -0
  812. package/dist/src/ui/components/subagents/manage/AgentSelectionStep.d.ts +12 -0
  813. package/dist/src/ui/components/subagents/manage/AgentSelectionStep.js +231 -0
  814. package/dist/src/ui/components/subagents/manage/AgentSelectionStep.js.map +1 -0
  815. package/dist/src/ui/components/subagents/manage/AgentViewerStep.d.ts +11 -0
  816. package/dist/src/ui/components/subagents/manage/AgentViewerStep.js +20 -0
  817. package/dist/src/ui/components/subagents/manage/AgentViewerStep.js.map +1 -0
  818. package/dist/src/ui/components/subagents/manage/AgentsManagerDialog.d.ts +15 -0
  819. package/dist/src/ui/components/subagents/manage/AgentsManagerDialog.js +212 -0
  820. package/dist/src/ui/components/subagents/manage/AgentsManagerDialog.js.map +1 -0
  821. package/dist/src/ui/components/subagents/reducers.d.ts +14 -0
  822. package/dist/src/ui/components/subagents/reducers.js +162 -0
  823. package/dist/src/ui/components/subagents/reducers.js.map +1 -0
  824. package/dist/src/ui/components/subagents/runtime/AgentExecutionDisplay.d.ts +20 -0
  825. package/dist/src/ui/components/subagents/runtime/AgentExecutionDisplay.js +193 -0
  826. package/dist/src/ui/components/subagents/runtime/AgentExecutionDisplay.js.map +1 -0
  827. package/dist/src/ui/components/subagents/types.d.ts +137 -0
  828. package/dist/src/ui/components/subagents/types.js +15 -0
  829. package/dist/src/ui/components/subagents/types.js.map +1 -0
  830. package/dist/src/ui/components/subagents/utils.d.ts +15 -0
  831. package/dist/src/ui/components/subagents/utils.js +79 -0
  832. package/dist/src/ui/components/subagents/utils.js.map +1 -0
  833. package/dist/src/ui/components/views/ExtensionsList.d.ts +6 -0
  834. package/dist/src/ui/components/views/ExtensionsList.js +47 -0
  835. package/dist/src/ui/components/views/ExtensionsList.js.map +1 -0
  836. package/dist/src/ui/components/views/ExtensionsList.test.d.ts +6 -0
  837. package/dist/src/ui/components/views/ExtensionsList.test.js +97 -0
  838. package/dist/src/ui/components/views/ExtensionsList.test.js.map +1 -0
  839. package/dist/src/ui/components/views/McpStatus.d.ts +27 -0
  840. package/dist/src/ui/components/views/McpStatus.js +90 -0
  841. package/dist/src/ui/components/views/McpStatus.js.map +1 -0
  842. package/dist/src/ui/components/views/McpStatus.test.d.ts +6 -0
  843. package/dist/src/ui/components/views/McpStatus.test.js +117 -0
  844. package/dist/src/ui/components/views/McpStatus.test.js.map +1 -0
  845. package/dist/src/ui/components/views/ToolsList.d.ts +14 -0
  846. package/dist/src/ui/components/views/ToolsList.js +8 -0
  847. package/dist/src/ui/components/views/ToolsList.js.map +1 -0
  848. package/dist/src/ui/components/views/ToolsList.test.d.ts +6 -0
  849. package/dist/src/ui/components/views/ToolsList.test.js +45 -0
  850. package/dist/src/ui/components/views/ToolsList.test.js.map +1 -0
  851. package/dist/src/ui/constants.d.ts +18 -0
  852. package/dist/src/ui/constants.js +23 -0
  853. package/dist/src/ui/constants.js.map +1 -0
  854. package/dist/src/ui/contexts/AppContext.d.ts +11 -0
  855. package/dist/src/ui/contexts/AppContext.js +15 -0
  856. package/dist/src/ui/contexts/AppContext.js.map +1 -0
  857. package/dist/src/ui/contexts/ConfigContext.d.ts +9 -0
  858. package/dist/src/ui/contexts/ConfigContext.js +16 -0
  859. package/dist/src/ui/contexts/ConfigContext.js.map +1 -0
  860. package/dist/src/ui/contexts/KeypressContext.d.ts +35 -0
  861. package/dist/src/ui/contexts/KeypressContext.js +636 -0
  862. package/dist/src/ui/contexts/KeypressContext.js.map +1 -0
  863. package/dist/src/ui/contexts/KeypressContext.test.d.ts +6 -0
  864. package/dist/src/ui/contexts/KeypressContext.test.js +1180 -0
  865. package/dist/src/ui/contexts/KeypressContext.test.js.map +1 -0
  866. package/dist/src/ui/contexts/OverflowContext.d.ts +19 -0
  867. package/dist/src/ui/contexts/OverflowContext.js +38 -0
  868. package/dist/src/ui/contexts/OverflowContext.js.map +1 -0
  869. package/dist/src/ui/contexts/SessionContext.d.ts +45 -0
  870. package/dist/src/ui/contexts/SessionContext.js +157 -0
  871. package/dist/src/ui/contexts/SessionContext.js.map +1 -0
  872. package/dist/src/ui/contexts/SettingsContext.d.ts +9 -0
  873. package/dist/src/ui/contexts/SettingsContext.js +15 -0
  874. package/dist/src/ui/contexts/SettingsContext.js.map +1 -0
  875. package/dist/src/ui/contexts/ShellFocusContext.d.ts +7 -0
  876. package/dist/src/ui/contexts/ShellFocusContext.js +9 -0
  877. package/dist/src/ui/contexts/ShellFocusContext.js.map +1 -0
  878. package/dist/src/ui/contexts/StreamingContext.d.ts +9 -0
  879. package/dist/src/ui/contexts/StreamingContext.js +15 -0
  880. package/dist/src/ui/contexts/StreamingContext.js.map +1 -0
  881. package/dist/src/ui/contexts/UIActionsContext.d.ts +46 -0
  882. package/dist/src/ui/contexts/UIActionsContext.js +22 -0
  883. package/dist/src/ui/contexts/UIActionsContext.js.map +1 -0
  884. package/dist/src/ui/contexts/UIStateContext.d.ts +117 -0
  885. package/dist/src/ui/contexts/UIStateContext.js +17 -0
  886. package/dist/src/ui/contexts/UIStateContext.js.map +1 -0
  887. package/dist/src/ui/contexts/VimModeContext.d.ts +19 -0
  888. package/dist/src/ui/contexts/VimModeContext.js +48 -0
  889. package/dist/src/ui/contexts/VimModeContext.js.map +1 -0
  890. package/dist/src/ui/editors/editorSettingsManager.d.ts +19 -0
  891. package/dist/src/ui/editors/editorSettingsManager.js +48 -0
  892. package/dist/src/ui/editors/editorSettingsManager.js.map +1 -0
  893. package/dist/src/ui/hooks/atCommandProcessor.d.ts +31 -0
  894. package/dist/src/ui/hooks/atCommandProcessor.js +364 -0
  895. package/dist/src/ui/hooks/atCommandProcessor.js.map +1 -0
  896. package/dist/src/ui/hooks/atCommandProcessor.test.d.ts +6 -0
  897. package/dist/src/ui/hooks/atCommandProcessor.test.js +836 -0
  898. package/dist/src/ui/hooks/atCommandProcessor.test.js.map +1 -0
  899. package/dist/src/ui/hooks/keyToAnsi.d.ts +15 -0
  900. package/dist/src/ui/hooks/keyToAnsi.js +67 -0
  901. package/dist/src/ui/hooks/keyToAnsi.js.map +1 -0
  902. package/dist/src/ui/hooks/shellCommandProcessor.d.ts +18 -0
  903. package/dist/src/ui/hooks/shellCommandProcessor.js +284 -0
  904. package/dist/src/ui/hooks/shellCommandProcessor.js.map +1 -0
  905. package/dist/src/ui/hooks/shellCommandProcessor.test.d.ts +6 -0
  906. package/dist/src/ui/hooks/shellCommandProcessor.test.js +508 -0
  907. package/dist/src/ui/hooks/shellCommandProcessor.test.js.map +1 -0
  908. package/dist/src/ui/hooks/slashCommandProcessor.d.ts +52 -0
  909. package/dist/src/ui/hooks/slashCommandProcessor.js +503 -0
  910. package/dist/src/ui/hooks/slashCommandProcessor.js.map +1 -0
  911. package/dist/src/ui/hooks/useAgentsManagerDialog.d.ts +11 -0
  912. package/dist/src/ui/hooks/useAgentsManagerDialog.js +21 -0
  913. package/dist/src/ui/hooks/useAgentsManagerDialog.js.map +1 -0
  914. package/dist/src/ui/hooks/useApprovalModeCommand.d.ts +14 -0
  915. package/dist/src/ui/hooks/useApprovalModeCommand.js +33 -0
  916. package/dist/src/ui/hooks/useApprovalModeCommand.js.map +1 -0
  917. package/dist/src/ui/hooks/useAtCompletion.d.ts +23 -0
  918. package/dist/src/ui/hooks/useAtCompletion.js +179 -0
  919. package/dist/src/ui/hooks/useAtCompletion.js.map +1 -0
  920. package/dist/src/ui/hooks/useAttentionNotifications.d.ts +14 -0
  921. package/dist/src/ui/hooks/useAttentionNotifications.js +41 -0
  922. package/dist/src/ui/hooks/useAttentionNotifications.js.map +1 -0
  923. package/dist/src/ui/hooks/useAttentionNotifications.test.d.ts +6 -0
  924. package/dist/src/ui/hooks/useAttentionNotifications.test.js +113 -0
  925. package/dist/src/ui/hooks/useAttentionNotifications.test.js.map +1 -0
  926. package/dist/src/ui/hooks/useAutoAcceptIndicator.d.ts +13 -0
  927. package/dist/src/ui/hooks/useAutoAcceptIndicator.js +40 -0
  928. package/dist/src/ui/hooks/useAutoAcceptIndicator.js.map +1 -0
  929. package/dist/src/ui/hooks/useAutoAcceptIndicator.test.d.ts +6 -0
  930. package/dist/src/ui/hooks/useAutoAcceptIndicator.test.js +306 -0
  931. package/dist/src/ui/hooks/useAutoAcceptIndicator.test.js.map +1 -0
  932. package/dist/src/ui/hooks/useBracketedPaste.d.ts +12 -0
  933. package/dist/src/ui/hooks/useBracketedPaste.js +32 -0
  934. package/dist/src/ui/hooks/useBracketedPaste.js.map +1 -0
  935. package/dist/src/ui/hooks/useCommandCompletion.d.ts +29 -0
  936. package/dist/src/ui/hooks/useCommandCompletion.js +164 -0
  937. package/dist/src/ui/hooks/useCommandCompletion.js.map +1 -0
  938. package/dist/src/ui/hooks/useCompletion.d.ts +24 -0
  939. package/dist/src/ui/hooks/useCompletion.js +88 -0
  940. package/dist/src/ui/hooks/useCompletion.js.map +1 -0
  941. package/dist/src/ui/hooks/useConsoleMessages.d.ts +12 -0
  942. package/dist/src/ui/hooks/useConsoleMessages.js +76 -0
  943. package/dist/src/ui/hooks/useConsoleMessages.js.map +1 -0
  944. package/dist/src/ui/hooks/useDialogClose.d.ts +35 -0
  945. package/dist/src/ui/hooks/useDialogClose.js +53 -0
  946. package/dist/src/ui/hooks/useDialogClose.js.map +1 -0
  947. package/dist/src/ui/hooks/useEditorSettings.d.ts +16 -0
  948. package/dist/src/ui/hooks/useEditorSettings.js +43 -0
  949. package/dist/src/ui/hooks/useEditorSettings.js.map +1 -0
  950. package/dist/src/ui/hooks/useEditorSettings.test.d.ts +6 -0
  951. package/dist/src/ui/hooks/useEditorSettings.test.js +164 -0
  952. package/dist/src/ui/hooks/useEditorSettings.test.js.map +1 -0
  953. package/dist/src/ui/hooks/useExtensionUpdates.d.ts +21 -0
  954. package/dist/src/ui/hooks/useExtensionUpdates.js +116 -0
  955. package/dist/src/ui/hooks/useExtensionUpdates.js.map +1 -0
  956. package/dist/src/ui/hooks/useExtensionUpdates.test.d.ts +6 -0
  957. package/dist/src/ui/hooks/useExtensionUpdates.test.js +243 -0
  958. package/dist/src/ui/hooks/useExtensionUpdates.test.js.map +1 -0
  959. package/dist/src/ui/hooks/useFocus.d.ts +10 -0
  960. package/dist/src/ui/hooks/useFocus.js +51 -0
  961. package/dist/src/ui/hooks/useFocus.js.map +1 -0
  962. package/dist/src/ui/hooks/useFolderTrust.d.ts +13 -0
  963. package/dist/src/ui/hooks/useFolderTrust.js +60 -0
  964. package/dist/src/ui/hooks/useFolderTrust.js.map +1 -0
  965. package/dist/src/ui/hooks/useGeminiStream.d.ts +39 -0
  966. package/dist/src/ui/hooks/useGeminiStream.js +781 -0
  967. package/dist/src/ui/hooks/useGeminiStream.js.map +1 -0
  968. package/dist/src/ui/hooks/useGitBranchName.d.ts +6 -0
  969. package/dist/src/ui/hooks/useGitBranchName.js +61 -0
  970. package/dist/src/ui/hooks/useGitBranchName.js.map +1 -0
  971. package/dist/src/ui/hooks/useGitBranchName.test.d.ts +6 -0
  972. package/dist/src/ui/hooks/useGitBranchName.test.js +189 -0
  973. package/dist/src/ui/hooks/useGitBranchName.test.js.map +1 -0
  974. package/dist/src/ui/hooks/useHistoryManager.d.ts +22 -0
  975. package/dist/src/ui/hooks/useHistoryManager.js +72 -0
  976. package/dist/src/ui/hooks/useHistoryManager.js.map +1 -0
  977. package/dist/src/ui/hooks/useHistoryManager.test.d.ts +6 -0
  978. package/dist/src/ui/hooks/useHistoryManager.test.js +171 -0
  979. package/dist/src/ui/hooks/useHistoryManager.test.js.map +1 -0
  980. package/dist/src/ui/hooks/useIdeTrustListener.d.ts +16 -0
  981. package/dist/src/ui/hooks/useIdeTrustListener.js +65 -0
  982. package/dist/src/ui/hooks/useIdeTrustListener.js.map +1 -0
  983. package/dist/src/ui/hooks/useIdeTrustListener.test.d.ts +6 -0
  984. package/dist/src/ui/hooks/useIdeTrustListener.test.js +183 -0
  985. package/dist/src/ui/hooks/useIdeTrustListener.test.js.map +1 -0
  986. package/dist/src/ui/hooks/useInitializationAuthError.d.ts +22 -0
  987. package/dist/src/ui/hooks/useInitializationAuthError.js +40 -0
  988. package/dist/src/ui/hooks/useInitializationAuthError.js.map +1 -0
  989. package/dist/src/ui/hooks/useInputHistory.d.ts +19 -0
  990. package/dist/src/ui/hooks/useInputHistory.js +84 -0
  991. package/dist/src/ui/hooks/useInputHistory.js.map +1 -0
  992. package/dist/src/ui/hooks/useInputHistory.test.d.ts +6 -0
  993. package/dist/src/ui/hooks/useInputHistory.test.js +207 -0
  994. package/dist/src/ui/hooks/useInputHistory.test.js.map +1 -0
  995. package/dist/src/ui/hooks/useInputHistoryStore.d.ts +19 -0
  996. package/dist/src/ui/hooks/useInputHistoryStore.js +81 -0
  997. package/dist/src/ui/hooks/useInputHistoryStore.js.map +1 -0
  998. package/dist/src/ui/hooks/useInputHistoryStore.test.d.ts +6 -0
  999. package/dist/src/ui/hooks/useInputHistoryStore.test.js +234 -0
  1000. package/dist/src/ui/hooks/useInputHistoryStore.test.js.map +1 -0
  1001. package/dist/src/ui/hooks/useKeypress.d.ts +17 -0
  1002. package/dist/src/ui/hooks/useKeypress.js +27 -0
  1003. package/dist/src/ui/hooks/useKeypress.js.map +1 -0
  1004. package/dist/src/ui/hooks/useKittyKeyboardProtocol.d.ts +15 -0
  1005. package/dist/src/ui/hooks/useKittyKeyboardProtocol.js +20 -0
  1006. package/dist/src/ui/hooks/useKittyKeyboardProtocol.js.map +1 -0
  1007. package/dist/src/ui/hooks/useLaunchEditor.d.ts +10 -0
  1008. package/dist/src/ui/hooks/useLaunchEditor.js +70 -0
  1009. package/dist/src/ui/hooks/useLaunchEditor.js.map +1 -0
  1010. package/dist/src/ui/hooks/useLoadingIndicator.d.ts +10 -0
  1011. package/dist/src/ui/hooks/useLoadingIndicator.js +44 -0
  1012. package/dist/src/ui/hooks/useLoadingIndicator.js.map +1 -0
  1013. package/dist/src/ui/hooks/useLoadingIndicator.test.d.ts +6 -0
  1014. package/dist/src/ui/hooks/useLoadingIndicator.test.js +91 -0
  1015. package/dist/src/ui/hooks/useLoadingIndicator.test.js.map +1 -0
  1016. package/dist/src/ui/hooks/useLogger.d.ts +11 -0
  1017. package/dist/src/ui/hooks/useLogger.js +29 -0
  1018. package/dist/src/ui/hooks/useLogger.js.map +1 -0
  1019. package/dist/src/ui/hooks/useMemoryMonitor.d.ts +13 -0
  1020. package/dist/src/ui/hooks/useMemoryMonitor.js +28 -0
  1021. package/dist/src/ui/hooks/useMemoryMonitor.js.map +1 -0
  1022. package/dist/src/ui/hooks/useMemoryMonitor.test.d.ts +6 -0
  1023. package/dist/src/ui/hooks/useMemoryMonitor.test.js +57 -0
  1024. package/dist/src/ui/hooks/useMemoryMonitor.test.js.map +1 -0
  1025. package/dist/src/ui/hooks/useMessageQueue.d.ts +23 -0
  1026. package/dist/src/ui/hooks/useMessageQueue.js +51 -0
  1027. package/dist/src/ui/hooks/useMessageQueue.js.map +1 -0
  1028. package/dist/src/ui/hooks/useMessageQueue.test.d.ts +6 -0
  1029. package/dist/src/ui/hooks/useMessageQueue.test.js +167 -0
  1030. package/dist/src/ui/hooks/useMessageQueue.test.js.map +1 -0
  1031. package/dist/src/ui/hooks/useModelCommand.d.ts +12 -0
  1032. package/dist/src/ui/hooks/useModelCommand.js +21 -0
  1033. package/dist/src/ui/hooks/useModelCommand.js.map +1 -0
  1034. package/dist/src/ui/hooks/useModelCommand.test.d.ts +6 -0
  1035. package/dist/src/ui/hooks/useModelCommand.test.js +35 -0
  1036. package/dist/src/ui/hooks/useModelCommand.test.js.map +1 -0
  1037. package/dist/src/ui/hooks/usePermissionsModifyTrust.d.ts +17 -0
  1038. package/dist/src/ui/hooks/usePermissionsModifyTrust.js +78 -0
  1039. package/dist/src/ui/hooks/usePermissionsModifyTrust.js.map +1 -0
  1040. package/dist/src/ui/hooks/usePermissionsModifyTrust.test.d.ts +6 -0
  1041. package/dist/src/ui/hooks/usePermissionsModifyTrust.test.js +182 -0
  1042. package/dist/src/ui/hooks/usePermissionsModifyTrust.test.js.map +1 -0
  1043. package/dist/src/ui/hooks/usePhraseCycler.d.ts +14 -0
  1044. package/dist/src/ui/hooks/usePhraseCycler.js +192 -0
  1045. package/dist/src/ui/hooks/usePhraseCycler.js.map +1 -0
  1046. package/dist/src/ui/hooks/useQuitConfirmation.d.ts +14 -0
  1047. package/dist/src/ui/hooks/useQuitConfirmation.js +36 -0
  1048. package/dist/src/ui/hooks/useQuitConfirmation.js.map +1 -0
  1049. package/dist/src/ui/hooks/useQuotaAndFallback.d.ts +21 -0
  1050. package/dist/src/ui/hooks/useQuotaAndFallback.js +122 -0
  1051. package/dist/src/ui/hooks/useQuotaAndFallback.js.map +1 -0
  1052. package/dist/src/ui/hooks/useQuotaAndFallback.test.d.ts +6 -0
  1053. package/dist/src/ui/hooks/useQuotaAndFallback.test.js +269 -0
  1054. package/dist/src/ui/hooks/useQuotaAndFallback.test.js.map +1 -0
  1055. package/dist/src/ui/hooks/useQwenAuth.d.ts +15 -0
  1056. package/dist/src/ui/hooks/useQwenAuth.js +74 -0
  1057. package/dist/src/ui/hooks/useQwenAuth.js.map +1 -0
  1058. package/dist/src/ui/hooks/useQwenAuth.test.d.ts +6 -0
  1059. package/dist/src/ui/hooks/useQwenAuth.test.js +266 -0
  1060. package/dist/src/ui/hooks/useQwenAuth.test.js.map +1 -0
  1061. package/dist/src/ui/hooks/useReactToolScheduler.d.ts +34 -0
  1062. package/dist/src/ui/hooks/useReactToolScheduler.js +192 -0
  1063. package/dist/src/ui/hooks/useReactToolScheduler.js.map +1 -0
  1064. package/dist/src/ui/hooks/useRefreshMemoryCommand.d.ts +6 -0
  1065. package/dist/src/ui/hooks/useRefreshMemoryCommand.js +7 -0
  1066. package/dist/src/ui/hooks/useRefreshMemoryCommand.js.map +1 -0
  1067. package/dist/src/ui/hooks/useReverseSearchCompletion.d.ts +19 -0
  1068. package/dist/src/ui/hooks/useReverseSearchCompletion.js +103 -0
  1069. package/dist/src/ui/hooks/useReverseSearchCompletion.js.map +1 -0
  1070. package/dist/src/ui/hooks/useReverseSearchCompletion.test.d.ts +6 -0
  1071. package/dist/src/ui/hooks/useReverseSearchCompletion.test.js +163 -0
  1072. package/dist/src/ui/hooks/useReverseSearchCompletion.test.js.map +1 -0
  1073. package/dist/src/ui/hooks/useSelectionList.d.ts +34 -0
  1074. package/dist/src/ui/hooks/useSelectionList.js +245 -0
  1075. package/dist/src/ui/hooks/useSelectionList.js.map +1 -0
  1076. package/dist/src/ui/hooks/useSelectionList.test.d.ts +6 -0
  1077. package/dist/src/ui/hooks/useSelectionList.test.js +701 -0
  1078. package/dist/src/ui/hooks/useSelectionList.test.js.map +1 -0
  1079. package/dist/src/ui/hooks/useSettingsCommand.d.ts +10 -0
  1080. package/dist/src/ui/hooks/useSettingsCommand.js +21 -0
  1081. package/dist/src/ui/hooks/useSettingsCommand.js.map +1 -0
  1082. package/dist/src/ui/hooks/useShellHistory.d.ts +14 -0
  1083. package/dist/src/ui/hooks/useShellHistory.js +111 -0
  1084. package/dist/src/ui/hooks/useShellHistory.js.map +1 -0
  1085. package/dist/src/ui/hooks/useShellHistory.test.d.ts +6 -0
  1086. package/dist/src/ui/hooks/useShellHistory.test.js +187 -0
  1087. package/dist/src/ui/hooks/useShellHistory.test.js.map +1 -0
  1088. package/dist/src/ui/hooks/useShowMemoryCommand.d.ts +9 -0
  1089. package/dist/src/ui/hooks/useShowMemoryCommand.js +58 -0
  1090. package/dist/src/ui/hooks/useShowMemoryCommand.js.map +1 -0
  1091. package/dist/src/ui/hooks/useSlashCompletion.d.ts +20 -0
  1092. package/dist/src/ui/hooks/useSlashCompletion.js +349 -0
  1093. package/dist/src/ui/hooks/useSlashCompletion.js.map +1 -0
  1094. package/dist/src/ui/hooks/useSlashCompletion.test.d.ts +9 -0
  1095. package/dist/src/ui/hooks/useSlashCompletion.test.js +597 -0
  1096. package/dist/src/ui/hooks/useSlashCompletion.test.js.map +1 -0
  1097. package/dist/src/ui/hooks/useStateAndRef.d.ts +7 -0
  1098. package/dist/src/ui/hooks/useStateAndRef.js +26 -0
  1099. package/dist/src/ui/hooks/useStateAndRef.js.map +1 -0
  1100. package/dist/src/ui/hooks/useSubagentCreateDialog.d.ts +10 -0
  1101. package/dist/src/ui/hooks/useSubagentCreateDialog.js +21 -0
  1102. package/dist/src/ui/hooks/useSubagentCreateDialog.js.map +1 -0
  1103. package/dist/src/ui/hooks/useTerminalSize.d.ts +9 -0
  1104. package/dist/src/ui/hooks/useTerminalSize.js +27 -0
  1105. package/dist/src/ui/hooks/useTerminalSize.js.map +1 -0
  1106. package/dist/src/ui/hooks/useThemeCommand.d.ts +15 -0
  1107. package/dist/src/ui/hooks/useThemeCommand.js +73 -0
  1108. package/dist/src/ui/hooks/useThemeCommand.js.map +1 -0
  1109. package/dist/src/ui/hooks/useTimer.d.ts +12 -0
  1110. package/dist/src/ui/hooks/useTimer.js +58 -0
  1111. package/dist/src/ui/hooks/useTimer.js.map +1 -0
  1112. package/dist/src/ui/hooks/useTimer.test.d.ts +6 -0
  1113. package/dist/src/ui/hooks/useTimer.test.js +90 -0
  1114. package/dist/src/ui/hooks/useTimer.test.js.map +1 -0
  1115. package/dist/src/ui/hooks/useToolScheduler.test.d.ts +6 -0
  1116. package/dist/src/ui/hooks/useToolScheduler.test.js +623 -0
  1117. package/dist/src/ui/hooks/useToolScheduler.test.js.map +1 -0
  1118. package/dist/src/ui/hooks/useVisionAutoSwitch.d.ts +47 -0
  1119. package/dist/src/ui/hooks/useVisionAutoSwitch.js +262 -0
  1120. package/dist/src/ui/hooks/useVisionAutoSwitch.js.map +1 -0
  1121. package/dist/src/ui/hooks/useVisionAutoSwitch.test.d.ts +6 -0
  1122. package/dist/src/ui/hooks/useVisionAutoSwitch.test.js +515 -0
  1123. package/dist/src/ui/hooks/useVisionAutoSwitch.test.js.map +1 -0
  1124. package/dist/src/ui/hooks/useWelcomeBack.d.ts +23 -0
  1125. package/dist/src/ui/hooks/useWelcomeBack.js +79 -0
  1126. package/dist/src/ui/hooks/useWelcomeBack.js.map +1 -0
  1127. package/dist/src/ui/hooks/useWorkspaceMigration.d.ts +13 -0
  1128. package/dist/src/ui/hooks/useWorkspaceMigration.js +54 -0
  1129. package/dist/src/ui/hooks/useWorkspaceMigration.js.map +1 -0
  1130. package/dist/src/ui/hooks/vim.d.ts +28 -0
  1131. package/dist/src/ui/hooks/vim.js +639 -0
  1132. package/dist/src/ui/hooks/vim.js.map +1 -0
  1133. package/dist/src/ui/keyMatchers.d.ts +27 -0
  1134. package/dist/src/ui/keyMatchers.js +68 -0
  1135. package/dist/src/ui/keyMatchers.js.map +1 -0
  1136. package/dist/src/ui/keyMatchers.test.d.ts +6 -0
  1137. package/dist/src/ui/keyMatchers.test.js +293 -0
  1138. package/dist/src/ui/keyMatchers.test.js.map +1 -0
  1139. package/dist/src/ui/layouts/DefaultAppLayout.d.ts +9 -0
  1140. package/dist/src/ui/layouts/DefaultAppLayout.js +13 -0
  1141. package/dist/src/ui/layouts/DefaultAppLayout.js.map +1 -0
  1142. package/dist/src/ui/layouts/ScreenReaderAppLayout.d.ts +7 -0
  1143. package/dist/src/ui/layouts/ScreenReaderAppLayout.js +14 -0
  1144. package/dist/src/ui/layouts/ScreenReaderAppLayout.js.map +1 -0
  1145. package/dist/src/ui/models/availableModels.d.ts +49 -0
  1146. package/dist/src/ui/models/availableModels.js +130 -0
  1147. package/dist/src/ui/models/availableModels.js.map +1 -0
  1148. package/dist/src/ui/noninteractive/nonInteractiveUi.d.ts +12 -0
  1149. package/dist/src/ui/noninteractive/nonInteractiveUi.js +29 -0
  1150. package/dist/src/ui/noninteractive/nonInteractiveUi.js.map +1 -0
  1151. package/dist/src/ui/semantic-colors.d.ts +7 -0
  1152. package/dist/src/ui/semantic-colors.js +24 -0
  1153. package/dist/src/ui/semantic-colors.js.map +1 -0
  1154. package/dist/src/ui/state/extensions.d.ts +42 -0
  1155. package/dist/src/ui/state/extensions.js +62 -0
  1156. package/dist/src/ui/state/extensions.js.map +1 -0
  1157. package/dist/src/ui/textConstants.d.ts +9 -0
  1158. package/dist/src/ui/textConstants.js +10 -0
  1159. package/dist/src/ui/textConstants.js.map +1 -0
  1160. package/dist/src/ui/themes/ansi-light.d.ts +7 -0
  1161. package/dist/src/ui/themes/ansi-light.js +142 -0
  1162. package/dist/src/ui/themes/ansi-light.js.map +1 -0
  1163. package/dist/src/ui/themes/ansi.d.ts +7 -0
  1164. package/dist/src/ui/themes/ansi.js +152 -0
  1165. package/dist/src/ui/themes/ansi.js.map +1 -0
  1166. package/dist/src/ui/themes/atom-one-dark.d.ts +7 -0
  1167. package/dist/src/ui/themes/atom-one-dark.js +138 -0
  1168. package/dist/src/ui/themes/atom-one-dark.js.map +1 -0
  1169. package/dist/src/ui/themes/ayu-light.d.ts +7 -0
  1170. package/dist/src/ui/themes/ayu-light.js +130 -0
  1171. package/dist/src/ui/themes/ayu-light.js.map +1 -0
  1172. package/dist/src/ui/themes/ayu.d.ts +7 -0
  1173. package/dist/src/ui/themes/ayu.js +104 -0
  1174. package/dist/src/ui/themes/ayu.js.map +1 -0
  1175. package/dist/src/ui/themes/color-utils.d.ts +21 -0
  1176. package/dist/src/ui/themes/color-utils.js +221 -0
  1177. package/dist/src/ui/themes/color-utils.js.map +1 -0
  1178. package/dist/src/ui/themes/color-utils.test.d.ts +6 -0
  1179. package/dist/src/ui/themes/color-utils.test.js +197 -0
  1180. package/dist/src/ui/themes/color-utils.test.js.map +1 -0
  1181. package/dist/src/ui/themes/default-light.d.ts +7 -0
  1182. package/dist/src/ui/themes/default-light.js +100 -0
  1183. package/dist/src/ui/themes/default-light.js.map +1 -0
  1184. package/dist/src/ui/themes/default.d.ts +7 -0
  1185. package/dist/src/ui/themes/default.js +143 -0
  1186. package/dist/src/ui/themes/default.js.map +1 -0
  1187. package/dist/src/ui/themes/dracula.d.ts +7 -0
  1188. package/dist/src/ui/themes/dracula.js +115 -0
  1189. package/dist/src/ui/themes/dracula.js.map +1 -0
  1190. package/dist/src/ui/themes/github-dark.d.ts +7 -0
  1191. package/dist/src/ui/themes/github-dark.js +138 -0
  1192. package/dist/src/ui/themes/github-dark.js.map +1 -0
  1193. package/dist/src/ui/themes/github-light.d.ts +7 -0
  1194. package/dist/src/ui/themes/github-light.js +140 -0
  1195. package/dist/src/ui/themes/github-light.js.map +1 -0
  1196. package/dist/src/ui/themes/googlecode.d.ts +7 -0
  1197. package/dist/src/ui/themes/googlecode.js +137 -0
  1198. package/dist/src/ui/themes/googlecode.js.map +1 -0
  1199. package/dist/src/ui/themes/hibana-dark.d.ts +7 -0
  1200. package/dist/src/ui/themes/hibana-dark.js +105 -0
  1201. package/dist/src/ui/themes/hibana-dark.js.map +1 -0
  1202. package/dist/src/ui/themes/hibana-light.d.ts +7 -0
  1203. package/dist/src/ui/themes/hibana-light.js +131 -0
  1204. package/dist/src/ui/themes/hibana-light.js.map +1 -0
  1205. package/dist/src/ui/themes/no-color.d.ts +7 -0
  1206. package/dist/src/ui/themes/no-color.js +115 -0
  1207. package/dist/src/ui/themes/no-color.js.map +1 -0
  1208. package/dist/src/ui/themes/qwen-dark.d.ts +7 -0
  1209. package/dist/src/ui/themes/qwen-dark.js +105 -0
  1210. package/dist/src/ui/themes/qwen-dark.js.map +1 -0
  1211. package/dist/src/ui/themes/qwen-light.d.ts +7 -0
  1212. package/dist/src/ui/themes/qwen-light.js +131 -0
  1213. package/dist/src/ui/themes/qwen-light.js.map +1 -0
  1214. package/dist/src/ui/themes/semantic-tokens.d.ts +37 -0
  1215. package/dist/src/ui/themes/semantic-tokens.js +94 -0
  1216. package/dist/src/ui/themes/semantic-tokens.js.map +1 -0
  1217. package/dist/src/ui/themes/shades-of-purple.d.ts +11 -0
  1218. package/dist/src/ui/themes/shades-of-purple.js +304 -0
  1219. package/dist/src/ui/themes/shades-of-purple.js.map +1 -0
  1220. package/dist/src/ui/themes/theme-manager.d.ts +66 -0
  1221. package/dist/src/ui/themes/theme-manager.js +270 -0
  1222. package/dist/src/ui/themes/theme-manager.js.map +1 -0
  1223. package/dist/src/ui/themes/theme-manager.test.d.ts +6 -0
  1224. package/dist/src/ui/themes/theme-manager.test.js +142 -0
  1225. package/dist/src/ui/themes/theme-manager.test.js.map +1 -0
  1226. package/dist/src/ui/themes/theme.d.ts +130 -0
  1227. package/dist/src/ui/themes/theme.js +379 -0
  1228. package/dist/src/ui/themes/theme.js.map +1 -0
  1229. package/dist/src/ui/themes/xcode.d.ts +7 -0
  1230. package/dist/src/ui/themes/xcode.js +145 -0
  1231. package/dist/src/ui/themes/xcode.js.map +1 -0
  1232. package/dist/src/ui/types.d.ts +311 -0
  1233. package/dist/src/ui/types.js +60 -0
  1234. package/dist/src/ui/types.js.map +1 -0
  1235. package/dist/src/ui/utils/CodeColorizer.d.ts +17 -0
  1236. package/dist/src/ui/utils/CodeColorizer.js +111 -0
  1237. package/dist/src/ui/utils/CodeColorizer.js.map +1 -0
  1238. package/dist/src/ui/utils/ConsolePatcher.d.ts +25 -0
  1239. package/dist/src/ui/utils/ConsolePatcher.js +52 -0
  1240. package/dist/src/ui/utils/ConsolePatcher.js.map +1 -0
  1241. package/dist/src/ui/utils/InlineMarkdownRenderer.d.ts +16 -0
  1242. package/dist/src/ui/utils/InlineMarkdownRenderer.js +111 -0
  1243. package/dist/src/ui/utils/InlineMarkdownRenderer.js.map +1 -0
  1244. package/dist/src/ui/utils/MarkdownDisplay.d.ts +14 -0
  1245. package/dist/src/ui/utils/MarkdownDisplay.js +207 -0
  1246. package/dist/src/ui/utils/MarkdownDisplay.js.map +1 -0
  1247. package/dist/src/ui/utils/MarkdownDisplay.test.d.ts +6 -0
  1248. package/dist/src/ui/utils/MarkdownDisplay.test.js +169 -0
  1249. package/dist/src/ui/utils/MarkdownDisplay.test.js.map +1 -0
  1250. package/dist/src/ui/utils/TableRenderer.d.ts +17 -0
  1251. package/dist/src/ui/utils/TableRenderer.js +84 -0
  1252. package/dist/src/ui/utils/TableRenderer.js.map +1 -0
  1253. package/dist/src/ui/utils/clipboardUtils.d.ts +22 -0
  1254. package/dist/src/ui/utils/clipboardUtils.js +126 -0
  1255. package/dist/src/ui/utils/clipboardUtils.js.map +1 -0
  1256. package/dist/src/ui/utils/clipboardUtils.test.d.ts +6 -0
  1257. package/dist/src/ui/utils/clipboardUtils.test.js +65 -0
  1258. package/dist/src/ui/utils/clipboardUtils.test.js.map +1 -0
  1259. package/dist/src/ui/utils/commandUtils.d.ts +40 -0
  1260. package/dist/src/ui/utils/commandUtils.js +146 -0
  1261. package/dist/src/ui/utils/commandUtils.js.map +1 -0
  1262. package/dist/src/ui/utils/commandUtils.test.d.ts +6 -0
  1263. package/dist/src/ui/utils/commandUtils.test.js +352 -0
  1264. package/dist/src/ui/utils/commandUtils.test.js.map +1 -0
  1265. package/dist/src/ui/utils/computeStats.d.ts +10 -0
  1266. package/dist/src/ui/utils/computeStats.js +57 -0
  1267. package/dist/src/ui/utils/computeStats.js.map +1 -0
  1268. package/dist/src/ui/utils/displayUtils.d.ts +18 -0
  1269. package/dist/src/ui/utils/displayUtils.js +27 -0
  1270. package/dist/src/ui/utils/displayUtils.js.map +1 -0
  1271. package/dist/src/ui/utils/displayUtils.test.d.ts +6 -0
  1272. package/dist/src/ui/utils/displayUtils.test.js +61 -0
  1273. package/dist/src/ui/utils/displayUtils.test.js.map +1 -0
  1274. package/dist/src/ui/utils/formatters.d.ts +13 -0
  1275. package/dist/src/ui/utils/formatters.js +56 -0
  1276. package/dist/src/ui/utils/formatters.js.map +1 -0
  1277. package/dist/src/ui/utils/formatters.test.d.ts +6 -0
  1278. package/dist/src/ui/utils/formatters.test.js +56 -0
  1279. package/dist/src/ui/utils/formatters.test.js.map +1 -0
  1280. package/dist/src/ui/utils/highlight.d.ts +11 -0
  1281. package/dist/src/ui/utils/highlight.js +78 -0
  1282. package/dist/src/ui/utils/highlight.js.map +1 -0
  1283. package/dist/src/ui/utils/highlight.test.d.ts +6 -0
  1284. package/dist/src/ui/utils/highlight.test.js +120 -0
  1285. package/dist/src/ui/utils/highlight.test.js.map +1 -0
  1286. package/dist/src/ui/utils/isNarrowWidth.d.ts +6 -0
  1287. package/dist/src/ui/utils/isNarrowWidth.js +9 -0
  1288. package/dist/src/ui/utils/isNarrowWidth.js.map +1 -0
  1289. package/dist/src/ui/utils/kittyProtocolDetector.d.ts +13 -0
  1290. package/dist/src/ui/utils/kittyProtocolDetector.js +98 -0
  1291. package/dist/src/ui/utils/kittyProtocolDetector.js.map +1 -0
  1292. package/dist/src/ui/utils/markdownUtilities.d.ts +6 -0
  1293. package/dist/src/ui/utils/markdownUtilities.js +110 -0
  1294. package/dist/src/ui/utils/markdownUtilities.js.map +1 -0
  1295. package/dist/src/ui/utils/markdownUtilities.test.d.ts +6 -0
  1296. package/dist/src/ui/utils/markdownUtilities.test.js +42 -0
  1297. package/dist/src/ui/utils/markdownUtilities.test.js.map +1 -0
  1298. package/dist/src/ui/utils/platformConstants.d.ts +75 -0
  1299. package/dist/src/ui/utils/platformConstants.js +78 -0
  1300. package/dist/src/ui/utils/platformConstants.js.map +1 -0
  1301. package/dist/src/ui/utils/terminalSetup.d.ts +30 -0
  1302. package/dist/src/ui/utils/terminalSetup.js +308 -0
  1303. package/dist/src/ui/utils/terminalSetup.js.map +1 -0
  1304. package/dist/src/ui/utils/textUtils.d.ts +42 -0
  1305. package/dist/src/ui/utils/textUtils.js +185 -0
  1306. package/dist/src/ui/utils/textUtils.js.map +1 -0
  1307. package/dist/src/ui/utils/textUtils.test.d.ts +6 -0
  1308. package/dist/src/ui/utils/textUtils.test.js +132 -0
  1309. package/dist/src/ui/utils/textUtils.test.js.map +1 -0
  1310. package/dist/src/ui/utils/updateCheck.d.ts +12 -0
  1311. package/dist/src/ui/utils/updateCheck.js +78 -0
  1312. package/dist/src/ui/utils/updateCheck.js.map +1 -0
  1313. package/dist/src/ui/utils/updateCheck.test.d.ts +6 -0
  1314. package/dist/src/ui/utils/updateCheck.test.js +145 -0
  1315. package/dist/src/ui/utils/updateCheck.test.js.map +1 -0
  1316. package/dist/src/utils/attentionNotification.d.ts +20 -0
  1317. package/dist/src/utils/attentionNotification.js +34 -0
  1318. package/dist/src/utils/attentionNotification.js.map +1 -0
  1319. package/dist/src/utils/attentionNotification.test.d.ts +6 -0
  1320. package/dist/src/utils/attentionNotification.test.js +46 -0
  1321. package/dist/src/utils/attentionNotification.test.js.map +1 -0
  1322. package/dist/src/utils/checks.d.ts +19 -0
  1323. package/dist/src/utils/checks.js +24 -0
  1324. package/dist/src/utils/checks.js.map +1 -0
  1325. package/dist/src/utils/cleanup.d.ts +8 -0
  1326. package/dist/src/utils/cleanup.js +35 -0
  1327. package/dist/src/utils/cleanup.js.map +1 -0
  1328. package/dist/src/utils/commands.d.ts +20 -0
  1329. package/dist/src/utils/commands.js +53 -0
  1330. package/dist/src/utils/commands.js.map +1 -0
  1331. package/dist/src/utils/commands.test.d.ts +6 -0
  1332. package/dist/src/utils/commands.test.js +115 -0
  1333. package/dist/src/utils/commands.test.js.map +1 -0
  1334. package/dist/src/utils/commentJson.d.ts +9 -0
  1335. package/dist/src/utils/commentJson.js +55 -0
  1336. package/dist/src/utils/commentJson.js.map +1 -0
  1337. package/dist/src/utils/commentJson.test.d.ts +6 -0
  1338. package/dist/src/utils/commentJson.test.js +146 -0
  1339. package/dist/src/utils/commentJson.test.js.map +1 -0
  1340. package/dist/src/utils/deepMerge.d.ts +9 -0
  1341. package/dist/src/utils/deepMerge.js +58 -0
  1342. package/dist/src/utils/deepMerge.js.map +1 -0
  1343. package/dist/src/utils/deepMerge.test.d.ts +6 -0
  1344. package/dist/src/utils/deepMerge.test.js +143 -0
  1345. package/dist/src/utils/deepMerge.test.js.map +1 -0
  1346. package/dist/src/utils/dialogScopeUtils.d.ts +28 -0
  1347. package/dist/src/utils/dialogScopeUtils.js +51 -0
  1348. package/dist/src/utils/dialogScopeUtils.js.map +1 -0
  1349. package/dist/src/utils/envVarResolver.d.ts +39 -0
  1350. package/dist/src/utils/envVarResolver.js +97 -0
  1351. package/dist/src/utils/envVarResolver.js.map +1 -0
  1352. package/dist/src/utils/envVarResolver.test.d.ts +6 -0
  1353. package/dist/src/utils/envVarResolver.test.js +221 -0
  1354. package/dist/src/utils/envVarResolver.test.js.map +1 -0
  1355. package/dist/src/utils/errors.d.ts +35 -0
  1356. package/dist/src/utils/errors.js +106 -0
  1357. package/dist/src/utils/errors.js.map +1 -0
  1358. package/dist/src/utils/errors.test.d.ts +6 -0
  1359. package/dist/src/utils/errors.test.js +340 -0
  1360. package/dist/src/utils/errors.test.js.map +1 -0
  1361. package/dist/src/utils/events.d.ts +12 -0
  1362. package/dist/src/utils/events.js +14 -0
  1363. package/dist/src/utils/events.js.map +1 -0
  1364. package/dist/src/utils/gitUtils.d.ts +30 -0
  1365. package/dist/src/utils/gitUtils.js +89 -0
  1366. package/dist/src/utils/gitUtils.js.map +1 -0
  1367. package/dist/src/utils/gitUtils.test.d.ts +6 -0
  1368. package/dist/src/utils/gitUtils.test.js +113 -0
  1369. package/dist/src/utils/gitUtils.test.js.map +1 -0
  1370. package/dist/src/utils/handleAutoUpdate.d.ts +11 -0
  1371. package/dist/src/utils/handleAutoUpdate.js +102 -0
  1372. package/dist/src/utils/handleAutoUpdate.js.map +1 -0
  1373. package/dist/src/utils/installationInfo.d.ts +23 -0
  1374. package/dist/src/utils/installationInfo.js +153 -0
  1375. package/dist/src/utils/installationInfo.js.map +1 -0
  1376. package/dist/src/utils/installationInfo.test.d.ts +6 -0
  1377. package/dist/src/utils/installationInfo.test.js +242 -0
  1378. package/dist/src/utils/installationInfo.test.js.map +1 -0
  1379. package/dist/src/utils/math.d.ts +13 -0
  1380. package/dist/src/utils/math.js +14 -0
  1381. package/dist/src/utils/math.js.map +1 -0
  1382. package/dist/src/utils/nonInteractiveHelpers.d.ts +88 -0
  1383. package/dist/src/utils/nonInteractiveHelpers.js +470 -0
  1384. package/dist/src/utils/nonInteractiveHelpers.js.map +1 -0
  1385. package/dist/src/utils/nonInteractiveHelpers.test.d.ts +6 -0
  1386. package/dist/src/utils/nonInteractiveHelpers.test.js +945 -0
  1387. package/dist/src/utils/nonInteractiveHelpers.test.js.map +1 -0
  1388. package/dist/src/utils/package.d.ts +12 -0
  1389. package/dist/src/utils/package.js +24 -0
  1390. package/dist/src/utils/package.js.map +1 -0
  1391. package/dist/src/utils/processUtils.d.ts +13 -0
  1392. package/dist/src/utils/processUtils.js +18 -0
  1393. package/dist/src/utils/processUtils.js.map +1 -0
  1394. package/dist/src/utils/processUtils.test.d.ts +6 -0
  1395. package/dist/src/utils/processUtils.test.js +20 -0
  1396. package/dist/src/utils/processUtils.test.js.map +1 -0
  1397. package/dist/src/utils/readStdin.d.ts +6 -0
  1398. package/dist/src/utils/readStdin.js +59 -0
  1399. package/dist/src/utils/readStdin.js.map +1 -0
  1400. package/dist/src/utils/readStdin.test.d.ts +6 -0
  1401. package/dist/src/utils/readStdin.test.js +88 -0
  1402. package/dist/src/utils/readStdin.test.js.map +1 -0
  1403. package/dist/src/utils/relaunch.d.ts +7 -0
  1404. package/dist/src/utils/relaunch.js +57 -0
  1405. package/dist/src/utils/relaunch.js.map +1 -0
  1406. package/dist/src/utils/relaunch.test.d.ts +6 -0
  1407. package/dist/src/utils/relaunch.test.js +273 -0
  1408. package/dist/src/utils/relaunch.test.js.map +1 -0
  1409. package/dist/src/utils/resolvePath.d.ts +6 -0
  1410. package/dist/src/utils/resolvePath.js +21 -0
  1411. package/dist/src/utils/resolvePath.js.map +1 -0
  1412. package/dist/src/utils/sandbox-macos-permissive-closed.sb +32 -0
  1413. package/dist/src/utils/sandbox-macos-permissive-open.sb +25 -0
  1414. package/dist/src/utils/sandbox-macos-permissive-proxied.sb +37 -0
  1415. package/dist/src/utils/sandbox-macos-restrictive-closed.sb +93 -0
  1416. package/dist/src/utils/sandbox-macos-restrictive-open.sb +96 -0
  1417. package/dist/src/utils/sandbox-macos-restrictive-proxied.sb +98 -0
  1418. package/dist/src/utils/sandbox.d.ts +7 -0
  1419. package/dist/src/utils/sandbox.js +763 -0
  1420. package/dist/src/utils/sandbox.js.map +1 -0
  1421. package/dist/src/utils/settingsUtils.d.ts +144 -0
  1422. package/dist/src/utils/settingsUtils.js +346 -0
  1423. package/dist/src/utils/settingsUtils.js.map +1 -0
  1424. package/dist/src/utils/settingsUtils.test.d.ts +6 -0
  1425. package/dist/src/utils/settingsUtils.test.js +808 -0
  1426. package/dist/src/utils/settingsUtils.test.js.map +1 -0
  1427. package/dist/src/utils/spawnWrapper.d.ts +7 -0
  1428. package/dist/src/utils/spawnWrapper.js +8 -0
  1429. package/dist/src/utils/spawnWrapper.js.map +1 -0
  1430. package/dist/src/utils/startupWarnings.d.ts +6 -0
  1431. package/dist/src/utils/startupWarnings.js +40 -0
  1432. package/dist/src/utils/startupWarnings.js.map +1 -0
  1433. package/dist/src/utils/systemInfo.d.ts +66 -0
  1434. package/dist/src/utils/systemInfo.js +125 -0
  1435. package/dist/src/utils/systemInfo.js.map +1 -0
  1436. package/dist/src/utils/systemInfo.test.d.ts +6 -0
  1437. package/dist/src/utils/systemInfo.test.js +259 -0
  1438. package/dist/src/utils/systemInfo.test.js.map +1 -0
  1439. package/dist/src/utils/systemInfoFields.d.ts +22 -0
  1440. package/dist/src/utils/systemInfoFields.js +96 -0
  1441. package/dist/src/utils/systemInfoFields.js.map +1 -0
  1442. package/dist/src/utils/updateEventEmitter.d.ts +11 -0
  1443. package/dist/src/utils/updateEventEmitter.js +12 -0
  1444. package/dist/src/utils/updateEventEmitter.js.map +1 -0
  1445. package/dist/src/utils/userStartupWarnings.d.ts +12 -0
  1446. package/dist/src/utils/userStartupWarnings.js +74 -0
  1447. package/dist/src/utils/userStartupWarnings.js.map +1 -0
  1448. package/dist/src/utils/userStartupWarnings.test.d.ts +6 -0
  1449. package/dist/src/utils/userStartupWarnings.test.js +88 -0
  1450. package/dist/src/utils/userStartupWarnings.test.js.map +1 -0
  1451. package/dist/src/utils/version.d.ts +6 -0
  1452. package/dist/src/utils/version.js +11 -0
  1453. package/dist/src/utils/version.js.map +1 -0
  1454. package/dist/src/utils/windowTitle.d.ts +12 -0
  1455. package/dist/src/utils/windowTitle.js +19 -0
  1456. package/dist/src/utils/windowTitle.js.map +1 -0
  1457. package/dist/src/utils/windowTitle.test.d.ts +6 -0
  1458. package/dist/src/utils/windowTitle.test.js +49 -0
  1459. package/dist/src/utils/windowTitle.test.js.map +1 -0
  1460. package/dist/src/validateNonInterActiveAuth.d.ts +9 -0
  1461. package/dist/src/validateNonInterActiveAuth.js +73 -0
  1462. package/dist/src/validateNonInterActiveAuth.js.map +1 -0
  1463. package/dist/src/zed-integration/acp.d.ts +63 -0
  1464. package/dist/src/zed-integration/acp.js +225 -0
  1465. package/dist/src/zed-integration/acp.js.map +1 -0
  1466. package/dist/src/zed-integration/fileSystemService.d.ts +20 -0
  1467. package/dist/src/zed-integration/fileSystemService.js +46 -0
  1468. package/dist/src/zed-integration/fileSystemService.js.map +1 -0
  1469. package/dist/src/zed-integration/schema.d.ts +12024 -0
  1470. package/dist/src/zed-integration/schema.js +324 -0
  1471. package/dist/src/zed-integration/schema.js.map +1 -0
  1472. package/dist/src/zed-integration/zedIntegration.d.ts +17 -0
  1473. package/dist/src/zed-integration/zedIntegration.js +1135 -0
  1474. package/dist/src/zed-integration/zedIntegration.js.map +1 -0
  1475. package/dist/tsconfig.tsbuildinfo +1 -0
  1476. package/package.json +115 -0
@@ -0,0 +1,1598 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { spawnSync } from 'node:child_process';
7
+ import fs from 'node:fs';
8
+ import os from 'node:os';
9
+ import pathMod from 'node:path';
10
+ import { useState, useCallback, useEffect, useMemo, useReducer } from 'react';
11
+ import { unescapePath } from '@hibanacloud/core';
12
+ import { toCodePoints, cpLen, cpSlice, stripUnsafeCharacters, getCachedStringWidth, } from '../../utils/textUtils.js';
13
+ import { handleVimAction } from './vim-buffer-actions.js';
14
+ // Simple helper for word‑wise ops.
15
+ function isWordChar(ch) {
16
+ if (ch === undefined) {
17
+ return false;
18
+ }
19
+ return !/[\s,.;!?]/.test(ch);
20
+ }
21
+ // Helper functions for line-based word navigation
22
+ export const isWordCharStrict = (char) => /[\w\p{L}\p{N}]/u.test(char); // Matches a single character that is any Unicode letter, any Unicode number, or an underscore
23
+ export const isWhitespace = (char) => /\s/.test(char);
24
+ // Check if a character is a combining mark (only diacritics for now)
25
+ export const isCombiningMark = (char) => /\p{M}/u.test(char);
26
+ // Check if a character should be considered part of a word (including combining marks)
27
+ export const isWordCharWithCombining = (char) => isWordCharStrict(char) || isCombiningMark(char);
28
+ // Get the script of a character (simplified for common scripts)
29
+ export const getCharScript = (char) => {
30
+ if (/[\p{Script=Latin}]/u.test(char))
31
+ return 'latin'; // All Latin script chars including diacritics
32
+ if (/[\p{Script=Han}]/u.test(char))
33
+ return 'han'; // Chinese
34
+ if (/[\p{Script=Arabic}]/u.test(char))
35
+ return 'arabic';
36
+ if (/[\p{Script=Hiragana}]/u.test(char))
37
+ return 'hiragana';
38
+ if (/[\p{Script=Katakana}]/u.test(char))
39
+ return 'katakana';
40
+ if (/[\p{Script=Cyrillic}]/u.test(char))
41
+ return 'cyrillic';
42
+ return 'other';
43
+ };
44
+ // Check if two characters are from different scripts (indicating word boundary)
45
+ export const isDifferentScript = (char1, char2) => {
46
+ if (!isWordCharStrict(char1) || !isWordCharStrict(char2))
47
+ return false;
48
+ return getCharScript(char1) !== getCharScript(char2);
49
+ };
50
+ // Find next word start within a line, starting from col
51
+ export const findNextWordStartInLine = (line, col) => {
52
+ const chars = toCodePoints(line);
53
+ let i = col;
54
+ if (i >= chars.length)
55
+ return null;
56
+ const currentChar = chars[i];
57
+ // Skip current word/sequence based on character type
58
+ if (isWordCharStrict(currentChar)) {
59
+ while (i < chars.length && isWordCharWithCombining(chars[i])) {
60
+ // Check for script boundary - if next character is from different script, stop here
61
+ if (i + 1 < chars.length &&
62
+ isWordCharStrict(chars[i + 1]) &&
63
+ isDifferentScript(chars[i], chars[i + 1])) {
64
+ i++; // Include current character
65
+ break; // Stop at script boundary
66
+ }
67
+ i++;
68
+ }
69
+ }
70
+ else if (!isWhitespace(currentChar)) {
71
+ while (i < chars.length &&
72
+ !isWordCharStrict(chars[i]) &&
73
+ !isWhitespace(chars[i])) {
74
+ i++;
75
+ }
76
+ }
77
+ // Skip whitespace
78
+ while (i < chars.length && isWhitespace(chars[i])) {
79
+ i++;
80
+ }
81
+ return i < chars.length ? i : null;
82
+ };
83
+ // Find previous word start within a line
84
+ export const findPrevWordStartInLine = (line, col) => {
85
+ const chars = toCodePoints(line);
86
+ let i = col;
87
+ if (i <= 0)
88
+ return null;
89
+ i--;
90
+ // Skip whitespace moving backwards
91
+ while (i >= 0 && isWhitespace(chars[i])) {
92
+ i--;
93
+ }
94
+ if (i < 0)
95
+ return null;
96
+ if (isWordCharStrict(chars[i])) {
97
+ // We're in a word, move to its beginning
98
+ while (i >= 0 && isWordCharStrict(chars[i])) {
99
+ // Check for script boundary - if previous character is from different script, stop here
100
+ if (i - 1 >= 0 &&
101
+ isWordCharStrict(chars[i - 1]) &&
102
+ isDifferentScript(chars[i], chars[i - 1])) {
103
+ return i; // Return current position at script boundary
104
+ }
105
+ i--;
106
+ }
107
+ return i + 1;
108
+ }
109
+ else {
110
+ // We're in punctuation, move to its beginning
111
+ while (i >= 0 && !isWordCharStrict(chars[i]) && !isWhitespace(chars[i])) {
112
+ i--;
113
+ }
114
+ return i + 1;
115
+ }
116
+ };
117
+ // Find word end within a line
118
+ export const findWordEndInLine = (line, col) => {
119
+ const chars = toCodePoints(line);
120
+ let i = col;
121
+ // If we're already at the end of a word (including punctuation sequences), advance to next word
122
+ // This includes both regular word endings and script boundaries
123
+ const atEndOfWordChar = i < chars.length &&
124
+ isWordCharWithCombining(chars[i]) &&
125
+ (i + 1 >= chars.length ||
126
+ !isWordCharWithCombining(chars[i + 1]) ||
127
+ (isWordCharStrict(chars[i]) &&
128
+ i + 1 < chars.length &&
129
+ isWordCharStrict(chars[i + 1]) &&
130
+ isDifferentScript(chars[i], chars[i + 1])));
131
+ const atEndOfPunctuation = i < chars.length &&
132
+ !isWordCharWithCombining(chars[i]) &&
133
+ !isWhitespace(chars[i]) &&
134
+ (i + 1 >= chars.length ||
135
+ isWhitespace(chars[i + 1]) ||
136
+ isWordCharWithCombining(chars[i + 1]));
137
+ if (atEndOfWordChar || atEndOfPunctuation) {
138
+ // We're at the end of a word or punctuation sequence, move forward to find next word
139
+ i++;
140
+ // Skip whitespace to find next word or punctuation
141
+ while (i < chars.length && isWhitespace(chars[i])) {
142
+ i++;
143
+ }
144
+ }
145
+ // If we're not on a word character, find the next word or punctuation sequence
146
+ if (i < chars.length && !isWordCharWithCombining(chars[i])) {
147
+ // Skip whitespace to find next word or punctuation
148
+ while (i < chars.length && isWhitespace(chars[i])) {
149
+ i++;
150
+ }
151
+ }
152
+ // Move to end of current word (including combining marks, but stop at script boundaries)
153
+ let foundWord = false;
154
+ let lastBaseCharPos = -1;
155
+ if (i < chars.length && isWordCharWithCombining(chars[i])) {
156
+ // Handle word characters
157
+ while (i < chars.length && isWordCharWithCombining(chars[i])) {
158
+ foundWord = true;
159
+ // Track the position of the last base character (not combining mark)
160
+ if (isWordCharStrict(chars[i])) {
161
+ lastBaseCharPos = i;
162
+ }
163
+ // Check if next character is from a different script (word boundary)
164
+ if (i + 1 < chars.length &&
165
+ isWordCharStrict(chars[i + 1]) &&
166
+ isDifferentScript(chars[i], chars[i + 1])) {
167
+ i++; // Include current character
168
+ if (isWordCharStrict(chars[i - 1])) {
169
+ lastBaseCharPos = i - 1;
170
+ }
171
+ break; // Stop at script boundary
172
+ }
173
+ i++;
174
+ }
175
+ }
176
+ else if (i < chars.length && !isWhitespace(chars[i])) {
177
+ // Handle punctuation sequences (like ████)
178
+ while (i < chars.length &&
179
+ !isWordCharStrict(chars[i]) &&
180
+ !isWhitespace(chars[i])) {
181
+ foundWord = true;
182
+ lastBaseCharPos = i;
183
+ i++;
184
+ }
185
+ }
186
+ // Only return a position if we actually found a word
187
+ // Return the position of the last base character, not combining marks
188
+ if (foundWord && lastBaseCharPos >= col) {
189
+ return lastBaseCharPos;
190
+ }
191
+ return null;
192
+ };
193
+ // Find next word across lines
194
+ export const findNextWordAcrossLines = (lines, cursorRow, cursorCol, searchForWordStart) => {
195
+ // First try current line
196
+ const currentLine = lines[cursorRow] || '';
197
+ const colInCurrentLine = searchForWordStart
198
+ ? findNextWordStartInLine(currentLine, cursorCol)
199
+ : findWordEndInLine(currentLine, cursorCol);
200
+ if (colInCurrentLine !== null) {
201
+ return { row: cursorRow, col: colInCurrentLine };
202
+ }
203
+ // Search subsequent lines
204
+ for (let row = cursorRow + 1; row < lines.length; row++) {
205
+ const line = lines[row] || '';
206
+ const chars = toCodePoints(line);
207
+ // For empty lines, if we haven't found any words yet, return the empty line
208
+ if (chars.length === 0) {
209
+ // Check if there are any words in remaining lines
210
+ let hasWordsInLaterLines = false;
211
+ for (let laterRow = row + 1; laterRow < lines.length; laterRow++) {
212
+ const laterLine = lines[laterRow] || '';
213
+ const laterChars = toCodePoints(laterLine);
214
+ let firstNonWhitespace = 0;
215
+ while (firstNonWhitespace < laterChars.length &&
216
+ isWhitespace(laterChars[firstNonWhitespace])) {
217
+ firstNonWhitespace++;
218
+ }
219
+ if (firstNonWhitespace < laterChars.length) {
220
+ hasWordsInLaterLines = true;
221
+ break;
222
+ }
223
+ }
224
+ // If no words in later lines, return the empty line
225
+ if (!hasWordsInLaterLines) {
226
+ return { row, col: 0 };
227
+ }
228
+ continue;
229
+ }
230
+ // Find first non-whitespace
231
+ let firstNonWhitespace = 0;
232
+ while (firstNonWhitespace < chars.length &&
233
+ isWhitespace(chars[firstNonWhitespace])) {
234
+ firstNonWhitespace++;
235
+ }
236
+ if (firstNonWhitespace < chars.length) {
237
+ if (searchForWordStart) {
238
+ return { row, col: firstNonWhitespace };
239
+ }
240
+ else {
241
+ // For word end, find the end of the first word
242
+ const endCol = findWordEndInLine(line, firstNonWhitespace);
243
+ if (endCol !== null) {
244
+ return { row, col: endCol };
245
+ }
246
+ }
247
+ }
248
+ }
249
+ return null;
250
+ };
251
+ // Find previous word across lines
252
+ export const findPrevWordAcrossLines = (lines, cursorRow, cursorCol) => {
253
+ // First try current line
254
+ const currentLine = lines[cursorRow] || '';
255
+ const colInCurrentLine = findPrevWordStartInLine(currentLine, cursorCol);
256
+ if (colInCurrentLine !== null) {
257
+ return { row: cursorRow, col: colInCurrentLine };
258
+ }
259
+ // Search previous lines
260
+ for (let row = cursorRow - 1; row >= 0; row--) {
261
+ const line = lines[row] || '';
262
+ const chars = toCodePoints(line);
263
+ if (chars.length === 0)
264
+ continue;
265
+ // Find last word start
266
+ let lastWordStart = chars.length;
267
+ while (lastWordStart > 0 && isWhitespace(chars[lastWordStart - 1])) {
268
+ lastWordStart--;
269
+ }
270
+ if (lastWordStart > 0) {
271
+ // Find start of this word
272
+ const wordStart = findPrevWordStartInLine(line, lastWordStart);
273
+ if (wordStart !== null) {
274
+ return { row, col: wordStart };
275
+ }
276
+ }
277
+ }
278
+ return null;
279
+ };
280
+ // Helper functions for vim line operations
281
+ export const getPositionFromOffsets = (startOffset, endOffset, lines) => {
282
+ let offset = 0;
283
+ let startRow = 0;
284
+ let startCol = 0;
285
+ let endRow = 0;
286
+ let endCol = 0;
287
+ // Find start position
288
+ for (let i = 0; i < lines.length; i++) {
289
+ const lineLength = lines[i].length + 1; // +1 for newline
290
+ if (offset + lineLength > startOffset) {
291
+ startRow = i;
292
+ startCol = startOffset - offset;
293
+ break;
294
+ }
295
+ offset += lineLength;
296
+ }
297
+ // Find end position
298
+ offset = 0;
299
+ for (let i = 0; i < lines.length; i++) {
300
+ const lineLength = lines[i].length + (i < lines.length - 1 ? 1 : 0); // +1 for newline except last line
301
+ if (offset + lineLength >= endOffset) {
302
+ endRow = i;
303
+ endCol = endOffset - offset;
304
+ break;
305
+ }
306
+ offset += lineLength;
307
+ }
308
+ return { startRow, startCol, endRow, endCol };
309
+ };
310
+ export const getLineRangeOffsets = (startRow, lineCount, lines) => {
311
+ let startOffset = 0;
312
+ // Calculate start offset
313
+ for (let i = 0; i < startRow; i++) {
314
+ startOffset += lines[i].length + 1; // +1 for newline
315
+ }
316
+ // Calculate end offset
317
+ let endOffset = startOffset;
318
+ for (let i = 0; i < lineCount; i++) {
319
+ const lineIndex = startRow + i;
320
+ if (lineIndex < lines.length) {
321
+ endOffset += lines[lineIndex].length;
322
+ if (lineIndex < lines.length - 1) {
323
+ endOffset += 1; // +1 for newline
324
+ }
325
+ }
326
+ }
327
+ return { startOffset, endOffset };
328
+ };
329
+ export const replaceRangeInternal = (state, startRow, startCol, endRow, endCol, text) => {
330
+ const currentLine = (row) => state.lines[row] || '';
331
+ const currentLineLen = (row) => cpLen(currentLine(row));
332
+ const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
333
+ if (startRow > endRow ||
334
+ (startRow === endRow && startCol > endCol) ||
335
+ startRow < 0 ||
336
+ startCol < 0 ||
337
+ endRow >= state.lines.length ||
338
+ (endRow < state.lines.length && endCol > currentLineLen(endRow))) {
339
+ return state; // Invalid range
340
+ }
341
+ const newLines = [...state.lines];
342
+ const sCol = clamp(startCol, 0, currentLineLen(startRow));
343
+ const eCol = clamp(endCol, 0, currentLineLen(endRow));
344
+ const prefix = cpSlice(currentLine(startRow), 0, sCol);
345
+ const suffix = cpSlice(currentLine(endRow), eCol);
346
+ const normalisedReplacement = text
347
+ .replace(/\r\n/g, '\n')
348
+ .replace(/\r/g, '\n');
349
+ const replacementParts = normalisedReplacement.split('\n');
350
+ // The combined first line of the new text
351
+ const firstLine = prefix + replacementParts[0];
352
+ if (replacementParts.length === 1) {
353
+ // No newlines in replacement: combine prefix, replacement, and suffix on one line.
354
+ newLines.splice(startRow, endRow - startRow + 1, firstLine + suffix);
355
+ }
356
+ else {
357
+ // Newlines in replacement: create new lines.
358
+ const lastLine = replacementParts[replacementParts.length - 1] + suffix;
359
+ const middleLines = replacementParts.slice(1, -1);
360
+ newLines.splice(startRow, endRow - startRow + 1, firstLine, ...middleLines, lastLine);
361
+ }
362
+ const finalCursorRow = startRow + replacementParts.length - 1;
363
+ const finalCursorCol = (replacementParts.length > 1 ? 0 : sCol) +
364
+ cpLen(replacementParts[replacementParts.length - 1]);
365
+ return {
366
+ ...state,
367
+ lines: newLines,
368
+ cursorRow: Math.min(Math.max(finalCursorRow, 0), newLines.length - 1),
369
+ cursorCol: Math.max(0, Math.min(finalCursorCol, cpLen(newLines[finalCursorRow] || ''))),
370
+ preferredCol: null,
371
+ };
372
+ };
373
+ function clamp(v, min, max) {
374
+ return v < min ? min : v > max ? max : v;
375
+ }
376
+ function calculateInitialCursorPosition(initialLines, offset) {
377
+ let remainingChars = offset;
378
+ let row = 0;
379
+ while (row < initialLines.length) {
380
+ const lineLength = cpLen(initialLines[row]);
381
+ // Add 1 for the newline character (except for the last line)
382
+ const totalCharsInLineAndNewline = lineLength + (row < initialLines.length - 1 ? 1 : 0);
383
+ if (remainingChars <= lineLength) {
384
+ // Cursor is on this line
385
+ return [row, remainingChars];
386
+ }
387
+ remainingChars -= totalCharsInLineAndNewline;
388
+ row++;
389
+ }
390
+ // Offset is beyond the text, place cursor at the end of the last line
391
+ if (initialLines.length > 0) {
392
+ const lastRow = initialLines.length - 1;
393
+ return [lastRow, cpLen(initialLines[lastRow])];
394
+ }
395
+ return [0, 0]; // Default for empty text
396
+ }
397
+ export function offsetToLogicalPos(text, offset) {
398
+ let row = 0;
399
+ let col = 0;
400
+ let currentOffset = 0;
401
+ if (offset === 0)
402
+ return [0, 0];
403
+ const lines = text.split('\n');
404
+ for (let i = 0; i < lines.length; i++) {
405
+ const line = lines[i];
406
+ const lineLength = cpLen(line);
407
+ const lineLengthWithNewline = lineLength + (i < lines.length - 1 ? 1 : 0);
408
+ if (offset <= currentOffset + lineLength) {
409
+ // Check against lineLength first
410
+ row = i;
411
+ col = offset - currentOffset;
412
+ return [row, col];
413
+ }
414
+ else if (offset <= currentOffset + lineLengthWithNewline) {
415
+ // Check if offset is the newline itself
416
+ row = i;
417
+ col = lineLength; // Position cursor at the end of the current line content
418
+ // If the offset IS the newline, and it's not the last line, advance to next line, col 0
419
+ if (offset === currentOffset + lineLengthWithNewline &&
420
+ i < lines.length - 1) {
421
+ return [i + 1, 0];
422
+ }
423
+ return [row, col]; // Otherwise, it's at the end of the current line content
424
+ }
425
+ currentOffset += lineLengthWithNewline;
426
+ }
427
+ // If offset is beyond the text length, place cursor at the end of the last line
428
+ // or [0,0] if text is empty
429
+ if (lines.length > 0) {
430
+ row = lines.length - 1;
431
+ col = cpLen(lines[row]);
432
+ }
433
+ else {
434
+ row = 0;
435
+ col = 0;
436
+ }
437
+ return [row, col];
438
+ }
439
+ /**
440
+ * Converts logical row/col position to absolute text offset
441
+ * Inverse operation of offsetToLogicalPos
442
+ */
443
+ export function logicalPosToOffset(lines, row, col) {
444
+ let offset = 0;
445
+ // Clamp row to valid range
446
+ const actualRow = Math.min(row, lines.length - 1);
447
+ // Add lengths of all lines before the target row
448
+ for (let i = 0; i < actualRow; i++) {
449
+ offset += cpLen(lines[i]) + 1; // +1 for newline
450
+ }
451
+ // Add column offset within the target row
452
+ if (actualRow >= 0 && actualRow < lines.length) {
453
+ offset += Math.min(col, cpLen(lines[actualRow]));
454
+ }
455
+ return offset;
456
+ }
457
+ // Calculates the visual wrapping of lines and the mapping between logical and visual coordinates.
458
+ // This is an expensive operation and should be memoized.
459
+ function calculateLayout(logicalLines, viewportWidth) {
460
+ const visualLines = [];
461
+ const logicalToVisualMap = [];
462
+ const visualToLogicalMap = [];
463
+ logicalLines.forEach((logLine, logIndex) => {
464
+ logicalToVisualMap[logIndex] = [];
465
+ if (logLine.length === 0) {
466
+ // Handle empty logical line
467
+ logicalToVisualMap[logIndex].push([visualLines.length, 0]);
468
+ visualToLogicalMap.push([logIndex, 0]);
469
+ visualLines.push('');
470
+ }
471
+ else {
472
+ // Non-empty logical line
473
+ let currentPosInLogLine = 0; // Tracks position within the current logical line (code point index)
474
+ const codePointsInLogLine = toCodePoints(logLine);
475
+ while (currentPosInLogLine < codePointsInLogLine.length) {
476
+ let currentChunk = '';
477
+ let currentChunkVisualWidth = 0;
478
+ let numCodePointsInChunk = 0;
479
+ let lastWordBreakPoint = -1; // Index in codePointsInLogLine for word break
480
+ let numCodePointsAtLastWordBreak = 0;
481
+ // Iterate through code points to build the current visual line (chunk)
482
+ for (let i = currentPosInLogLine; i < codePointsInLogLine.length; i++) {
483
+ const char = codePointsInLogLine[i];
484
+ const charVisualWidth = getCachedStringWidth(char);
485
+ if (currentChunkVisualWidth + charVisualWidth > viewportWidth) {
486
+ // Character would exceed viewport width
487
+ if (lastWordBreakPoint !== -1 &&
488
+ numCodePointsAtLastWordBreak > 0 &&
489
+ currentPosInLogLine + numCodePointsAtLastWordBreak < i) {
490
+ // We have a valid word break point to use, and it's not the start of the current segment
491
+ currentChunk = codePointsInLogLine
492
+ .slice(currentPosInLogLine, currentPosInLogLine + numCodePointsAtLastWordBreak)
493
+ .join('');
494
+ numCodePointsInChunk = numCodePointsAtLastWordBreak;
495
+ }
496
+ else {
497
+ // No word break, or word break is at the start of this potential chunk, or word break leads to empty chunk.
498
+ // Hard break: take characters up to viewportWidth, or just the current char if it alone is too wide.
499
+ if (numCodePointsInChunk === 0 &&
500
+ charVisualWidth > viewportWidth) {
501
+ // Single character is wider than viewport, take it anyway
502
+ currentChunk = char;
503
+ numCodePointsInChunk = 1;
504
+ }
505
+ else if (numCodePointsInChunk === 0 &&
506
+ charVisualWidth <= viewportWidth) {
507
+ // This case should ideally be caught by the next iteration if the char fits.
508
+ // If it doesn't fit (because currentChunkVisualWidth was already > 0 from a previous char that filled the line),
509
+ // then numCodePointsInChunk would not be 0.
510
+ // This branch means the current char *itself* doesn't fit an empty line, which is handled by the above.
511
+ // If we are here, it means the loop should break and the current chunk (which is empty) is finalized.
512
+ }
513
+ }
514
+ break; // Break from inner loop to finalize this chunk
515
+ }
516
+ currentChunk += char;
517
+ currentChunkVisualWidth += charVisualWidth;
518
+ numCodePointsInChunk++;
519
+ // Check for word break opportunity (space)
520
+ if (char === ' ') {
521
+ lastWordBreakPoint = i; // Store code point index of the space
522
+ // Store the state *before* adding the space, if we decide to break here.
523
+ numCodePointsAtLastWordBreak = numCodePointsInChunk - 1; // Chars *before* the space
524
+ }
525
+ }
526
+ // If the inner loop completed without breaking (i.e., remaining text fits)
527
+ // or if the loop broke but numCodePointsInChunk is still 0 (e.g. first char too wide for empty line)
528
+ if (numCodePointsInChunk === 0 &&
529
+ currentPosInLogLine < codePointsInLogLine.length) {
530
+ // This can happen if the very first character considered for a new visual line is wider than the viewport.
531
+ // In this case, we take that single character.
532
+ const firstChar = codePointsInLogLine[currentPosInLogLine];
533
+ currentChunk = firstChar;
534
+ numCodePointsInChunk = 1; // Ensure we advance
535
+ }
536
+ // If after everything, numCodePointsInChunk is still 0 but we haven't processed the whole logical line,
537
+ // it implies an issue, like viewportWidth being 0 or less. Avoid infinite loop.
538
+ if (numCodePointsInChunk === 0 &&
539
+ currentPosInLogLine < codePointsInLogLine.length) {
540
+ // Force advance by one character to prevent infinite loop if something went wrong
541
+ currentChunk = codePointsInLogLine[currentPosInLogLine];
542
+ numCodePointsInChunk = 1;
543
+ }
544
+ logicalToVisualMap[logIndex].push([
545
+ visualLines.length,
546
+ currentPosInLogLine,
547
+ ]);
548
+ visualToLogicalMap.push([logIndex, currentPosInLogLine]);
549
+ visualLines.push(currentChunk);
550
+ const logicalStartOfThisChunk = currentPosInLogLine;
551
+ currentPosInLogLine += numCodePointsInChunk;
552
+ // If the chunk processed did not consume the entire logical line,
553
+ // and the character immediately following the chunk is a space,
554
+ // advance past this space as it acted as a delimiter for word wrapping.
555
+ if (logicalStartOfThisChunk + numCodePointsInChunk <
556
+ codePointsInLogLine.length &&
557
+ currentPosInLogLine < codePointsInLogLine.length && // Redundant if previous is true, but safe
558
+ codePointsInLogLine[currentPosInLogLine] === ' ') {
559
+ currentPosInLogLine++;
560
+ }
561
+ }
562
+ }
563
+ });
564
+ // If the entire logical text was empty, ensure there's one empty visual line.
565
+ if (logicalLines.length === 0 ||
566
+ (logicalLines.length === 1 && logicalLines[0] === '')) {
567
+ if (visualLines.length === 0) {
568
+ visualLines.push('');
569
+ if (!logicalToVisualMap[0])
570
+ logicalToVisualMap[0] = [];
571
+ logicalToVisualMap[0].push([0, 0]);
572
+ visualToLogicalMap.push([0, 0]);
573
+ }
574
+ }
575
+ return {
576
+ visualLines,
577
+ logicalToVisualMap,
578
+ visualToLogicalMap,
579
+ };
580
+ }
581
+ // Calculates the visual cursor position based on a pre-calculated layout.
582
+ // This is a lightweight operation.
583
+ function calculateVisualCursorFromLayout(layout, logicalCursor) {
584
+ const { logicalToVisualMap, visualLines } = layout;
585
+ const [logicalRow, logicalCol] = logicalCursor;
586
+ const segmentsForLogicalLine = logicalToVisualMap[logicalRow];
587
+ if (!segmentsForLogicalLine || segmentsForLogicalLine.length === 0) {
588
+ // This can happen for an empty document.
589
+ return [0, 0];
590
+ }
591
+ // Find the segment where the logical column fits.
592
+ // The segments are sorted by startColInLogical.
593
+ let targetSegmentIndex = segmentsForLogicalLine.findIndex(([, startColInLogical], index) => {
594
+ const nextStartColInLogical = index + 1 < segmentsForLogicalLine.length
595
+ ? segmentsForLogicalLine[index + 1][1]
596
+ : Infinity;
597
+ return (logicalCol >= startColInLogical && logicalCol < nextStartColInLogical);
598
+ });
599
+ // If not found, it means the cursor is at the end of the logical line.
600
+ if (targetSegmentIndex === -1) {
601
+ if (logicalCol === 0) {
602
+ targetSegmentIndex = 0;
603
+ }
604
+ else {
605
+ targetSegmentIndex = segmentsForLogicalLine.length - 1;
606
+ }
607
+ }
608
+ const [visualRow, startColInLogical] = segmentsForLogicalLine[targetSegmentIndex];
609
+ const visualCol = logicalCol - startColInLogical;
610
+ // The visual column should not exceed the length of the visual line.
611
+ const clampedVisualCol = Math.min(visualCol, cpLen(visualLines[visualRow] ?? ''));
612
+ return [visualRow, clampedVisualCol];
613
+ }
614
+ const historyLimit = 100;
615
+ export const pushUndo = (currentState) => {
616
+ const snapshot = {
617
+ lines: [...currentState.lines],
618
+ cursorRow: currentState.cursorRow,
619
+ cursorCol: currentState.cursorCol,
620
+ };
621
+ const newStack = [...currentState.undoStack, snapshot];
622
+ if (newStack.length > historyLimit) {
623
+ newStack.shift();
624
+ }
625
+ return { ...currentState, undoStack: newStack, redoStack: [] };
626
+ };
627
+ function textBufferReducerLogic(state, action) {
628
+ const pushUndoLocal = pushUndo;
629
+ const currentLine = (r) => state.lines[r] ?? '';
630
+ const currentLineLen = (r) => cpLen(currentLine(r));
631
+ switch (action.type) {
632
+ case 'set_text': {
633
+ let nextState = state;
634
+ if (action.pushToUndo !== false) {
635
+ nextState = pushUndoLocal(state);
636
+ }
637
+ const newContentLines = action.payload
638
+ .replace(/\r\n?/g, '\n')
639
+ .split('\n');
640
+ const lines = newContentLines.length === 0 ? [''] : newContentLines;
641
+ const lastNewLineIndex = lines.length - 1;
642
+ return {
643
+ ...nextState,
644
+ lines,
645
+ cursorRow: lastNewLineIndex,
646
+ cursorCol: cpLen(lines[lastNewLineIndex] ?? ''),
647
+ preferredCol: null,
648
+ };
649
+ }
650
+ case 'insert': {
651
+ const nextState = pushUndoLocal(state);
652
+ const newLines = [...nextState.lines];
653
+ let newCursorRow = nextState.cursorRow;
654
+ let newCursorCol = nextState.cursorCol;
655
+ const currentLine = (r) => newLines[r] ?? '';
656
+ const str = stripUnsafeCharacters(action.payload.replace(/\r\n/g, '\n').replace(/\r/g, '\n'));
657
+ const parts = str.split('\n');
658
+ const lineContent = currentLine(newCursorRow);
659
+ const before = cpSlice(lineContent, 0, newCursorCol);
660
+ const after = cpSlice(lineContent, newCursorCol);
661
+ if (parts.length > 1) {
662
+ newLines[newCursorRow] = before + parts[0];
663
+ const remainingParts = parts.slice(1);
664
+ const lastPartOriginal = remainingParts.pop() ?? '';
665
+ newLines.splice(newCursorRow + 1, 0, ...remainingParts);
666
+ newLines.splice(newCursorRow + parts.length - 1, 0, lastPartOriginal + after);
667
+ newCursorRow = newCursorRow + parts.length - 1;
668
+ newCursorCol = cpLen(lastPartOriginal);
669
+ }
670
+ else {
671
+ newLines[newCursorRow] = before + parts[0] + after;
672
+ newCursorCol = cpLen(before) + cpLen(parts[0]);
673
+ }
674
+ return {
675
+ ...nextState,
676
+ lines: newLines,
677
+ cursorRow: newCursorRow,
678
+ cursorCol: newCursorCol,
679
+ preferredCol: null,
680
+ };
681
+ }
682
+ case 'backspace': {
683
+ const nextState = pushUndoLocal(state);
684
+ const newLines = [...nextState.lines];
685
+ let newCursorRow = nextState.cursorRow;
686
+ let newCursorCol = nextState.cursorCol;
687
+ const currentLine = (r) => newLines[r] ?? '';
688
+ if (newCursorCol === 0 && newCursorRow === 0)
689
+ return state;
690
+ if (newCursorCol > 0) {
691
+ const lineContent = currentLine(newCursorRow);
692
+ newLines[newCursorRow] =
693
+ cpSlice(lineContent, 0, newCursorCol - 1) +
694
+ cpSlice(lineContent, newCursorCol);
695
+ newCursorCol--;
696
+ }
697
+ else if (newCursorRow > 0) {
698
+ const prevLineContent = currentLine(newCursorRow - 1);
699
+ const currentLineContentVal = currentLine(newCursorRow);
700
+ const newCol = cpLen(prevLineContent);
701
+ newLines[newCursorRow - 1] = prevLineContent + currentLineContentVal;
702
+ newLines.splice(newCursorRow, 1);
703
+ newCursorRow--;
704
+ newCursorCol = newCol;
705
+ }
706
+ return {
707
+ ...nextState,
708
+ lines: newLines,
709
+ cursorRow: newCursorRow,
710
+ cursorCol: newCursorCol,
711
+ preferredCol: null,
712
+ };
713
+ }
714
+ case 'set_viewport': {
715
+ const { width, height } = action.payload;
716
+ if (width === state.viewportWidth && height === state.viewportHeight) {
717
+ return state;
718
+ }
719
+ return {
720
+ ...state,
721
+ viewportWidth: width,
722
+ viewportHeight: height,
723
+ };
724
+ }
725
+ case 'move': {
726
+ const { dir } = action.payload;
727
+ const { cursorRow, cursorCol, lines, visualLayout, preferredCol } = state;
728
+ // Visual movements
729
+ if (dir === 'left' ||
730
+ dir === 'right' ||
731
+ dir === 'up' ||
732
+ dir === 'down' ||
733
+ dir === 'home' ||
734
+ dir === 'end') {
735
+ const visualCursor = calculateVisualCursorFromLayout(visualLayout, [
736
+ cursorRow,
737
+ cursorCol,
738
+ ]);
739
+ const { visualLines, visualToLogicalMap } = visualLayout;
740
+ let newVisualRow = visualCursor[0];
741
+ let newVisualCol = visualCursor[1];
742
+ let newPreferredCol = preferredCol;
743
+ const currentVisLineLen = cpLen(visualLines[newVisualRow] ?? '');
744
+ switch (dir) {
745
+ case 'left':
746
+ newPreferredCol = null;
747
+ if (newVisualCol > 0) {
748
+ newVisualCol--;
749
+ }
750
+ else if (newVisualRow > 0) {
751
+ newVisualRow--;
752
+ newVisualCol = cpLen(visualLines[newVisualRow] ?? '');
753
+ }
754
+ break;
755
+ case 'right':
756
+ newPreferredCol = null;
757
+ if (newVisualCol < currentVisLineLen) {
758
+ newVisualCol++;
759
+ }
760
+ else if (newVisualRow < visualLines.length - 1) {
761
+ newVisualRow++;
762
+ newVisualCol = 0;
763
+ }
764
+ break;
765
+ case 'up':
766
+ if (newVisualRow > 0) {
767
+ if (newPreferredCol === null)
768
+ newPreferredCol = newVisualCol;
769
+ newVisualRow--;
770
+ newVisualCol = clamp(newPreferredCol, 0, cpLen(visualLines[newVisualRow] ?? ''));
771
+ }
772
+ break;
773
+ case 'down':
774
+ if (newVisualRow < visualLines.length - 1) {
775
+ if (newPreferredCol === null)
776
+ newPreferredCol = newVisualCol;
777
+ newVisualRow++;
778
+ newVisualCol = clamp(newPreferredCol, 0, cpLen(visualLines[newVisualRow] ?? ''));
779
+ }
780
+ break;
781
+ case 'home':
782
+ newPreferredCol = null;
783
+ newVisualCol = 0;
784
+ break;
785
+ case 'end':
786
+ newPreferredCol = null;
787
+ newVisualCol = currentVisLineLen;
788
+ break;
789
+ default: {
790
+ const exhaustiveCheck = dir;
791
+ console.error(`Unknown visual movement direction: ${exhaustiveCheck}`);
792
+ return state;
793
+ }
794
+ }
795
+ if (visualToLogicalMap[newVisualRow]) {
796
+ const [logRow, logStartCol] = visualToLogicalMap[newVisualRow];
797
+ return {
798
+ ...state,
799
+ cursorRow: logRow,
800
+ cursorCol: clamp(logStartCol + newVisualCol, 0, cpLen(lines[logRow] ?? '')),
801
+ preferredCol: newPreferredCol,
802
+ };
803
+ }
804
+ return state;
805
+ }
806
+ // Logical movements
807
+ switch (dir) {
808
+ case 'wordLeft': {
809
+ if (cursorCol === 0 && cursorRow === 0)
810
+ return state;
811
+ let newCursorRow = cursorRow;
812
+ let newCursorCol = cursorCol;
813
+ if (cursorCol === 0) {
814
+ newCursorRow--;
815
+ newCursorCol = cpLen(lines[newCursorRow] ?? '');
816
+ }
817
+ else {
818
+ const lineContent = lines[cursorRow];
819
+ const arr = toCodePoints(lineContent);
820
+ let start = cursorCol;
821
+ let onlySpaces = true;
822
+ for (let i = 0; i < start; i++) {
823
+ if (isWordChar(arr[i])) {
824
+ onlySpaces = false;
825
+ break;
826
+ }
827
+ }
828
+ if (onlySpaces && start > 0) {
829
+ start--;
830
+ }
831
+ else {
832
+ while (start > 0 && !isWordChar(arr[start - 1]))
833
+ start--;
834
+ while (start > 0 && isWordChar(arr[start - 1]))
835
+ start--;
836
+ }
837
+ newCursorCol = start;
838
+ }
839
+ return {
840
+ ...state,
841
+ cursorRow: newCursorRow,
842
+ cursorCol: newCursorCol,
843
+ preferredCol: null,
844
+ };
845
+ }
846
+ case 'wordRight': {
847
+ if (cursorRow === lines.length - 1 &&
848
+ cursorCol === cpLen(lines[cursorRow] ?? '')) {
849
+ return state;
850
+ }
851
+ let newCursorRow = cursorRow;
852
+ let newCursorCol = cursorCol;
853
+ const lineContent = lines[cursorRow] ?? '';
854
+ const arr = toCodePoints(lineContent);
855
+ if (cursorCol >= arr.length) {
856
+ newCursorRow++;
857
+ newCursorCol = 0;
858
+ }
859
+ else {
860
+ let end = cursorCol;
861
+ while (end < arr.length && !isWordChar(arr[end]))
862
+ end++;
863
+ while (end < arr.length && isWordChar(arr[end]))
864
+ end++;
865
+ newCursorCol = end;
866
+ }
867
+ return {
868
+ ...state,
869
+ cursorRow: newCursorRow,
870
+ cursorCol: newCursorCol,
871
+ preferredCol: null,
872
+ };
873
+ }
874
+ default:
875
+ return state;
876
+ }
877
+ }
878
+ case 'set_cursor': {
879
+ return {
880
+ ...state,
881
+ ...action.payload,
882
+ };
883
+ }
884
+ case 'delete': {
885
+ const { cursorRow, cursorCol, lines } = state;
886
+ const lineContent = currentLine(cursorRow);
887
+ if (cursorCol < currentLineLen(cursorRow)) {
888
+ const nextState = pushUndoLocal(state);
889
+ const newLines = [...nextState.lines];
890
+ newLines[cursorRow] =
891
+ cpSlice(lineContent, 0, cursorCol) +
892
+ cpSlice(lineContent, cursorCol + 1);
893
+ return {
894
+ ...nextState,
895
+ lines: newLines,
896
+ preferredCol: null,
897
+ };
898
+ }
899
+ else if (cursorRow < lines.length - 1) {
900
+ const nextState = pushUndoLocal(state);
901
+ const nextLineContent = currentLine(cursorRow + 1);
902
+ const newLines = [...nextState.lines];
903
+ newLines[cursorRow] = lineContent + nextLineContent;
904
+ newLines.splice(cursorRow + 1, 1);
905
+ return {
906
+ ...nextState,
907
+ lines: newLines,
908
+ preferredCol: null,
909
+ };
910
+ }
911
+ return state;
912
+ }
913
+ case 'delete_word_left': {
914
+ const { cursorRow, cursorCol } = state;
915
+ if (cursorCol === 0 && cursorRow === 0)
916
+ return state;
917
+ const nextState = pushUndoLocal(state);
918
+ const newLines = [...nextState.lines];
919
+ let newCursorRow = cursorRow;
920
+ let newCursorCol = cursorCol;
921
+ if (newCursorCol > 0) {
922
+ const lineContent = currentLine(newCursorRow);
923
+ const prevWordStart = findPrevWordStartInLine(lineContent, newCursorCol);
924
+ const start = prevWordStart === null ? 0 : prevWordStart;
925
+ newLines[newCursorRow] =
926
+ cpSlice(lineContent, 0, start) + cpSlice(lineContent, newCursorCol);
927
+ newCursorCol = start;
928
+ }
929
+ else {
930
+ // Act as a backspace
931
+ const prevLineContent = currentLine(cursorRow - 1);
932
+ const currentLineContentVal = currentLine(cursorRow);
933
+ const newCol = cpLen(prevLineContent);
934
+ newLines[cursorRow - 1] = prevLineContent + currentLineContentVal;
935
+ newLines.splice(cursorRow, 1);
936
+ newCursorRow--;
937
+ newCursorCol = newCol;
938
+ }
939
+ return {
940
+ ...nextState,
941
+ lines: newLines,
942
+ cursorRow: newCursorRow,
943
+ cursorCol: newCursorCol,
944
+ preferredCol: null,
945
+ };
946
+ }
947
+ case 'delete_word_right': {
948
+ const { cursorRow, cursorCol, lines } = state;
949
+ const lineContent = currentLine(cursorRow);
950
+ const lineLen = cpLen(lineContent);
951
+ if (cursorCol >= lineLen && cursorRow === lines.length - 1) {
952
+ return state;
953
+ }
954
+ const nextState = pushUndoLocal(state);
955
+ const newLines = [...nextState.lines];
956
+ if (cursorCol >= lineLen) {
957
+ // Act as a delete, joining with the next line
958
+ const nextLineContent = currentLine(cursorRow + 1);
959
+ newLines[cursorRow] = lineContent + nextLineContent;
960
+ newLines.splice(cursorRow + 1, 1);
961
+ }
962
+ else {
963
+ const nextWordStart = findNextWordStartInLine(lineContent, cursorCol);
964
+ const end = nextWordStart === null ? lineLen : nextWordStart;
965
+ newLines[cursorRow] =
966
+ cpSlice(lineContent, 0, cursorCol) + cpSlice(lineContent, end);
967
+ }
968
+ return {
969
+ ...nextState,
970
+ lines: newLines,
971
+ preferredCol: null,
972
+ };
973
+ }
974
+ case 'kill_line_right': {
975
+ const { cursorRow, cursorCol, lines } = state;
976
+ const lineContent = currentLine(cursorRow);
977
+ if (cursorCol < currentLineLen(cursorRow)) {
978
+ const nextState = pushUndoLocal(state);
979
+ const newLines = [...nextState.lines];
980
+ newLines[cursorRow] = cpSlice(lineContent, 0, cursorCol);
981
+ return {
982
+ ...nextState,
983
+ lines: newLines,
984
+ };
985
+ }
986
+ else if (cursorRow < lines.length - 1) {
987
+ // Act as a delete
988
+ const nextState = pushUndoLocal(state);
989
+ const nextLineContent = currentLine(cursorRow + 1);
990
+ const newLines = [...nextState.lines];
991
+ newLines[cursorRow] = lineContent + nextLineContent;
992
+ newLines.splice(cursorRow + 1, 1);
993
+ return {
994
+ ...nextState,
995
+ lines: newLines,
996
+ preferredCol: null,
997
+ };
998
+ }
999
+ return state;
1000
+ }
1001
+ case 'kill_line_left': {
1002
+ const { cursorRow, cursorCol } = state;
1003
+ if (cursorCol > 0) {
1004
+ const nextState = pushUndoLocal(state);
1005
+ const lineContent = currentLine(cursorRow);
1006
+ const newLines = [...nextState.lines];
1007
+ newLines[cursorRow] = cpSlice(lineContent, cursorCol);
1008
+ return {
1009
+ ...nextState,
1010
+ lines: newLines,
1011
+ cursorCol: 0,
1012
+ preferredCol: null,
1013
+ };
1014
+ }
1015
+ return state;
1016
+ }
1017
+ case 'undo': {
1018
+ const stateToRestore = state.undoStack[state.undoStack.length - 1];
1019
+ if (!stateToRestore)
1020
+ return state;
1021
+ const currentSnapshot = {
1022
+ lines: [...state.lines],
1023
+ cursorRow: state.cursorRow,
1024
+ cursorCol: state.cursorCol,
1025
+ };
1026
+ return {
1027
+ ...state,
1028
+ ...stateToRestore,
1029
+ undoStack: state.undoStack.slice(0, -1),
1030
+ redoStack: [...state.redoStack, currentSnapshot],
1031
+ };
1032
+ }
1033
+ case 'redo': {
1034
+ const stateToRestore = state.redoStack[state.redoStack.length - 1];
1035
+ if (!stateToRestore)
1036
+ return state;
1037
+ const currentSnapshot = {
1038
+ lines: [...state.lines],
1039
+ cursorRow: state.cursorRow,
1040
+ cursorCol: state.cursorCol,
1041
+ };
1042
+ return {
1043
+ ...state,
1044
+ ...stateToRestore,
1045
+ redoStack: state.redoStack.slice(0, -1),
1046
+ undoStack: [...state.undoStack, currentSnapshot],
1047
+ };
1048
+ }
1049
+ case 'replace_range': {
1050
+ const { startRow, startCol, endRow, endCol, text } = action.payload;
1051
+ const nextState = pushUndoLocal(state);
1052
+ return replaceRangeInternal(nextState, startRow, startCol, endRow, endCol, text);
1053
+ }
1054
+ case 'move_to_offset': {
1055
+ const { offset } = action.payload;
1056
+ const [newRow, newCol] = offsetToLogicalPos(state.lines.join('\n'), offset);
1057
+ return {
1058
+ ...state,
1059
+ cursorRow: newRow,
1060
+ cursorCol: newCol,
1061
+ preferredCol: null,
1062
+ };
1063
+ }
1064
+ case 'create_undo_snapshot': {
1065
+ return pushUndoLocal(state);
1066
+ }
1067
+ // Vim-specific operations
1068
+ case 'vim_delete_word_forward':
1069
+ case 'vim_delete_word_backward':
1070
+ case 'vim_delete_word_end':
1071
+ case 'vim_change_word_forward':
1072
+ case 'vim_change_word_backward':
1073
+ case 'vim_change_word_end':
1074
+ case 'vim_delete_line':
1075
+ case 'vim_change_line':
1076
+ case 'vim_delete_to_end_of_line':
1077
+ case 'vim_change_to_end_of_line':
1078
+ case 'vim_change_movement':
1079
+ case 'vim_move_left':
1080
+ case 'vim_move_right':
1081
+ case 'vim_move_up':
1082
+ case 'vim_move_down':
1083
+ case 'vim_move_word_forward':
1084
+ case 'vim_move_word_backward':
1085
+ case 'vim_move_word_end':
1086
+ case 'vim_delete_char':
1087
+ case 'vim_insert_at_cursor':
1088
+ case 'vim_append_at_cursor':
1089
+ case 'vim_open_line_below':
1090
+ case 'vim_open_line_above':
1091
+ case 'vim_append_at_line_end':
1092
+ case 'vim_insert_at_line_start':
1093
+ case 'vim_move_to_line_start':
1094
+ case 'vim_move_to_line_end':
1095
+ case 'vim_move_to_first_nonwhitespace':
1096
+ case 'vim_move_to_first_line':
1097
+ case 'vim_move_to_last_line':
1098
+ case 'vim_move_to_line':
1099
+ case 'vim_escape_insert_mode':
1100
+ return handleVimAction(state, action);
1101
+ default: {
1102
+ const exhaustiveCheck = action;
1103
+ console.error(`Unknown action encountered: ${exhaustiveCheck}`);
1104
+ return state;
1105
+ }
1106
+ }
1107
+ }
1108
+ export function textBufferReducer(state, action) {
1109
+ const newState = textBufferReducerLogic(state, action);
1110
+ if (newState.lines !== state.lines ||
1111
+ newState.viewportWidth !== state.viewportWidth) {
1112
+ return {
1113
+ ...newState,
1114
+ visualLayout: calculateLayout(newState.lines, newState.viewportWidth),
1115
+ };
1116
+ }
1117
+ return newState;
1118
+ }
1119
+ // --- End of reducer logic ---
1120
+ export function useTextBuffer({ initialText = '', initialCursorOffset = 0, viewport, stdin, setRawMode, onChange, isValidPath, shellModeActive = false, }) {
1121
+ const initialState = useMemo(() => {
1122
+ const lines = initialText.split('\n');
1123
+ const [initialCursorRow, initialCursorCol] = calculateInitialCursorPosition(lines.length === 0 ? [''] : lines, initialCursorOffset);
1124
+ const visualLayout = calculateLayout(lines.length === 0 ? [''] : lines, viewport.width);
1125
+ return {
1126
+ lines: lines.length === 0 ? [''] : lines,
1127
+ cursorRow: initialCursorRow,
1128
+ cursorCol: initialCursorCol,
1129
+ preferredCol: null,
1130
+ undoStack: [],
1131
+ redoStack: [],
1132
+ clipboard: null,
1133
+ selectionAnchor: null,
1134
+ viewportWidth: viewport.width,
1135
+ viewportHeight: viewport.height,
1136
+ visualLayout,
1137
+ };
1138
+ }, [initialText, initialCursorOffset, viewport.width, viewport.height]);
1139
+ const [state, dispatch] = useReducer(textBufferReducer, initialState);
1140
+ const { lines, cursorRow, cursorCol, preferredCol, selectionAnchor, visualLayout, } = state;
1141
+ const text = useMemo(() => lines.join('\n'), [lines]);
1142
+ const visualCursor = useMemo(() => calculateVisualCursorFromLayout(visualLayout, [cursorRow, cursorCol]), [visualLayout, cursorRow, cursorCol]);
1143
+ const { visualLines, visualToLogicalMap } = visualLayout;
1144
+ const [visualScrollRow, setVisualScrollRow] = useState(0);
1145
+ useEffect(() => {
1146
+ if (onChange) {
1147
+ onChange(text);
1148
+ }
1149
+ }, [text, onChange]);
1150
+ useEffect(() => {
1151
+ dispatch({
1152
+ type: 'set_viewport',
1153
+ payload: { width: viewport.width, height: viewport.height },
1154
+ });
1155
+ }, [viewport.width, viewport.height]);
1156
+ // Update visual scroll (vertical)
1157
+ useEffect(() => {
1158
+ const { height } = viewport;
1159
+ const totalVisualLines = visualLines.length;
1160
+ const maxScrollStart = Math.max(0, totalVisualLines - height);
1161
+ let newVisualScrollRow = visualScrollRow;
1162
+ if (visualCursor[0] < visualScrollRow) {
1163
+ newVisualScrollRow = visualCursor[0];
1164
+ }
1165
+ else if (visualCursor[0] >= visualScrollRow + height) {
1166
+ newVisualScrollRow = visualCursor[0] - height + 1;
1167
+ }
1168
+ // When the number of visual lines shrinks (e.g., after widening the viewport),
1169
+ // ensure scroll never starts beyond the last valid start so we can render a full window.
1170
+ newVisualScrollRow = clamp(newVisualScrollRow, 0, maxScrollStart);
1171
+ if (newVisualScrollRow !== visualScrollRow) {
1172
+ setVisualScrollRow(newVisualScrollRow);
1173
+ }
1174
+ }, [visualCursor, visualScrollRow, viewport, visualLines.length]);
1175
+ const insert = useCallback((ch, { paste = false } = {}) => {
1176
+ if (/[\n\r]/.test(ch)) {
1177
+ dispatch({ type: 'insert', payload: ch });
1178
+ return;
1179
+ }
1180
+ const minLengthToInferAsDragDrop = 3;
1181
+ if (ch.length >= minLengthToInferAsDragDrop &&
1182
+ !shellModeActive &&
1183
+ paste) {
1184
+ let potentialPath = ch.trim();
1185
+ const quoteMatch = potentialPath.match(/^'(.*)'$/);
1186
+ if (quoteMatch) {
1187
+ potentialPath = quoteMatch[1];
1188
+ }
1189
+ potentialPath = potentialPath.trim();
1190
+ if (isValidPath(unescapePath(potentialPath))) {
1191
+ ch = `@${potentialPath} `;
1192
+ }
1193
+ }
1194
+ let currentText = '';
1195
+ for (const char of toCodePoints(ch)) {
1196
+ if (char.codePointAt(0) === 127) {
1197
+ if (currentText.length > 0) {
1198
+ dispatch({ type: 'insert', payload: currentText });
1199
+ currentText = '';
1200
+ }
1201
+ dispatch({ type: 'backspace' });
1202
+ }
1203
+ else {
1204
+ currentText += char;
1205
+ }
1206
+ }
1207
+ if (currentText.length > 0) {
1208
+ dispatch({ type: 'insert', payload: currentText });
1209
+ }
1210
+ }, [isValidPath, shellModeActive]);
1211
+ const newline = useCallback(() => {
1212
+ dispatch({ type: 'insert', payload: '\n' });
1213
+ }, []);
1214
+ const backspace = useCallback(() => {
1215
+ dispatch({ type: 'backspace' });
1216
+ }, []);
1217
+ const del = useCallback(() => {
1218
+ dispatch({ type: 'delete' });
1219
+ }, []);
1220
+ const move = useCallback((dir) => {
1221
+ dispatch({ type: 'move', payload: { dir } });
1222
+ }, [dispatch]);
1223
+ const undo = useCallback(() => {
1224
+ dispatch({ type: 'undo' });
1225
+ }, []);
1226
+ const redo = useCallback(() => {
1227
+ dispatch({ type: 'redo' });
1228
+ }, []);
1229
+ const setText = useCallback((newText) => {
1230
+ dispatch({ type: 'set_text', payload: newText });
1231
+ }, []);
1232
+ const deleteWordLeft = useCallback(() => {
1233
+ dispatch({ type: 'delete_word_left' });
1234
+ }, []);
1235
+ const deleteWordRight = useCallback(() => {
1236
+ dispatch({ type: 'delete_word_right' });
1237
+ }, []);
1238
+ const killLineRight = useCallback(() => {
1239
+ dispatch({ type: 'kill_line_right' });
1240
+ }, []);
1241
+ const killLineLeft = useCallback(() => {
1242
+ dispatch({ type: 'kill_line_left' });
1243
+ }, []);
1244
+ // Vim-specific operations
1245
+ const vimDeleteWordForward = useCallback((count) => {
1246
+ dispatch({ type: 'vim_delete_word_forward', payload: { count } });
1247
+ }, []);
1248
+ const vimDeleteWordBackward = useCallback((count) => {
1249
+ dispatch({ type: 'vim_delete_word_backward', payload: { count } });
1250
+ }, []);
1251
+ const vimDeleteWordEnd = useCallback((count) => {
1252
+ dispatch({ type: 'vim_delete_word_end', payload: { count } });
1253
+ }, []);
1254
+ const vimChangeWordForward = useCallback((count) => {
1255
+ dispatch({ type: 'vim_change_word_forward', payload: { count } });
1256
+ }, []);
1257
+ const vimChangeWordBackward = useCallback((count) => {
1258
+ dispatch({ type: 'vim_change_word_backward', payload: { count } });
1259
+ }, []);
1260
+ const vimChangeWordEnd = useCallback((count) => {
1261
+ dispatch({ type: 'vim_change_word_end', payload: { count } });
1262
+ }, []);
1263
+ const vimDeleteLine = useCallback((count) => {
1264
+ dispatch({ type: 'vim_delete_line', payload: { count } });
1265
+ }, []);
1266
+ const vimChangeLine = useCallback((count) => {
1267
+ dispatch({ type: 'vim_change_line', payload: { count } });
1268
+ }, []);
1269
+ const vimDeleteToEndOfLine = useCallback(() => {
1270
+ dispatch({ type: 'vim_delete_to_end_of_line' });
1271
+ }, []);
1272
+ const vimChangeToEndOfLine = useCallback(() => {
1273
+ dispatch({ type: 'vim_change_to_end_of_line' });
1274
+ }, []);
1275
+ const vimChangeMovement = useCallback((movement, count) => {
1276
+ dispatch({ type: 'vim_change_movement', payload: { movement, count } });
1277
+ }, []);
1278
+ // New vim navigation and operation methods
1279
+ const vimMoveLeft = useCallback((count) => {
1280
+ dispatch({ type: 'vim_move_left', payload: { count } });
1281
+ }, []);
1282
+ const vimMoveRight = useCallback((count) => {
1283
+ dispatch({ type: 'vim_move_right', payload: { count } });
1284
+ }, []);
1285
+ const vimMoveUp = useCallback((count) => {
1286
+ dispatch({ type: 'vim_move_up', payload: { count } });
1287
+ }, []);
1288
+ const vimMoveDown = useCallback((count) => {
1289
+ dispatch({ type: 'vim_move_down', payload: { count } });
1290
+ }, []);
1291
+ const vimMoveWordForward = useCallback((count) => {
1292
+ dispatch({ type: 'vim_move_word_forward', payload: { count } });
1293
+ }, []);
1294
+ const vimMoveWordBackward = useCallback((count) => {
1295
+ dispatch({ type: 'vim_move_word_backward', payload: { count } });
1296
+ }, []);
1297
+ const vimMoveWordEnd = useCallback((count) => {
1298
+ dispatch({ type: 'vim_move_word_end', payload: { count } });
1299
+ }, []);
1300
+ const vimDeleteChar = useCallback((count) => {
1301
+ dispatch({ type: 'vim_delete_char', payload: { count } });
1302
+ }, []);
1303
+ const vimInsertAtCursor = useCallback(() => {
1304
+ dispatch({ type: 'vim_insert_at_cursor' });
1305
+ }, []);
1306
+ const vimAppendAtCursor = useCallback(() => {
1307
+ dispatch({ type: 'vim_append_at_cursor' });
1308
+ }, []);
1309
+ const vimOpenLineBelow = useCallback(() => {
1310
+ dispatch({ type: 'vim_open_line_below' });
1311
+ }, []);
1312
+ const vimOpenLineAbove = useCallback(() => {
1313
+ dispatch({ type: 'vim_open_line_above' });
1314
+ }, []);
1315
+ const vimAppendAtLineEnd = useCallback(() => {
1316
+ dispatch({ type: 'vim_append_at_line_end' });
1317
+ }, []);
1318
+ const vimInsertAtLineStart = useCallback(() => {
1319
+ dispatch({ type: 'vim_insert_at_line_start' });
1320
+ }, []);
1321
+ const vimMoveToLineStart = useCallback(() => {
1322
+ dispatch({ type: 'vim_move_to_line_start' });
1323
+ }, []);
1324
+ const vimMoveToLineEnd = useCallback(() => {
1325
+ dispatch({ type: 'vim_move_to_line_end' });
1326
+ }, []);
1327
+ const vimMoveToFirstNonWhitespace = useCallback(() => {
1328
+ dispatch({ type: 'vim_move_to_first_nonwhitespace' });
1329
+ }, []);
1330
+ const vimMoveToFirstLine = useCallback(() => {
1331
+ dispatch({ type: 'vim_move_to_first_line' });
1332
+ }, []);
1333
+ const vimMoveToLastLine = useCallback(() => {
1334
+ dispatch({ type: 'vim_move_to_last_line' });
1335
+ }, []);
1336
+ const vimMoveToLine = useCallback((lineNumber) => {
1337
+ dispatch({ type: 'vim_move_to_line', payload: { lineNumber } });
1338
+ }, []);
1339
+ const vimEscapeInsertMode = useCallback(() => {
1340
+ dispatch({ type: 'vim_escape_insert_mode' });
1341
+ }, []);
1342
+ const openInExternalEditor = useCallback(async (opts = {}) => {
1343
+ const editor = opts.editor ??
1344
+ process.env['VISUAL'] ??
1345
+ process.env['EDITOR'] ??
1346
+ (process.platform === 'win32' ? 'notepad' : 'vi');
1347
+ const tmpDir = fs.mkdtempSync(pathMod.join(os.tmpdir(), 'gemini-edit-'));
1348
+ const filePath = pathMod.join(tmpDir, 'buffer.txt');
1349
+ fs.writeFileSync(filePath, text, 'utf8');
1350
+ dispatch({ type: 'create_undo_snapshot' });
1351
+ const wasRaw = stdin?.isRaw ?? false;
1352
+ try {
1353
+ setRawMode?.(false);
1354
+ const { status, error } = spawnSync(editor, [filePath], {
1355
+ stdio: 'inherit',
1356
+ });
1357
+ if (error)
1358
+ throw error;
1359
+ if (typeof status === 'number' && status !== 0)
1360
+ throw new Error(`External editor exited with status ${status}`);
1361
+ let newText = fs.readFileSync(filePath, 'utf8');
1362
+ newText = newText.replace(/\r\n?/g, '\n');
1363
+ dispatch({ type: 'set_text', payload: newText, pushToUndo: false });
1364
+ }
1365
+ catch (err) {
1366
+ console.error('[useTextBuffer] external editor error', err);
1367
+ }
1368
+ finally {
1369
+ if (wasRaw)
1370
+ setRawMode?.(true);
1371
+ try {
1372
+ fs.unlinkSync(filePath);
1373
+ }
1374
+ catch {
1375
+ /* ignore */
1376
+ }
1377
+ try {
1378
+ fs.rmdirSync(tmpDir);
1379
+ }
1380
+ catch {
1381
+ /* ignore */
1382
+ }
1383
+ }
1384
+ }, [text, stdin, setRawMode]);
1385
+ const handleInput = useCallback((key) => {
1386
+ const { sequence: input } = key;
1387
+ if (key.paste) {
1388
+ // Do not do any other processing on pastes so ensure we handle them
1389
+ // before all other cases.
1390
+ insert(input, { paste: key.paste });
1391
+ return;
1392
+ }
1393
+ if (key.name === 'return' ||
1394
+ input === '\r' ||
1395
+ input === '\n' ||
1396
+ input === '\\\r' // VSCode terminal represents shift + enter this way
1397
+ )
1398
+ newline();
1399
+ else if (key.name === 'left' && !key.meta && !key.ctrl)
1400
+ move('left');
1401
+ else if (key.ctrl && key.name === 'b')
1402
+ move('left');
1403
+ else if (key.name === 'right' && !key.meta && !key.ctrl)
1404
+ move('right');
1405
+ else if (key.ctrl && key.name === 'f')
1406
+ move('right');
1407
+ else if (key.name === 'up')
1408
+ move('up');
1409
+ else if (key.name === 'down')
1410
+ move('down');
1411
+ else if ((key.ctrl || key.meta) && key.name === 'left')
1412
+ move('wordLeft');
1413
+ else if (key.meta && key.name === 'b')
1414
+ move('wordLeft');
1415
+ else if ((key.ctrl || key.meta) && key.name === 'right')
1416
+ move('wordRight');
1417
+ else if (key.meta && key.name === 'f')
1418
+ move('wordRight');
1419
+ else if (key.name === 'home')
1420
+ move('home');
1421
+ else if (key.ctrl && key.name === 'a')
1422
+ move('home');
1423
+ else if (key.name === 'end')
1424
+ move('end');
1425
+ else if (key.ctrl && key.name === 'e')
1426
+ move('end');
1427
+ else if (key.ctrl && key.name === 'w')
1428
+ deleteWordLeft();
1429
+ else if ((key.meta || key.ctrl) &&
1430
+ (key.name === 'backspace' || input === '\x7f'))
1431
+ deleteWordLeft();
1432
+ else if ((key.meta || key.ctrl) && key.name === 'delete')
1433
+ deleteWordRight();
1434
+ else if (key.name === 'backspace' ||
1435
+ input === '\x7f' ||
1436
+ (key.ctrl && key.name === 'h'))
1437
+ backspace();
1438
+ else if (key.name === 'delete' || (key.ctrl && key.name === 'd'))
1439
+ del();
1440
+ else if (key.ctrl && !key.shift && key.name === 'z')
1441
+ undo();
1442
+ else if (key.ctrl && key.shift && key.name === 'z')
1443
+ redo();
1444
+ else if (input && !key.ctrl && !key.meta) {
1445
+ insert(input, { paste: key.paste });
1446
+ }
1447
+ }, [
1448
+ newline,
1449
+ move,
1450
+ deleteWordLeft,
1451
+ deleteWordRight,
1452
+ backspace,
1453
+ del,
1454
+ insert,
1455
+ undo,
1456
+ redo,
1457
+ ]);
1458
+ const renderedVisualLines = useMemo(() => visualLines.slice(visualScrollRow, visualScrollRow + viewport.height), [visualLines, visualScrollRow, viewport.height]);
1459
+ const replaceRange = useCallback((startRow, startCol, endRow, endCol, text) => {
1460
+ dispatch({
1461
+ type: 'replace_range',
1462
+ payload: { startRow, startCol, endRow, endCol, text },
1463
+ });
1464
+ }, []);
1465
+ const replaceRangeByOffset = useCallback((startOffset, endOffset, replacementText) => {
1466
+ const [startRow, startCol] = offsetToLogicalPos(text, startOffset);
1467
+ const [endRow, endCol] = offsetToLogicalPos(text, endOffset);
1468
+ replaceRange(startRow, startCol, endRow, endCol, replacementText);
1469
+ }, [text, replaceRange]);
1470
+ const moveToOffset = useCallback((offset) => {
1471
+ dispatch({ type: 'move_to_offset', payload: { offset } });
1472
+ }, []);
1473
+ const returnValue = useMemo(() => ({
1474
+ lines,
1475
+ text,
1476
+ cursor: [cursorRow, cursorCol],
1477
+ preferredCol,
1478
+ selectionAnchor,
1479
+ allVisualLines: visualLines,
1480
+ viewportVisualLines: renderedVisualLines,
1481
+ visualCursor,
1482
+ visualScrollRow,
1483
+ visualToLogicalMap,
1484
+ setText,
1485
+ insert,
1486
+ newline,
1487
+ backspace,
1488
+ del,
1489
+ move,
1490
+ undo,
1491
+ redo,
1492
+ replaceRange,
1493
+ replaceRangeByOffset,
1494
+ moveToOffset,
1495
+ deleteWordLeft,
1496
+ deleteWordRight,
1497
+ killLineRight,
1498
+ killLineLeft,
1499
+ handleInput,
1500
+ openInExternalEditor,
1501
+ // Vim-specific operations
1502
+ vimDeleteWordForward,
1503
+ vimDeleteWordBackward,
1504
+ vimDeleteWordEnd,
1505
+ vimChangeWordForward,
1506
+ vimChangeWordBackward,
1507
+ vimChangeWordEnd,
1508
+ vimDeleteLine,
1509
+ vimChangeLine,
1510
+ vimDeleteToEndOfLine,
1511
+ vimChangeToEndOfLine,
1512
+ vimChangeMovement,
1513
+ vimMoveLeft,
1514
+ vimMoveRight,
1515
+ vimMoveUp,
1516
+ vimMoveDown,
1517
+ vimMoveWordForward,
1518
+ vimMoveWordBackward,
1519
+ vimMoveWordEnd,
1520
+ vimDeleteChar,
1521
+ vimInsertAtCursor,
1522
+ vimAppendAtCursor,
1523
+ vimOpenLineBelow,
1524
+ vimOpenLineAbove,
1525
+ vimAppendAtLineEnd,
1526
+ vimInsertAtLineStart,
1527
+ vimMoveToLineStart,
1528
+ vimMoveToLineEnd,
1529
+ vimMoveToFirstNonWhitespace,
1530
+ vimMoveToFirstLine,
1531
+ vimMoveToLastLine,
1532
+ vimMoveToLine,
1533
+ vimEscapeInsertMode,
1534
+ }), [
1535
+ lines,
1536
+ text,
1537
+ cursorRow,
1538
+ cursorCol,
1539
+ preferredCol,
1540
+ selectionAnchor,
1541
+ visualLines,
1542
+ renderedVisualLines,
1543
+ visualCursor,
1544
+ visualScrollRow,
1545
+ setText,
1546
+ insert,
1547
+ newline,
1548
+ backspace,
1549
+ del,
1550
+ move,
1551
+ undo,
1552
+ redo,
1553
+ replaceRange,
1554
+ replaceRangeByOffset,
1555
+ moveToOffset,
1556
+ deleteWordLeft,
1557
+ deleteWordRight,
1558
+ killLineRight,
1559
+ killLineLeft,
1560
+ handleInput,
1561
+ openInExternalEditor,
1562
+ vimDeleteWordForward,
1563
+ vimDeleteWordBackward,
1564
+ vimDeleteWordEnd,
1565
+ vimChangeWordForward,
1566
+ vimChangeWordBackward,
1567
+ vimChangeWordEnd,
1568
+ vimDeleteLine,
1569
+ vimChangeLine,
1570
+ vimDeleteToEndOfLine,
1571
+ vimChangeToEndOfLine,
1572
+ vimChangeMovement,
1573
+ vimMoveLeft,
1574
+ vimMoveRight,
1575
+ vimMoveUp,
1576
+ vimMoveDown,
1577
+ vimMoveWordForward,
1578
+ vimMoveWordBackward,
1579
+ vimMoveWordEnd,
1580
+ vimDeleteChar,
1581
+ vimInsertAtCursor,
1582
+ vimAppendAtCursor,
1583
+ vimOpenLineBelow,
1584
+ vimOpenLineAbove,
1585
+ vimAppendAtLineEnd,
1586
+ vimInsertAtLineStart,
1587
+ vimMoveToLineStart,
1588
+ vimMoveToLineEnd,
1589
+ vimMoveToFirstNonWhitespace,
1590
+ vimMoveToFirstLine,
1591
+ vimMoveToLastLine,
1592
+ vimMoveToLine,
1593
+ vimEscapeInsertMode,
1594
+ visualToLogicalMap,
1595
+ ]);
1596
+ return returnValue;
1597
+ }
1598
+ //# sourceMappingURL=text-buffer.js.map