@nanocollective/nanocoder 1.11.3

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 (392) hide show
  1. package/LICENSE.md +23 -0
  2. package/README.md +366 -0
  3. package/dist/app/hooks/useAppInitialization.d.ts +26 -0
  4. package/dist/app/hooks/useAppInitialization.d.ts.map +1 -0
  5. package/dist/app/hooks/useAppInitialization.js +151 -0
  6. package/dist/app/hooks/useAppInitialization.js.map +1 -0
  7. package/dist/app/hooks/useAppState.d.ts +84 -0
  8. package/dist/app/hooks/useAppState.d.ts.map +1 -0
  9. package/dist/app/hooks/useAppState.js +162 -0
  10. package/dist/app/hooks/useAppState.js.map +1 -0
  11. package/dist/app/hooks/useChatHandler.d.ts +26 -0
  12. package/dist/app/hooks/useChatHandler.d.ts.map +1 -0
  13. package/dist/app/hooks/useChatHandler.js +532 -0
  14. package/dist/app/hooks/useChatHandler.js.map +1 -0
  15. package/dist/app/hooks/useDirectoryTrust.d.ts +15 -0
  16. package/dist/app/hooks/useDirectoryTrust.d.ts.map +1 -0
  17. package/dist/app/hooks/useDirectoryTrust.js +77 -0
  18. package/dist/app/hooks/useDirectoryTrust.js.map +1 -0
  19. package/dist/app/hooks/useModeHandlers.d.ts +31 -0
  20. package/dist/app/hooks/useModeHandlers.d.ts.map +1 -0
  21. package/dist/app/hooks/useModeHandlers.js +98 -0
  22. package/dist/app/hooks/useModeHandlers.js.map +1 -0
  23. package/dist/app/hooks/useToolHandler.d.ts +32 -0
  24. package/dist/app/hooks/useToolHandler.d.ts.map +1 -0
  25. package/dist/app/hooks/useToolHandler.js +154 -0
  26. package/dist/app/hooks/useToolHandler.js.map +1 -0
  27. package/dist/app/utils/appUtils.d.ts +4 -0
  28. package/dist/app/utils/appUtils.d.ts.map +1 -0
  29. package/dist/app/utils/appUtils.js +147 -0
  30. package/dist/app/utils/appUtils.js.map +1 -0
  31. package/dist/app/utils/conversationState.d.ts +68 -0
  32. package/dist/app/utils/conversationState.d.ts.map +1 -0
  33. package/dist/app/utils/conversationState.js +199 -0
  34. package/dist/app/utils/conversationState.js.map +1 -0
  35. package/dist/app.d.ts +2 -0
  36. package/dist/app.d.ts.map +1 -0
  37. package/dist/app.js +193 -0
  38. package/dist/app.js.map +1 -0
  39. package/dist/cli.d.ts +3 -0
  40. package/dist/cli.d.ts.map +1 -0
  41. package/dist/cli.js +6 -0
  42. package/dist/cli.js.map +1 -0
  43. package/dist/client-factory.d.ts +6 -0
  44. package/dist/client-factory.d.ts.map +1 -0
  45. package/dist/client-factory.js +111 -0
  46. package/dist/client-factory.js.map +1 -0
  47. package/dist/command-parser.d.ts +5 -0
  48. package/dist/command-parser.d.ts.map +1 -0
  49. package/dist/command-parser.js +36 -0
  50. package/dist/command-parser.js.map +1 -0
  51. package/dist/commands/clear.d.ts +3 -0
  52. package/dist/commands/clear.d.ts.map +1 -0
  53. package/dist/commands/clear.js +17 -0
  54. package/dist/commands/clear.js.map +1 -0
  55. package/dist/commands/custom-commands.d.ts +3 -0
  56. package/dist/commands/custom-commands.d.ts.map +1 -0
  57. package/dist/commands/custom-commands.js +41 -0
  58. package/dist/commands/custom-commands.js.map +1 -0
  59. package/dist/commands/debug.d.ts +3 -0
  60. package/dist/commands/debug.d.ts.map +1 -0
  61. package/dist/commands/debug.js +86 -0
  62. package/dist/commands/debug.js.map +1 -0
  63. package/dist/commands/exit.d.ts +3 -0
  64. package/dist/commands/exit.d.ts.map +1 -0
  65. package/dist/commands/exit.js +17 -0
  66. package/dist/commands/exit.js.map +1 -0
  67. package/dist/commands/export.d.ts +3 -0
  68. package/dist/commands/export.d.ts.map +1 -0
  69. package/dist/commands/export.js +63 -0
  70. package/dist/commands/export.js.map +1 -0
  71. package/dist/commands/help.d.ts +3 -0
  72. package/dist/commands/help.d.ts.map +1 -0
  73. package/dist/commands/help.js +31 -0
  74. package/dist/commands/help.js.map +1 -0
  75. package/dist/commands/index.d.ts +13 -0
  76. package/dist/commands/index.d.ts.map +1 -0
  77. package/dist/commands/index.js +13 -0
  78. package/dist/commands/index.js.map +1 -0
  79. package/dist/commands/init.d.ts +3 -0
  80. package/dist/commands/init.d.ts.map +1 -0
  81. package/dist/commands/init.js +214 -0
  82. package/dist/commands/init.js.map +1 -0
  83. package/dist/commands/mcp.d.ts +9 -0
  84. package/dist/commands/mcp.d.ts.map +1 -0
  85. package/dist/commands/mcp.js +41 -0
  86. package/dist/commands/mcp.js.map +1 -0
  87. package/dist/commands/model.d.ts +3 -0
  88. package/dist/commands/model.d.ts.map +1 -0
  89. package/dist/commands/model.js +11 -0
  90. package/dist/commands/model.js.map +1 -0
  91. package/dist/commands/provider.d.ts +3 -0
  92. package/dist/commands/provider.d.ts.map +1 -0
  93. package/dist/commands/provider.js +11 -0
  94. package/dist/commands/provider.js.map +1 -0
  95. package/dist/commands/theme.d.ts +3 -0
  96. package/dist/commands/theme.d.ts.map +1 -0
  97. package/dist/commands/theme.js +11 -0
  98. package/dist/commands/theme.js.map +1 -0
  99. package/dist/commands/update.d.ts +3 -0
  100. package/dist/commands/update.d.ts.map +1 -0
  101. package/dist/commands/update.js +10 -0
  102. package/dist/commands/update.js.map +1 -0
  103. package/dist/commands.d.ts +16 -0
  104. package/dist/commands.d.ts.map +1 -0
  105. package/dist/commands.js +46 -0
  106. package/dist/commands.js.map +1 -0
  107. package/dist/components/assistant-message.d.ts +4 -0
  108. package/dist/components/assistant-message.d.ts.map +1 -0
  109. package/dist/components/assistant-message.js +43 -0
  110. package/dist/components/assistant-message.js.map +1 -0
  111. package/dist/components/bash-execution-indicator.d.ts +4 -0
  112. package/dist/components/bash-execution-indicator.d.ts.map +1 -0
  113. package/dist/components/bash-execution-indicator.js +9 -0
  114. package/dist/components/bash-execution-indicator.js.map +1 -0
  115. package/dist/components/cancelling-indicator.d.ts +3 -0
  116. package/dist/components/cancelling-indicator.d.ts.map +1 -0
  117. package/dist/components/cancelling-indicator.js +10 -0
  118. package/dist/components/cancelling-indicator.js.map +1 -0
  119. package/dist/components/chat-queue.d.ts +4 -0
  120. package/dist/components/chat-queue.d.ts.map +1 -0
  121. package/dist/components/chat-queue.js +23 -0
  122. package/dist/components/chat-queue.js.map +1 -0
  123. package/dist/components/custom-commands.d.ts +7 -0
  124. package/dist/components/custom-commands.d.ts.map +1 -0
  125. package/dist/components/custom-commands.js +27 -0
  126. package/dist/components/custom-commands.js.map +1 -0
  127. package/dist/components/error-message.d.ts +7 -0
  128. package/dist/components/error-message.d.ts.map +1 -0
  129. package/dist/components/error-message.js +12 -0
  130. package/dist/components/error-message.js.map +1 -0
  131. package/dist/components/info-message.d.ts +6 -0
  132. package/dist/components/info-message.d.ts.map +1 -0
  133. package/dist/components/info-message.js +11 -0
  134. package/dist/components/info-message.js.map +1 -0
  135. package/dist/components/model-selector.d.ts +10 -0
  136. package/dist/components/model-selector.d.ts.map +1 -0
  137. package/dist/components/model-selector.js +59 -0
  138. package/dist/components/model-selector.js.map +1 -0
  139. package/dist/components/provider-selector.d.ts +9 -0
  140. package/dist/components/provider-selector.d.ts.map +1 -0
  141. package/dist/components/provider-selector.js +36 -0
  142. package/dist/components/provider-selector.js.map +1 -0
  143. package/dist/components/security-disclaimer.d.ts +7 -0
  144. package/dist/components/security-disclaimer.d.ts.map +1 -0
  145. package/dist/components/security-disclaimer.js +36 -0
  146. package/dist/components/security-disclaimer.js.map +1 -0
  147. package/dist/components/status.d.ts +6 -0
  148. package/dist/components/status.d.ts.map +1 -0
  149. package/dist/components/status.js +35 -0
  150. package/dist/components/status.js.map +1 -0
  151. package/dist/components/success-message.d.ts +6 -0
  152. package/dist/components/success-message.d.ts.map +1 -0
  153. package/dist/components/success-message.js +11 -0
  154. package/dist/components/success-message.js.map +1 -0
  155. package/dist/components/theme-selector.d.ts +8 -0
  156. package/dist/components/theme-selector.d.ts.map +1 -0
  157. package/dist/components/theme-selector.js +40 -0
  158. package/dist/components/theme-selector.js.map +1 -0
  159. package/dist/components/thinking-indicator.d.ts +4 -0
  160. package/dist/components/thinking-indicator.d.ts.map +1 -0
  161. package/dist/components/thinking-indicator.js +32 -0
  162. package/dist/components/thinking-indicator.js.map +1 -0
  163. package/dist/components/tool-confirmation.d.ts +9 -0
  164. package/dist/components/tool-confirmation.d.ts.map +1 -0
  165. package/dist/components/tool-confirmation.js +72 -0
  166. package/dist/components/tool-confirmation.js.map +1 -0
  167. package/dist/components/tool-execution-indicator.d.ts +3 -0
  168. package/dist/components/tool-execution-indicator.d.ts.map +1 -0
  169. package/dist/components/tool-execution-indicator.js +9 -0
  170. package/dist/components/tool-execution-indicator.js.map +1 -0
  171. package/dist/components/tool-message.d.ts +10 -0
  172. package/dist/components/tool-message.d.ts.map +1 -0
  173. package/dist/components/tool-message.js +16 -0
  174. package/dist/components/tool-message.js.map +1 -0
  175. package/dist/components/update-message.d.ts +7 -0
  176. package/dist/components/update-message.d.ts.map +1 -0
  177. package/dist/components/update-message.js +93 -0
  178. package/dist/components/update-message.js.map +1 -0
  179. package/dist/components/user-input.d.ts +10 -0
  180. package/dist/components/user-input.d.ts.map +1 -0
  181. package/dist/components/user-input.js +188 -0
  182. package/dist/components/user-input.js.map +1 -0
  183. package/dist/components/user-message.d.ts +4 -0
  184. package/dist/components/user-message.d.ts.map +1 -0
  185. package/dist/components/user-message.js +15 -0
  186. package/dist/components/user-message.js.map +1 -0
  187. package/dist/components/welcome-message.d.ts +3 -0
  188. package/dist/components/welcome-message.d.ts.map +1 -0
  189. package/dist/components/welcome-message.js +21 -0
  190. package/dist/components/welcome-message.js.map +1 -0
  191. package/dist/config/index.d.ts +10 -0
  192. package/dist/config/index.d.ts.map +1 -0
  193. package/dist/config/index.js +44 -0
  194. package/dist/config/index.js.map +1 -0
  195. package/dist/config/logging.d.ts +14 -0
  196. package/dist/config/logging.d.ts.map +1 -0
  197. package/dist/config/logging.js +58 -0
  198. package/dist/config/logging.js.map +1 -0
  199. package/dist/config/preferences.d.ts +7 -0
  200. package/dist/config/preferences.d.ts.map +1 -0
  201. package/dist/config/preferences.js +46 -0
  202. package/dist/config/preferences.js.map +1 -0
  203. package/dist/config/themes.d.ts +6 -0
  204. package/dist/config/themes.d.ts.map +1 -0
  205. package/dist/config/themes.js +295 -0
  206. package/dist/config/themes.js.map +1 -0
  207. package/dist/custom-commands/executor.d.ts +12 -0
  208. package/dist/custom-commands/executor.d.ts.map +1 -0
  209. package/dist/custom-commands/executor.js +45 -0
  210. package/dist/custom-commands/executor.js.map +1 -0
  211. package/dist/custom-commands/index.d.ts +4 -0
  212. package/dist/custom-commands/index.d.ts.map +1 -0
  213. package/dist/custom-commands/index.js +4 -0
  214. package/dist/custom-commands/index.js.map +1 -0
  215. package/dist/custom-commands/loader.d.ts +41 -0
  216. package/dist/custom-commands/loader.d.ts.map +1 -0
  217. package/dist/custom-commands/loader.js +129 -0
  218. package/dist/custom-commands/loader.js.map +1 -0
  219. package/dist/custom-commands/parser.d.ts +10 -0
  220. package/dist/custom-commands/parser.d.ts.map +1 -0
  221. package/dist/custom-commands/parser.js +181 -0
  222. package/dist/custom-commands/parser.js.map +1 -0
  223. package/dist/hooks/useInputState.d.ts +14 -0
  224. package/dist/hooks/useInputState.d.ts.map +1 -0
  225. package/dist/hooks/useInputState.js +66 -0
  226. package/dist/hooks/useInputState.js.map +1 -0
  227. package/dist/hooks/useTerminalWidth.d.ts +2 -0
  228. package/dist/hooks/useTerminalWidth.d.ts.map +1 -0
  229. package/dist/hooks/useTerminalWidth.js +20 -0
  230. package/dist/hooks/useTerminalWidth.js.map +1 -0
  231. package/dist/hooks/useTheme.d.ts +9 -0
  232. package/dist/hooks/useTheme.d.ts.map +1 -0
  233. package/dist/hooks/useTheme.js +10 -0
  234. package/dist/hooks/useTheme.js.map +1 -0
  235. package/dist/hooks/useUIState.d.ts +19 -0
  236. package/dist/hooks/useUIState.d.ts.map +1 -0
  237. package/dist/hooks/useUIState.js +46 -0
  238. package/dist/hooks/useUIState.js.map +1 -0
  239. package/dist/init/agents-template-generator.d.ts +29 -0
  240. package/dist/init/agents-template-generator.d.ts.map +1 -0
  241. package/dist/init/agents-template-generator.js +340 -0
  242. package/dist/init/agents-template-generator.js.map +1 -0
  243. package/dist/init/existing-rules-extractor.d.ts +43 -0
  244. package/dist/init/existing-rules-extractor.d.ts.map +1 -0
  245. package/dist/init/existing-rules-extractor.js +226 -0
  246. package/dist/init/existing-rules-extractor.js.map +1 -0
  247. package/dist/init/file-scanner.d.ts +40 -0
  248. package/dist/init/file-scanner.d.ts.map +1 -0
  249. package/dist/init/file-scanner.js +153 -0
  250. package/dist/init/file-scanner.js.map +1 -0
  251. package/dist/init/framework-detector.d.ts +57 -0
  252. package/dist/init/framework-detector.d.ts.map +1 -0
  253. package/dist/init/framework-detector.js +277 -0
  254. package/dist/init/framework-detector.js.map +1 -0
  255. package/dist/init/language-detector.d.ts +31 -0
  256. package/dist/init/language-detector.d.ts.map +1 -0
  257. package/dist/init/language-detector.js +205 -0
  258. package/dist/init/language-detector.js.map +1 -0
  259. package/dist/init/project-analyzer.d.ts +62 -0
  260. package/dist/init/project-analyzer.d.ts.map +1 -0
  261. package/dist/init/project-analyzer.js +294 -0
  262. package/dist/init/project-analyzer.js.map +1 -0
  263. package/dist/langgraph-client.d.ts +20 -0
  264. package/dist/langgraph-client.d.ts.map +1 -0
  265. package/dist/langgraph-client.js +245 -0
  266. package/dist/langgraph-client.js.map +1 -0
  267. package/dist/mcp/mcp-client.d.ts +23 -0
  268. package/dist/mcp/mcp-client.d.ts.map +1 -0
  269. package/dist/mcp/mcp-client.js +194 -0
  270. package/dist/mcp/mcp-client.js.map +1 -0
  271. package/dist/mcp/mcp-tool-adapter.d.ts +22 -0
  272. package/dist/mcp/mcp-tool-adapter.d.ts.map +1 -0
  273. package/dist/mcp/mcp-tool-adapter.js +49 -0
  274. package/dist/mcp/mcp-tool-adapter.js.map +1 -0
  275. package/dist/message-handler.d.ts +7 -0
  276. package/dist/message-handler.d.ts.map +1 -0
  277. package/dist/message-handler.js +53 -0
  278. package/dist/message-handler.js.map +1 -0
  279. package/dist/prompt-history.d.ts +14 -0
  280. package/dist/prompt-history.d.ts.map +1 -0
  281. package/dist/prompt-history.js +88 -0
  282. package/dist/prompt-history.js.map +1 -0
  283. package/dist/tool-calling/index.d.ts +6 -0
  284. package/dist/tool-calling/index.d.ts.map +1 -0
  285. package/dist/tool-calling/index.js +5 -0
  286. package/dist/tool-calling/index.js.map +1 -0
  287. package/dist/tool-calling/json-parser.d.ts +7 -0
  288. package/dist/tool-calling/json-parser.d.ts.map +1 -0
  289. package/dist/tool-calling/json-parser.js +168 -0
  290. package/dist/tool-calling/json-parser.js.map +1 -0
  291. package/dist/tool-calling/xml-parser.d.ts +34 -0
  292. package/dist/tool-calling/xml-parser.d.ts.map +1 -0
  293. package/dist/tool-calling/xml-parser.js +113 -0
  294. package/dist/tool-calling/xml-parser.js.map +1 -0
  295. package/dist/tools/create-file.d.ts +3 -0
  296. package/dist/tools/create-file.d.ts.map +1 -0
  297. package/dist/tools/create-file.js +66 -0
  298. package/dist/tools/create-file.js.map +1 -0
  299. package/dist/tools/delete-lines.d.ts +3 -0
  300. package/dist/tools/delete-lines.d.ts.map +1 -0
  301. package/dist/tools/delete-lines.js +218 -0
  302. package/dist/tools/delete-lines.js.map +1 -0
  303. package/dist/tools/execute-bash.d.ts +3 -0
  304. package/dist/tools/execute-bash.d.ts.map +1 -0
  305. package/dist/tools/execute-bash.js +107 -0
  306. package/dist/tools/execute-bash.js.map +1 -0
  307. package/dist/tools/index.d.ts +7 -0
  308. package/dist/tools/index.d.ts.map +1 -0
  309. package/dist/tools/index.js +23 -0
  310. package/dist/tools/index.js.map +1 -0
  311. package/dist/tools/insert-lines.d.ts +3 -0
  312. package/dist/tools/insert-lines.d.ts.map +1 -0
  313. package/dist/tools/insert-lines.js +185 -0
  314. package/dist/tools/insert-lines.js.map +1 -0
  315. package/dist/tools/read-file.d.ts +3 -0
  316. package/dist/tools/read-file.d.ts.map +1 -0
  317. package/dist/tools/read-file.js +81 -0
  318. package/dist/tools/read-file.js.map +1 -0
  319. package/dist/tools/read-many-files.d.ts +3 -0
  320. package/dist/tools/read-many-files.d.ts.map +1 -0
  321. package/dist/tools/read-many-files.js +109 -0
  322. package/dist/tools/read-many-files.js.map +1 -0
  323. package/dist/tools/replace-lines.d.ts +3 -0
  324. package/dist/tools/replace-lines.d.ts.map +1 -0
  325. package/dist/tools/replace-lines.js +220 -0
  326. package/dist/tools/replace-lines.js.map +1 -0
  327. package/dist/tools/tool-manager.d.ts +54 -0
  328. package/dist/tools/tool-manager.d.ts.map +1 -0
  329. package/dist/tools/tool-manager.js +108 -0
  330. package/dist/tools/tool-manager.js.map +1 -0
  331. package/dist/types/app.d.ts +46 -0
  332. package/dist/types/app.d.ts.map +1 -0
  333. package/dist/types/app.js +2 -0
  334. package/dist/types/app.js.map +1 -0
  335. package/dist/types/commands.d.ts +36 -0
  336. package/dist/types/commands.d.ts.map +1 -0
  337. package/dist/types/commands.js +2 -0
  338. package/dist/types/commands.js.map +1 -0
  339. package/dist/types/components.d.ts +87 -0
  340. package/dist/types/components.d.ts.map +1 -0
  341. package/dist/types/components.js +2 -0
  342. package/dist/types/components.js.map +1 -0
  343. package/dist/types/config.d.ts +35 -0
  344. package/dist/types/config.d.ts.map +1 -0
  345. package/dist/types/config.js +2 -0
  346. package/dist/types/config.js.map +1 -0
  347. package/dist/types/core.d.ts +57 -0
  348. package/dist/types/core.d.ts.map +1 -0
  349. package/dist/types/core.js +2 -0
  350. package/dist/types/core.js.map +1 -0
  351. package/dist/types/hooks.d.ts +26 -0
  352. package/dist/types/hooks.d.ts.map +1 -0
  353. package/dist/types/hooks.js +2 -0
  354. package/dist/types/hooks.js.map +1 -0
  355. package/dist/types/index.d.ts +11 -0
  356. package/dist/types/index.d.ts.map +1 -0
  357. package/dist/types/index.js +12 -0
  358. package/dist/types/index.js.map +1 -0
  359. package/dist/types/mcp.d.ts +19 -0
  360. package/dist/types/mcp.d.ts.map +1 -0
  361. package/dist/types/mcp.js +2 -0
  362. package/dist/types/mcp.js.map +1 -0
  363. package/dist/types/tools.d.ts +31 -0
  364. package/dist/types/tools.d.ts.map +1 -0
  365. package/dist/types/tools.js +2 -0
  366. package/dist/types/tools.js.map +1 -0
  367. package/dist/types/ui.d.ts +22 -0
  368. package/dist/types/ui.d.ts.map +1 -0
  369. package/dist/types/ui.js +2 -0
  370. package/dist/types/ui.js.map +1 -0
  371. package/dist/types/utils.d.ts +19 -0
  372. package/dist/types/utils.d.ts.map +1 -0
  373. package/dist/types/utils.js +2 -0
  374. package/dist/types/utils.js.map +1 -0
  375. package/dist/utils/message-queue.d.ts +8 -0
  376. package/dist/utils/message-queue.d.ts.map +1 -0
  377. package/dist/utils/message-queue.js +50 -0
  378. package/dist/utils/message-queue.js.map +1 -0
  379. package/dist/utils/programming-language-helper.d.ts +2 -0
  380. package/dist/utils/programming-language-helper.d.ts.map +1 -0
  381. package/dist/utils/programming-language-helper.js +32 -0
  382. package/dist/utils/programming-language-helper.js.map +1 -0
  383. package/dist/utils/prompt-processor.d.ts +6 -0
  384. package/dist/utils/prompt-processor.d.ts.map +1 -0
  385. package/dist/utils/prompt-processor.js +103 -0
  386. package/dist/utils/prompt-processor.js.map +1 -0
  387. package/dist/utils/update-checker.d.ts +6 -0
  388. package/dist/utils/update-checker.d.ts.map +1 -0
  389. package/dist/utils/update-checker.js +120 -0
  390. package/dist/utils/update-checker.js.map +1 -0
  391. package/package.json +97 -0
  392. package/source/app/prompts/main-prompt.md +107 -0
@@ -0,0 +1,532 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { toolDefinitions } from '../../tools/index.js';
3
+ import { processPromptTemplate } from '../../utils/prompt-processor.js';
4
+ import { parseToolCallsFromContent, cleanContentFromToolCalls, } from '../../tool-calling/index.js';
5
+ import { ConversationStateManager } from '../utils/conversationState.js';
6
+ import UserMessage from '../../components/user-message.js';
7
+ import AssistantMessage from '../../components/assistant-message.js';
8
+ import ErrorMessage from '../../components/error-message.js';
9
+ import ToolMessage from '../../components/tool-message.js';
10
+ import React from 'react';
11
+ // Helper function to filter out invalid tool calls and deduplicate by ID and function
12
+ const filterValidToolCalls = (toolCalls) => {
13
+ const seenIds = new Set();
14
+ const seenFunctionCalls = new Set();
15
+ return toolCalls.filter(toolCall => {
16
+ // Filter out completely empty tool calls
17
+ if (!toolCall.id || !toolCall.function?.name) {
18
+ return false;
19
+ }
20
+ // Filter out tool calls with empty names
21
+ if (toolCall.function.name.trim() === '') {
22
+ return false;
23
+ }
24
+ // Filter out tool calls for tools that don't exist
25
+ // Filter out duplicate tool call IDs (GPT-5 issue)
26
+ if (seenIds.has(toolCall.id)) {
27
+ return false;
28
+ }
29
+ // Filter out functionally identical tool calls (same tool + args)
30
+ const functionSignature = `${toolCall.function.name}:${JSON.stringify(toolCall.function.arguments)}`;
31
+ if (seenFunctionCalls.has(functionSignature)) {
32
+ return false;
33
+ }
34
+ seenIds.add(toolCall.id);
35
+ seenFunctionCalls.add(functionSignature);
36
+ return true;
37
+ });
38
+ };
39
+ export function useChatHandler({ client, toolManager, messages, setMessages, getMessageTokens, currentModel, setIsThinking, setIsCancelling, setThinkingStats, addToChatQueue, componentKeyCounter, abortController, setAbortController, onStartToolConfirmationFlow, }) {
40
+ // Conversation state manager for enhanced context
41
+ const conversationStateManager = React.useRef(new ConversationStateManager());
42
+ // Reset conversation state when messages are cleared
43
+ React.useEffect(() => {
44
+ if (messages.length === 0) {
45
+ conversationStateManager.current.reset();
46
+ }
47
+ }, [messages.length]);
48
+ // Display tool result with proper formatting (similar to useToolHandler)
49
+ const displayToolResult = async (toolCall, result) => {
50
+ if (toolManager) {
51
+ const formatter = toolManager.getToolFormatter(result.name);
52
+ if (formatter) {
53
+ try {
54
+ // Parse arguments if they're a JSON string
55
+ let parsedArgs = toolCall.function.arguments;
56
+ if (typeof parsedArgs === 'string') {
57
+ try {
58
+ parsedArgs = JSON.parse(parsedArgs);
59
+ }
60
+ catch (e) {
61
+ // If parsing fails, use as-is
62
+ }
63
+ }
64
+ const formattedResult = await formatter(parsedArgs, result.content);
65
+ if (React.isValidElement(formattedResult)) {
66
+ addToChatQueue(React.cloneElement(formattedResult, {
67
+ key: `tool-result-${result.tool_call_id}-${componentKeyCounter}-${Date.now()}`,
68
+ }));
69
+ }
70
+ else {
71
+ addToChatQueue(_jsx(ToolMessage, { title: `⚒ ${result.name}`, message: String(formattedResult), hideBox: true }, `tool-result-${result.tool_call_id}-${componentKeyCounter}-${Date.now()}`));
72
+ }
73
+ }
74
+ catch (formatterError) {
75
+ // If formatter fails, show raw result
76
+ addToChatQueue(_jsx(ToolMessage, { title: `⚒ ${result.name}`, message: result.content, hideBox: true }, `tool-result-${result.tool_call_id}-${componentKeyCounter}`));
77
+ }
78
+ }
79
+ else {
80
+ // No formatter, show raw result
81
+ addToChatQueue(_jsx(ToolMessage, { title: `⚒ ${result.name}`, message: result.content, hideBox: true }, `tool-result-${result.tool_call_id}-${componentKeyCounter}`));
82
+ }
83
+ }
84
+ };
85
+ // Throttle thinking stats updates to reduce re-renders
86
+ const throttledSetThinkingStats = React.useCallback((() => {
87
+ let lastUpdate = 0;
88
+ const throttleMs = 250; // Update at most 4 times per second
89
+ return (stats) => {
90
+ const now = Date.now();
91
+ if (now - lastUpdate >= throttleMs) {
92
+ lastUpdate = now;
93
+ setThinkingStats(stats);
94
+ }
95
+ };
96
+ })(), [setThinkingStats]);
97
+ // Helper to make async iterator cancellable with frequent abort checking
98
+ const makeCancellableStream = async function* (stream, abortSignal) {
99
+ const iterator = stream[Symbol.asyncIterator]();
100
+ try {
101
+ while (true) {
102
+ if (abortSignal?.aborted) {
103
+ throw new Error('Operation was cancelled');
104
+ }
105
+ // Use Promise.race to make iterator.next() cancellable with frequent checking
106
+ const nextPromise = iterator.next();
107
+ const timeoutPromise = new Promise(resolve => {
108
+ const checkInterval = setInterval(() => {
109
+ if (abortSignal?.aborted) {
110
+ clearInterval(checkInterval);
111
+ resolve({ done: false, cancelled: true });
112
+ }
113
+ }, 100); // Check every 100ms
114
+ // Clear interval when next() completes
115
+ nextPromise.finally(() => clearInterval(checkInterval));
116
+ });
117
+ const result = (await Promise.race([
118
+ nextPromise,
119
+ timeoutPromise,
120
+ ]));
121
+ if (result.cancelled || abortSignal?.aborted) {
122
+ throw new Error('Operation was cancelled');
123
+ }
124
+ if (result.done)
125
+ break;
126
+ yield result.value;
127
+ }
128
+ }
129
+ finally {
130
+ if (iterator.return) {
131
+ await iterator.return();
132
+ }
133
+ }
134
+ };
135
+ // Process assistant response with token tracking (for initial user messages)
136
+ const processAssistantResponseWithTokenTracking = async (systemMessage, messages, controller) => {
137
+ if (!client)
138
+ return;
139
+ const stream = client.chatStream([systemMessage, ...messages], toolManager?.getAllTools() || []);
140
+ let toolCalls = null;
141
+ let fullContent = '';
142
+ let tokenCount = 0;
143
+ let hasContent = false;
144
+ // Process streaming response with cancellation support
145
+ const cancellableStream = makeCancellableStream(stream, controller.signal);
146
+ for await (const chunk of cancellableStream) {
147
+ hasContent = true;
148
+ if (chunk.message?.content) {
149
+ fullContent += chunk.message.content;
150
+ tokenCount = Math.ceil(fullContent.length / 4);
151
+ }
152
+ // If server provides eval_count, use it as it's more accurate
153
+ // But ensure we don't reset to a lower count if content tokens are higher
154
+ if (chunk.eval_count) {
155
+ tokenCount = Math.max(tokenCount, chunk.eval_count);
156
+ }
157
+ if (chunk.message?.tool_calls) {
158
+ toolCalls = chunk.message.tool_calls;
159
+ }
160
+ // Update thinking stats in real-time
161
+ if (!chunk.done) {
162
+ const systemTokens = Math.ceil(systemMessage.content.length / 4); // Use actual system prompt length
163
+ const conversationTokens = getMessageTokens
164
+ ? messages.reduce((total, msg) => total + getMessageTokens(msg), 0)
165
+ : messages.reduce((total, msg) => total + Math.ceil((msg.content?.length || 0) / 4), 0);
166
+ const totalTokensUsed = systemTokens + conversationTokens + tokenCount;
167
+ throttledSetThinkingStats({
168
+ tokenCount,
169
+ contextSize: client.getContextSize(),
170
+ totalTokensUsed,
171
+ tokensPerSecond: chunk.tokens_per_second,
172
+ });
173
+ }
174
+ }
175
+ if (!hasContent) {
176
+ throw new Error('No response received from model');
177
+ }
178
+ // Parse any tool calls from content for non-tool-calling models
179
+ const parsedToolCalls = parseToolCallsFromContent(fullContent);
180
+ const cleanedContent = cleanContentFromToolCalls(fullContent, parsedToolCalls);
181
+ // Display the assistant response (cleaned of any tool calls)
182
+ if (cleanedContent.trim()) {
183
+ addToChatQueue(_jsx(AssistantMessage, { message: cleanedContent, model: currentModel }, `assistant-${componentKeyCounter}`));
184
+ }
185
+ // Merge structured tool calls from LangGraph with content-parsed tool calls
186
+ const allToolCalls = [...(toolCalls || []), ...parsedToolCalls];
187
+ const validToolCalls = filterValidToolCalls(allToolCalls);
188
+ // Add assistant message to conversation history
189
+ const assistantMsg = {
190
+ role: 'assistant',
191
+ content: cleanedContent,
192
+ tool_calls: validToolCalls.length > 0 ? validToolCalls : undefined,
193
+ };
194
+ setMessages([...messages, assistantMsg]);
195
+ // Update conversation state with assistant message
196
+ conversationStateManager.current.updateAssistantMessage(assistantMsg);
197
+ // Handle tool calls if present - this continues the loop
198
+ if (validToolCalls && validToolCalls.length > 0) {
199
+ // First, validate tools and separate valid from unknown
200
+ const knownToolCalls = [];
201
+ const unknownToolErrors = [];
202
+ for (const toolCall of validToolCalls) {
203
+ if (!toolManager?.hasTool(toolCall.function.name)) {
204
+ // Create error result for unknown tool
205
+ const errorResult = {
206
+ tool_call_id: toolCall.id,
207
+ role: 'tool',
208
+ name: toolCall.function.name,
209
+ content: `Error: Unknown tool: ${toolCall.function.name}`,
210
+ };
211
+ unknownToolErrors.push(errorResult);
212
+ // Display the error result
213
+ await displayToolResult(toolCall, errorResult);
214
+ }
215
+ else {
216
+ // Tool exists, add to valid list
217
+ knownToolCalls.push(toolCall);
218
+ }
219
+ }
220
+ // If there were unknown tools, continue conversation with all errors
221
+ if (unknownToolErrors.length > 0) {
222
+ const toolMessages = unknownToolErrors.map(result => ({
223
+ role: 'tool',
224
+ content: result.content || '',
225
+ tool_call_id: result.tool_call_id,
226
+ name: result.name,
227
+ }));
228
+ const updatedMessagesWithError = [
229
+ ...messages,
230
+ assistantMsg,
231
+ ...toolMessages,
232
+ ];
233
+ setMessages(updatedMessagesWithError);
234
+ // Continue the main conversation loop with error messages as context
235
+ await processAssistantResponse(systemMessage, updatedMessagesWithError);
236
+ return;
237
+ }
238
+ // If we get here, all tools are valid - proceed with normal flow
239
+ // Use knownToolCalls for the rest of the processing
240
+ // Separate tools that need confirmation vs those that don't
241
+ const toolsNeedingConfirmation = [];
242
+ const toolsToExecuteDirectly = [];
243
+ for (const toolCall of knownToolCalls) {
244
+ const toolDef = toolDefinitions.find(def => def.config.function.name === toolCall.function.name);
245
+ if (toolDef && toolDef.requiresConfirmation === false) {
246
+ toolsToExecuteDirectly.push(toolCall);
247
+ }
248
+ else {
249
+ toolsNeedingConfirmation.push(toolCall);
250
+ }
251
+ }
252
+ // Execute non-confirmation tools directly
253
+ if (toolsToExecuteDirectly.length > 0) {
254
+ // Import processToolUse here to avoid circular dependencies
255
+ const { processToolUse } = await import('../../message-handler.js');
256
+ const directResults = [];
257
+ for (const toolCall of toolsToExecuteDirectly) {
258
+ try {
259
+ // Double-check tool exists before execution (safety net)
260
+ if (!toolManager?.hasTool(toolCall.function.name)) {
261
+ throw new Error(`Unknown tool: ${toolCall.function.name}`);
262
+ }
263
+ const result = await processToolUse(toolCall);
264
+ directResults.push(result);
265
+ // Update conversation state with tool execution
266
+ conversationStateManager.current.updateAfterToolExecution(toolCall, result.content);
267
+ // Display the tool result immediately
268
+ await displayToolResult(toolCall, result);
269
+ }
270
+ catch (error) {
271
+ // Handle tool execution errors
272
+ const errorResult = {
273
+ tool_call_id: toolCall.id,
274
+ role: 'tool',
275
+ name: toolCall.function.name,
276
+ content: `Error: ${error instanceof Error ? error.message : String(error)}`,
277
+ };
278
+ directResults.push(errorResult);
279
+ // Update conversation state with error
280
+ conversationStateManager.current.updateAfterToolExecution(toolCall, errorResult.content);
281
+ // Display the error result
282
+ await displayToolResult(toolCall, errorResult);
283
+ }
284
+ }
285
+ // If we have results, continue the conversation with them
286
+ if (directResults.length > 0) {
287
+ // Format tool results as standard tool messages
288
+ const toolMessages = directResults.map(result => ({
289
+ role: 'tool',
290
+ content: result.content || '',
291
+ tool_call_id: result.tool_call_id,
292
+ name: result.name,
293
+ }));
294
+ const updatedMessagesWithTools = [
295
+ ...messages,
296
+ assistantMsg,
297
+ ...toolMessages,
298
+ ];
299
+ setMessages(updatedMessagesWithTools);
300
+ // Continue the main conversation loop with tool results as context
301
+ await processAssistantResponse(systemMessage, updatedMessagesWithTools);
302
+ return;
303
+ }
304
+ }
305
+ // Start confirmation flow only for tools that need it
306
+ if (toolsNeedingConfirmation.length > 0) {
307
+ onStartToolConfirmationFlow(toolsNeedingConfirmation, messages, assistantMsg, systemMessage);
308
+ return; // IMPORTANT: Stop processing here, wait for user confirmation
309
+ }
310
+ }
311
+ };
312
+ // Process assistant response - handles the conversation loop with potential tool calls (for follow-ups)
313
+ const processAssistantResponse = async (systemMessage, messages) => {
314
+ if (!client)
315
+ return;
316
+ // Ensure we have an abort controller for this request
317
+ let controller = abortController;
318
+ if (!controller) {
319
+ controller = new AbortController();
320
+ setAbortController(controller);
321
+ }
322
+ try {
323
+ setIsThinking(true);
324
+ const stream = client.chatStream([systemMessage, ...messages], toolManager?.getAllTools() || []);
325
+ let toolCalls = null;
326
+ let fullContent = '';
327
+ let hasContent = false;
328
+ let tokenCount = 0;
329
+ // Process streaming response with progress updates and cancellation support
330
+ const cancellableStream = makeCancellableStream(stream, controller.signal);
331
+ for await (const chunk of cancellableStream) {
332
+ hasContent = true;
333
+ if (chunk.message?.content) {
334
+ fullContent += chunk.message.content;
335
+ tokenCount = Math.ceil(fullContent.length / 4);
336
+ }
337
+ // If server provides eval_count, use it as it's more accurate
338
+ // But ensure we don't reset to a lower count if content tokens are higher
339
+ if (chunk.eval_count) {
340
+ tokenCount = Math.max(tokenCount, chunk.eval_count);
341
+ }
342
+ if (chunk.message?.tool_calls) {
343
+ toolCalls = chunk.message.tool_calls;
344
+ }
345
+ // Update thinking stats in real-time (similar to initial response)
346
+ if (!chunk.done) {
347
+ const systemTokens = Math.ceil(systemMessage.content.length / 4); // Use actual system prompt length
348
+ const conversationTokens = getMessageTokens
349
+ ? messages.reduce((total, msg) => total + getMessageTokens(msg), 0)
350
+ : messages.reduce((total, msg) => total + Math.ceil((msg.content?.length || 0) / 4), 0);
351
+ const totalTokensUsed = systemTokens + conversationTokens + tokenCount;
352
+ throttledSetThinkingStats({
353
+ tokenCount,
354
+ contextSize: client.getContextSize(),
355
+ totalTokensUsed,
356
+ tokensPerSecond: chunk.tokens_per_second,
357
+ });
358
+ }
359
+ }
360
+ if (!hasContent) {
361
+ throw new Error('No response received from model');
362
+ }
363
+ // Parse any tool calls from content for non-tool-calling models
364
+ const parsedToolCalls = parseToolCallsFromContent(fullContent);
365
+ const cleanedContent = cleanContentFromToolCalls(fullContent, parsedToolCalls);
366
+ // Display the assistant response (cleaned of any tool calls)
367
+ if (cleanedContent.trim()) {
368
+ addToChatQueue(_jsx(AssistantMessage, { message: cleanedContent, model: currentModel }, `assistant-${componentKeyCounter}`));
369
+ }
370
+ // Merge structured tool calls from LangGraph with content-parsed tool calls
371
+ const allToolCalls = [...(toolCalls || []), ...parsedToolCalls];
372
+ const validToolCalls = filterValidToolCalls(allToolCalls);
373
+ // Add assistant message to conversation history
374
+ const assistantMsg = {
375
+ role: 'assistant',
376
+ content: cleanedContent,
377
+ tool_calls: validToolCalls.length > 0 ? validToolCalls : undefined,
378
+ };
379
+ setMessages([...messages, assistantMsg]);
380
+ // Update conversation state with assistant message
381
+ conversationStateManager.current.updateAssistantMessage(assistantMsg);
382
+ // Handle tool calls if present - this continues the loop
383
+ if (validToolCalls && validToolCalls.length > 0) {
384
+ // Separate tools that need confirmation vs those that don't
385
+ const toolsNeedingConfirmation = [];
386
+ const toolsToExecuteDirectly = [];
387
+ for (const toolCall of validToolCalls) {
388
+ const toolDef = toolDefinitions.find(def => def.config.function.name === toolCall.function.name);
389
+ if (toolDef && toolDef.requiresConfirmation === false) {
390
+ toolsToExecuteDirectly.push(toolCall);
391
+ }
392
+ else {
393
+ toolsNeedingConfirmation.push(toolCall);
394
+ }
395
+ }
396
+ // Execute non-confirmation tools directly
397
+ if (toolsToExecuteDirectly.length > 0) {
398
+ // Import processToolUse here to avoid circular dependencies
399
+ const { processToolUse } = await import('../../message-handler.js');
400
+ const directResults = [];
401
+ for (const toolCall of toolsToExecuteDirectly) {
402
+ try {
403
+ const result = await processToolUse(toolCall);
404
+ directResults.push(result);
405
+ // Update conversation state with tool execution
406
+ conversationStateManager.current.updateAfterToolExecution(toolCall, result.content);
407
+ // Display the tool result immediately
408
+ await displayToolResult(toolCall, result);
409
+ }
410
+ catch (error) {
411
+ // Handle tool execution errors
412
+ const errorResult = {
413
+ tool_call_id: toolCall.id,
414
+ role: 'tool',
415
+ name: toolCall.function.name,
416
+ content: `Error: ${error instanceof Error ? error.message : String(error)}`,
417
+ };
418
+ directResults.push(errorResult);
419
+ // Update conversation state with error
420
+ conversationStateManager.current.updateAfterToolExecution(toolCall, errorResult.content);
421
+ // Display the error result
422
+ await displayToolResult(toolCall, errorResult);
423
+ }
424
+ }
425
+ // If we have results, continue the conversation with them
426
+ if (directResults.length > 0) {
427
+ // Format tool results as standard tool messages
428
+ const toolMessages = directResults.map(result => ({
429
+ role: 'tool',
430
+ content: result.content || '',
431
+ tool_call_id: result.tool_call_id,
432
+ name: result.name,
433
+ }));
434
+ const updatedMessagesWithTools = [
435
+ ...messages,
436
+ assistantMsg,
437
+ ...toolMessages,
438
+ ];
439
+ setMessages(updatedMessagesWithTools);
440
+ // Continue the main conversation loop with tool results as context
441
+ const controller = new AbortController();
442
+ await processAssistantResponseWithTokenTracking(systemMessage, updatedMessagesWithTools, controller);
443
+ return;
444
+ }
445
+ }
446
+ // Start confirmation flow only for tools that need it
447
+ if (toolsNeedingConfirmation.length > 0) {
448
+ onStartToolConfirmationFlow(toolsNeedingConfirmation, messages, assistantMsg, systemMessage);
449
+ }
450
+ }
451
+ // If no tool calls, the conversation naturally ends here
452
+ }
453
+ catch (error) {
454
+ if (error instanceof Error &&
455
+ error.message === 'Operation was cancelled') {
456
+ addToChatQueue(_jsx(ErrorMessage, { message: "Operation was cancelled by user", hideBox: true }, `cancelled-${componentKeyCounter}`));
457
+ }
458
+ else {
459
+ addToChatQueue(_jsx(ErrorMessage, { message: `Conversation error: ${error}` }, `error-${componentKeyCounter}`));
460
+ }
461
+ }
462
+ finally {
463
+ setIsThinking(false);
464
+ setIsCancelling(false);
465
+ setAbortController(null);
466
+ }
467
+ };
468
+ // Handle chat message processing
469
+ const handleChatMessage = async (message) => {
470
+ if (!client || !toolManager)
471
+ return;
472
+ // Add user message to chat
473
+ addToChatQueue(_jsx(UserMessage, { message: message }, `user-${componentKeyCounter}`));
474
+ // Add user message to conversation history
475
+ const userMessage = { role: 'user', content: message };
476
+ const updatedMessages = [...messages, userMessage];
477
+ setMessages(updatedMessages);
478
+ // Initialize conversation state if this is a new conversation
479
+ if (messages.length === 0) {
480
+ conversationStateManager.current.initializeState(message);
481
+ }
482
+ // Create abort controller for cancellation
483
+ const controller = new AbortController();
484
+ setAbortController(controller);
485
+ // Start thinking indicator and streaming
486
+ setIsThinking(true);
487
+ // Initialize per-message stats with existing conversation context
488
+ // const systemTokens = Math.ceil(systemPrompt.length / 4); // Comment out, will calculate later
489
+ const existingConversationTokens = getMessageTokens
490
+ ? updatedMessages.reduce((total, msg) => total + getMessageTokens(msg), 0)
491
+ : updatedMessages.reduce((total, msg) => total + Math.ceil((msg.content?.length || 0) / 4), 0);
492
+ try {
493
+ // Load and process system prompt with dynamic tool documentation
494
+ const availableTools = toolManager ? toolManager.getAllTools() : [];
495
+ const systemPrompt = processPromptTemplate(availableTools);
496
+ // Create stream request
497
+ const systemMessage = {
498
+ role: 'system',
499
+ content: systemPrompt,
500
+ };
501
+ // Use the new conversation loop
502
+ // Initialize per-message stats with actual system prompt tokens
503
+ const systemTokens = Math.ceil(systemMessage.content.length / 4);
504
+ setThinkingStats({
505
+ tokenCount: 0,
506
+ contextSize: client.getContextSize(),
507
+ totalTokensUsed: systemTokens + existingConversationTokens,
508
+ });
509
+ // Use the new conversation loop
510
+ await processAssistantResponseWithTokenTracking(systemMessage, updatedMessages, controller);
511
+ }
512
+ catch (error) {
513
+ if (error instanceof Error &&
514
+ error.message === 'Operation was cancelled') {
515
+ addToChatQueue(_jsx(ErrorMessage, { message: "Operation was cancelled by user", hideBox: true }, `cancelled-${componentKeyCounter}`));
516
+ }
517
+ else {
518
+ addToChatQueue(_jsx(ErrorMessage, { message: `Chat error: ${error}` }, `error-${componentKeyCounter}`));
519
+ }
520
+ }
521
+ finally {
522
+ setIsThinking(false);
523
+ setIsCancelling(false);
524
+ setAbortController(null);
525
+ }
526
+ };
527
+ return {
528
+ handleChatMessage,
529
+ processAssistantResponse,
530
+ };
531
+ }
532
+ //# sourceMappingURL=useChatHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useChatHandler.js","sourceRoot":"","sources":["../../../source/app/hooks/useChatHandler.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAC,qBAAqB,EAAC,MAAM,iCAAiC,CAAC;AACtE,OAAO,EACN,yBAAyB,EACzB,yBAAyB,GACzB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAC,wBAAwB,EAAC,MAAM,+BAA+B,CAAC;AACvE,OAAO,WAAW,MAAM,kCAAkC,CAAC;AAC3D,OAAO,gBAAgB,MAAM,uCAAuC,CAAC;AACrE,OAAO,YAAY,MAAM,mCAAmC,CAAC;AAC7D,OAAO,WAAW,MAAM,kCAAkC,CAAC;AAE3D,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,sFAAsF;AACtF,MAAM,oBAAoB,GAAG,CAAC,SAAgB,EAAS,EAAE;IACxD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,MAAM,iBAAiB,GAAG,IAA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,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,YAAY;aACrB,CAAC;YAEF,gCAAgC;YAChC,gEAAgE;YAChE,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YACjE,gBAAgB,CAAC;gBAChB,UAAU,EAAE,CAAC;gBACb,WAAW,EAAE,MAAM,CAAC,cAAc,EAAE;gBACpC,eAAe,EAAE,YAAY,GAAG,0BAA0B;aAC1D,CAAC,CAAC;YAEH,gCAAgC;YAChC,MAAM,yCAAyC,CAC9C,aAAa,EACb,eAAe,EACf,UAAU,CACV,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,IACC,KAAK,YAAY,KAAK;gBACtB,KAAK,CAAC,OAAO,KAAK,yBAAyB,EAC1C,CAAC;gBACF,cAAc,CACb,KAAC,YAAY,IAEZ,OAAO,EAAC,iCAAiC,EACzC,OAAO,EAAE,IAAI,IAFR,aAAa,mBAAmB,EAAE,CAGtC,CACF,CAAC;YACH,CAAC;iBAAM,CAAC;gBACP,cAAc,CACb,KAAC,YAAY,IAEZ,OAAO,EAAE,eAAe,KAAK,EAAE,IAD1B,SAAS,mBAAmB,EAAE,CAElC,CACF,CAAC;YACH,CAAC;QACF,CAAC;gBAAS,CAAC;YACV,aAAa,CAAC,KAAK,CAAC,CAAC;YACrB,eAAe,CAAC,KAAK,CAAC,CAAC;YACvB,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;IACF,CAAC,CAAC;IAEF,OAAO;QACN,iBAAiB;QACjB,wBAAwB;KACxB,CAAC;AACH,CAAC"}
@@ -0,0 +1,15 @@
1
+ export interface UseDirectoryTrustReturn {
2
+ isTrusted: boolean;
3
+ handleConfirmTrust: () => void;
4
+ isTrustLoading: boolean;
5
+ isTrustedError: string | null;
6
+ }
7
+ /**
8
+ * Custom hook for managing directory trust functionality.
9
+ * Handles checking if a directory is trusted and adding it to trusted directories.
10
+ *
11
+ * @param directory - The directory path to check trust for (defaults to current working directory)
12
+ * @returns Object containing trust state and handler functions
13
+ */
14
+ export declare function useDirectoryTrust(directory?: string): UseDirectoryTrustReturn;
15
+ //# sourceMappingURL=useDirectoryTrust.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDirectoryTrust.d.ts","sourceRoot":"","sources":["../../../source/app/hooks/useDirectoryTrust.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,uBAAuB;IACpC,SAAS,EAAE,OAAO,CAAC;IACnB,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,cAAc,EAAE,OAAO,CAAC;IACxB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,GAAE,MAAsB,GAAG,uBAAuB,CA4E5F"}