@buoy-gg/ask-buoy 7.0.38 → 7.0.39

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 (306) hide show
  1. package/lib/commonjs/blocks/AskBlocks.js +338 -1
  2. package/lib/commonjs/blocks/AskBlocks.js.map +1 -0
  3. package/lib/commonjs/blocks/BlockRenderer.js +262 -1
  4. package/lib/commonjs/blocks/BlockRenderer.js.map +1 -0
  5. package/lib/commonjs/blocks/ChromePrototypes.js +514 -1
  6. package/lib/commonjs/blocks/ChromePrototypes.js.map +1 -0
  7. package/lib/commonjs/blocks/DataBlocks.js +781 -1
  8. package/lib/commonjs/blocks/DataBlocks.js.map +1 -0
  9. package/lib/commonjs/blocks/ExtraBlocks.js +1860 -1
  10. package/lib/commonjs/blocks/ExtraBlocks.js.map +1 -0
  11. package/lib/commonjs/blocks/MediaBlocks.js +156 -1
  12. package/lib/commonjs/blocks/MediaBlocks.js.map +1 -0
  13. package/lib/commonjs/blocks/ReceiptBlocks.js +586 -1
  14. package/lib/commonjs/blocks/ReceiptBlocks.js.map +1 -0
  15. package/lib/commonjs/blocks/blockText.js +60 -1
  16. package/lib/commonjs/blocks/blockText.js.map +1 -0
  17. package/lib/commonjs/blocks/blockText.test.js +53 -1
  18. package/lib/commonjs/blocks/blockText.test.js.map +1 -0
  19. package/lib/commonjs/blocks/context.js +42 -1
  20. package/lib/commonjs/blocks/context.js.map +1 -0
  21. package/lib/commonjs/blocks/icons.js +96 -1
  22. package/lib/commonjs/blocks/icons.js.map +1 -0
  23. package/lib/commonjs/blocks/index.js +95 -1
  24. package/lib/commonjs/blocks/index.js.map +1 -0
  25. package/lib/commonjs/blocks/listRow.test.js +55 -1
  26. package/lib/commonjs/blocks/listRow.test.js.map +1 -0
  27. package/lib/commonjs/blocks/pageState.js +34 -1
  28. package/lib/commonjs/blocks/pageState.js.map +1 -0
  29. package/lib/commonjs/blocks/pageState.test.js +57 -1
  30. package/lib/commonjs/blocks/pageState.test.js.map +1 -0
  31. package/lib/commonjs/blocks/primitives.js +457 -1
  32. package/lib/commonjs/blocks/primitives.js.map +1 -0
  33. package/lib/commonjs/blocks/primitivesIndex.js +62 -1
  34. package/lib/commonjs/blocks/primitivesIndex.js.map +1 -0
  35. package/lib/commonjs/components/ApprovalCard.js +297 -1
  36. package/lib/commonjs/components/ApprovalCard.js.map +1 -0
  37. package/lib/commonjs/components/AskBuoyHeader.js +196 -1
  38. package/lib/commonjs/components/AskBuoyHeader.js.map +1 -0
  39. package/lib/commonjs/components/AskBuoyIcon.js +19 -1
  40. package/lib/commonjs/components/AskBuoyIcon.js.map +1 -0
  41. package/lib/commonjs/components/AskBuoyModal.js +479 -1
  42. package/lib/commonjs/components/AskBuoyModal.js.map +1 -0
  43. package/lib/commonjs/components/AskBuoySettings.js +181 -1
  44. package/lib/commonjs/components/AskBuoySettings.js.map +1 -0
  45. package/lib/commonjs/components/ChangesBar.js +211 -1
  46. package/lib/commonjs/components/ChangesBar.js.map +1 -0
  47. package/lib/commonjs/components/Composer.js +255 -1
  48. package/lib/commonjs/components/Composer.js.map +1 -0
  49. package/lib/commonjs/components/EmptyState.js +161 -1
  50. package/lib/commonjs/components/EmptyState.js.map +1 -0
  51. package/lib/commonjs/components/KeyboardPad.js +80 -1
  52. package/lib/commonjs/components/KeyboardPad.js.map +1 -0
  53. package/lib/commonjs/components/Markdown.js +310 -1
  54. package/lib/commonjs/components/Markdown.js.map +1 -0
  55. package/lib/commonjs/components/MessageList.js +970 -1
  56. package/lib/commonjs/components/MessageList.js.map +1 -0
  57. package/lib/commonjs/components/QueuedMessages.js +145 -1
  58. package/lib/commonjs/components/QueuedMessages.js.map +1 -0
  59. package/lib/commonjs/components/ThinkingStrip.js +223 -1
  60. package/lib/commonjs/components/ThinkingStrip.js.map +1 -0
  61. package/lib/commonjs/components/TypingDots.js +63 -1
  62. package/lib/commonjs/components/TypingDots.js.map +1 -0
  63. package/lib/commonjs/components/markdownParse.js +131 -1
  64. package/lib/commonjs/components/markdownParse.js.map +1 -0
  65. package/lib/commonjs/components/markdownParse.test.js +99 -1
  66. package/lib/commonjs/components/markdownParse.test.js.map +1 -0
  67. package/lib/commonjs/components/useCopyAction.js +50 -1
  68. package/lib/commonjs/components/useCopyAction.js.map +1 -0
  69. package/lib/commonjs/index.js +252 -1
  70. package/lib/commonjs/index.js.map +1 -0
  71. package/lib/commonjs/preset.js +91 -1
  72. package/lib/commonjs/preset.js.map +1 -0
  73. package/lib/commonjs/store/activityGroups.js +110 -1
  74. package/lib/commonjs/store/activityGroups.js.map +1 -0
  75. package/lib/commonjs/store/activityGroups.test.js +78 -1
  76. package/lib/commonjs/store/activityGroups.test.js.map +1 -0
  77. package/lib/commonjs/store/askBuoySettings.js +72 -1
  78. package/lib/commonjs/store/askBuoySettings.js.map +1 -0
  79. package/lib/commonjs/store/askBuoyStore.js +589 -1
  80. package/lib/commonjs/store/askBuoyStore.js.map +1 -0
  81. package/lib/commonjs/store/blockPlacement.js +64 -1
  82. package/lib/commonjs/store/blockPlacement.js.map +1 -0
  83. package/lib/commonjs/store/blockPlacement.test.js +123 -1
  84. package/lib/commonjs/store/blockPlacement.test.js.map +1 -0
  85. package/lib/commonjs/store/queue.test.js +150 -1
  86. package/lib/commonjs/store/queue.test.js.map +1 -0
  87. package/lib/commonjs/store/resetConversation.js +77 -1
  88. package/lib/commonjs/store/resetConversation.js.map +1 -0
  89. package/lib/commonjs/store/restorePending.test.js +63 -1
  90. package/lib/commonjs/store/restorePending.test.js.map +1 -0
  91. package/lib/commonjs/store/restoredIds.test.js +47 -1
  92. package/lib/commonjs/store/restoredIds.test.js.map +1 -0
  93. package/lib/commonjs/store/suggestions.js +54 -1
  94. package/lib/commonjs/store/suggestions.js.map +1 -0
  95. package/lib/commonjs/store/suggestions.test.js +58 -1
  96. package/lib/commonjs/store/suggestions.test.js.map +1 -0
  97. package/lib/commonjs/store/systemLine.test.js +77 -1
  98. package/lib/commonjs/store/systemLine.test.js.map +1 -0
  99. package/lib/commonjs/store/ticketPrompt.js +17 -1
  100. package/lib/commonjs/store/ticketPrompt.js.map +1 -0
  101. package/lib/commonjs/store/traceText.js +81 -1
  102. package/lib/commonjs/store/traceText.js.map +1 -0
  103. package/lib/commonjs/store/traceText.test.js +112 -1
  104. package/lib/commonjs/store/traceText.test.js.map +1 -0
  105. package/lib/commonjs/store/transcriptPersistence.js +297 -1
  106. package/lib/commonjs/store/transcriptPersistence.js.map +1 -0
  107. package/lib/commonjs/store/transcriptPersistence.test.js +333 -1
  108. package/lib/commonjs/store/transcriptPersistence.test.js.map +1 -0
  109. package/lib/commonjs/store/turnRendering.test.js +151 -1
  110. package/lib/commonjs/store/turnRendering.test.js.map +1 -0
  111. package/lib/commonjs/store/useAskBuoy.js +651 -1
  112. package/lib/commonjs/store/useAskBuoy.js.map +1 -0
  113. package/lib/commonjs/store/useAskBuoySettings.js +14 -1
  114. package/lib/commonjs/store/useAskBuoySettings.js.map +1 -0
  115. package/lib/commonjs/sync/askBuoySyncAdapter.js +153 -1
  116. package/lib/commonjs/sync/askBuoySyncAdapter.js.map +1 -0
  117. package/lib/commonjs/sync/askBuoySyncAdapter.test.js +141 -1
  118. package/lib/commonjs/sync/askBuoySyncAdapter.test.js.map +1 -0
  119. package/lib/commonjs/sync/wire.js +58 -1
  120. package/lib/commonjs/sync/wire.js.map +1 -0
  121. package/lib/commonjs/types.js +6 -1
  122. package/lib/commonjs/types.js.map +1 -0
  123. package/lib/module/blocks/AskBlocks.js +331 -1
  124. package/lib/module/blocks/AskBlocks.js.map +1 -0
  125. package/lib/module/blocks/BlockRenderer.js +257 -1
  126. package/lib/module/blocks/BlockRenderer.js.map +1 -0
  127. package/lib/module/blocks/ChromePrototypes.js +503 -1
  128. package/lib/module/blocks/ChromePrototypes.js.map +1 -0
  129. package/lib/module/blocks/DataBlocks.js +767 -1
  130. package/lib/module/blocks/DataBlocks.js.map +1 -0
  131. package/lib/module/blocks/ExtraBlocks.js +1833 -1
  132. package/lib/module/blocks/ExtraBlocks.js.map +1 -0
  133. package/lib/module/blocks/MediaBlocks.js +151 -1
  134. package/lib/module/blocks/MediaBlocks.js.map +1 -0
  135. package/lib/module/blocks/ReceiptBlocks.js +574 -1
  136. package/lib/module/blocks/ReceiptBlocks.js.map +1 -0
  137. package/lib/module/blocks/blockText.js +55 -1
  138. package/lib/module/blocks/blockText.js.map +1 -0
  139. package/lib/module/blocks/blockText.test.js +53 -1
  140. package/lib/module/blocks/blockText.test.js.map +1 -0
  141. package/lib/module/blocks/context.js +35 -1
  142. package/lib/module/blocks/context.js.map +1 -0
  143. package/lib/module/blocks/icons.js +91 -1
  144. package/lib/module/blocks/icons.js.map +1 -0
  145. package/lib/module/blocks/index.js +8 -1
  146. package/lib/module/blocks/index.js.map +1 -0
  147. package/lib/module/blocks/listRow.test.js +56 -1
  148. package/lib/module/blocks/listRow.test.js.map +1 -0
  149. package/lib/module/blocks/pageState.js +30 -1
  150. package/lib/module/blocks/pageState.js.map +1 -0
  151. package/lib/module/blocks/pageState.test.js +56 -1
  152. package/lib/module/blocks/pageState.test.js.map +1 -0
  153. package/lib/module/blocks/primitives.js +445 -1
  154. package/lib/module/blocks/primitives.js.map +1 -0
  155. package/lib/module/blocks/primitivesIndex.js +5 -1
  156. package/lib/module/blocks/primitivesIndex.js.map +1 -0
  157. package/lib/module/components/ApprovalCard.js +292 -1
  158. package/lib/module/components/ApprovalCard.js.map +1 -0
  159. package/lib/module/components/AskBuoyHeader.js +193 -1
  160. package/lib/module/components/AskBuoyHeader.js.map +1 -0
  161. package/lib/module/components/AskBuoyIcon.js +8 -1
  162. package/lib/module/components/AskBuoyIcon.js.map +1 -0
  163. package/lib/module/components/AskBuoyModal.js +474 -1
  164. package/lib/module/components/AskBuoyModal.js.map +1 -0
  165. package/lib/module/components/AskBuoySettings.js +176 -1
  166. package/lib/module/components/AskBuoySettings.js.map +1 -0
  167. package/lib/module/components/ChangesBar.js +206 -1
  168. package/lib/module/components/ChangesBar.js.map +1 -0
  169. package/lib/module/components/Composer.js +250 -1
  170. package/lib/module/components/Composer.js.map +1 -0
  171. package/lib/module/components/EmptyState.js +156 -1
  172. package/lib/module/components/EmptyState.js.map +1 -0
  173. package/lib/module/components/KeyboardPad.js +75 -1
  174. package/lib/module/components/KeyboardPad.js.map +1 -0
  175. package/lib/module/components/Markdown.js +305 -1
  176. package/lib/module/components/Markdown.js.map +1 -0
  177. package/lib/module/components/MessageList.js +964 -1
  178. package/lib/module/components/MessageList.js.map +1 -0
  179. package/lib/module/components/QueuedMessages.js +140 -1
  180. package/lib/module/components/QueuedMessages.js.map +1 -0
  181. package/lib/module/components/ThinkingStrip.js +218 -1
  182. package/lib/module/components/ThinkingStrip.js.map +1 -0
  183. package/lib/module/components/TypingDots.js +58 -1
  184. package/lib/module/components/TypingDots.js.map +1 -0
  185. package/lib/module/components/markdownParse.js +125 -1
  186. package/lib/module/components/markdownParse.js.map +1 -0
  187. package/lib/module/components/markdownParse.test.js +98 -1
  188. package/lib/module/components/markdownParse.test.js.map +1 -0
  189. package/lib/module/components/useCopyAction.js +46 -1
  190. package/lib/module/components/useCopyAction.js.map +1 -0
  191. package/lib/module/index.js +34 -1
  192. package/lib/module/index.js.map +1 -0
  193. package/lib/module/preset.js +74 -1
  194. package/lib/module/preset.js.map +1 -0
  195. package/lib/module/store/activityGroups.js +103 -1
  196. package/lib/module/store/activityGroups.js.map +1 -0
  197. package/lib/module/store/activityGroups.test.js +77 -1
  198. package/lib/module/store/activityGroups.test.js.map +1 -0
  199. package/lib/module/store/askBuoySettings.js +67 -1
  200. package/lib/module/store/askBuoySettings.js.map +1 -0
  201. package/lib/module/store/askBuoyStore.js +583 -1
  202. package/lib/module/store/askBuoyStore.js.map +1 -0
  203. package/lib/module/store/blockPlacement.js +59 -1
  204. package/lib/module/store/blockPlacement.js.map +1 -0
  205. package/lib/module/store/blockPlacement.test.js +122 -1
  206. package/lib/module/store/blockPlacement.test.js.map +1 -0
  207. package/lib/module/store/queue.test.js +149 -1
  208. package/lib/module/store/queue.test.js.map +1 -0
  209. package/lib/module/store/resetConversation.js +72 -1
  210. package/lib/module/store/resetConversation.js.map +1 -0
  211. package/lib/module/store/restorePending.test.js +62 -1
  212. package/lib/module/store/restorePending.test.js.map +1 -0
  213. package/lib/module/store/restoredIds.test.js +46 -1
  214. package/lib/module/store/restoredIds.test.js.map +1 -0
  215. package/lib/module/store/suggestions.js +49 -1
  216. package/lib/module/store/suggestions.js.map +1 -0
  217. package/lib/module/store/suggestions.test.js +57 -1
  218. package/lib/module/store/suggestions.test.js.map +1 -0
  219. package/lib/module/store/systemLine.test.js +76 -1
  220. package/lib/module/store/systemLine.test.js.map +1 -0
  221. package/lib/module/store/ticketPrompt.js +13 -1
  222. package/lib/module/store/ticketPrompt.js.map +1 -0
  223. package/lib/module/store/traceText.js +75 -1
  224. package/lib/module/store/traceText.js.map +1 -0
  225. package/lib/module/store/traceText.test.js +111 -1
  226. package/lib/module/store/traceText.test.js.map +1 -0
  227. package/lib/module/store/transcriptPersistence.js +287 -1
  228. package/lib/module/store/transcriptPersistence.js.map +1 -0
  229. package/lib/module/store/transcriptPersistence.test.js +332 -1
  230. package/lib/module/store/transcriptPersistence.test.js.map +1 -0
  231. package/lib/module/store/turnRendering.test.js +150 -1
  232. package/lib/module/store/turnRendering.test.js.map +1 -0
  233. package/lib/module/store/useAskBuoy.js +646 -1
  234. package/lib/module/store/useAskBuoy.js.map +1 -0
  235. package/lib/module/store/useAskBuoySettings.js +9 -1
  236. package/lib/module/store/useAskBuoySettings.js.map +1 -0
  237. package/lib/module/sync/askBuoySyncAdapter.js +148 -1
  238. package/lib/module/sync/askBuoySyncAdapter.js.map +1 -0
  239. package/lib/module/sync/askBuoySyncAdapter.test.js +140 -1
  240. package/lib/module/sync/askBuoySyncAdapter.test.js.map +1 -0
  241. package/lib/module/sync/wire.js +47 -1
  242. package/lib/module/sync/wire.js.map +1 -0
  243. package/lib/module/types.js +4 -1
  244. package/lib/module/types.js.map +1 -0
  245. package/lib/typescript/blocks/AskBlocks.d.ts.map +1 -0
  246. package/lib/typescript/blocks/BlockRenderer.d.ts.map +1 -0
  247. package/lib/typescript/blocks/ChromePrototypes.d.ts.map +1 -0
  248. package/lib/typescript/blocks/DataBlocks.d.ts.map +1 -0
  249. package/lib/typescript/blocks/ExtraBlocks.d.ts.map +1 -0
  250. package/lib/typescript/blocks/MediaBlocks.d.ts.map +1 -0
  251. package/lib/typescript/blocks/ReceiptBlocks.d.ts.map +1 -0
  252. package/lib/typescript/blocks/blockText.d.ts.map +1 -0
  253. package/lib/typescript/blocks/blockText.test.d.ts.map +1 -0
  254. package/lib/typescript/blocks/context.d.ts.map +1 -0
  255. package/lib/typescript/blocks/icons.d.ts.map +1 -0
  256. package/lib/typescript/blocks/index.d.ts.map +1 -0
  257. package/lib/typescript/blocks/listRow.test.d.ts.map +1 -0
  258. package/lib/typescript/blocks/pageState.d.ts.map +1 -0
  259. package/lib/typescript/blocks/pageState.test.d.ts.map +1 -0
  260. package/lib/typescript/blocks/primitives.d.ts.map +1 -0
  261. package/lib/typescript/blocks/primitivesIndex.d.ts.map +1 -0
  262. package/lib/typescript/components/ApprovalCard.d.ts.map +1 -0
  263. package/lib/typescript/components/AskBuoyHeader.d.ts.map +1 -0
  264. package/lib/typescript/components/AskBuoyIcon.d.ts.map +1 -0
  265. package/lib/typescript/components/AskBuoyModal.d.ts.map +1 -0
  266. package/lib/typescript/components/AskBuoySettings.d.ts.map +1 -0
  267. package/lib/typescript/components/ChangesBar.d.ts.map +1 -0
  268. package/lib/typescript/components/Composer.d.ts.map +1 -0
  269. package/lib/typescript/components/EmptyState.d.ts.map +1 -0
  270. package/lib/typescript/components/KeyboardPad.d.ts.map +1 -0
  271. package/lib/typescript/components/Markdown.d.ts.map +1 -0
  272. package/lib/typescript/components/MessageList.d.ts.map +1 -0
  273. package/lib/typescript/components/QueuedMessages.d.ts.map +1 -0
  274. package/lib/typescript/components/ThinkingStrip.d.ts.map +1 -0
  275. package/lib/typescript/components/TypingDots.d.ts.map +1 -0
  276. package/lib/typescript/components/markdownParse.d.ts.map +1 -0
  277. package/lib/typescript/components/markdownParse.test.d.ts.map +1 -0
  278. package/lib/typescript/components/useCopyAction.d.ts.map +1 -0
  279. package/lib/typescript/index.d.ts.map +1 -0
  280. package/lib/typescript/preset.d.ts.map +1 -0
  281. package/lib/typescript/store/activityGroups.d.ts.map +1 -0
  282. package/lib/typescript/store/activityGroups.test.d.ts.map +1 -0
  283. package/lib/typescript/store/askBuoySettings.d.ts.map +1 -0
  284. package/lib/typescript/store/askBuoyStore.d.ts.map +1 -0
  285. package/lib/typescript/store/blockPlacement.d.ts.map +1 -0
  286. package/lib/typescript/store/blockPlacement.test.d.ts.map +1 -0
  287. package/lib/typescript/store/queue.test.d.ts.map +1 -0
  288. package/lib/typescript/store/resetConversation.d.ts.map +1 -0
  289. package/lib/typescript/store/restorePending.test.d.ts.map +1 -0
  290. package/lib/typescript/store/restoredIds.test.d.ts.map +1 -0
  291. package/lib/typescript/store/suggestions.d.ts.map +1 -0
  292. package/lib/typescript/store/suggestions.test.d.ts.map +1 -0
  293. package/lib/typescript/store/systemLine.test.d.ts.map +1 -0
  294. package/lib/typescript/store/ticketPrompt.d.ts.map +1 -0
  295. package/lib/typescript/store/traceText.d.ts.map +1 -0
  296. package/lib/typescript/store/traceText.test.d.ts.map +1 -0
  297. package/lib/typescript/store/transcriptPersistence.d.ts.map +1 -0
  298. package/lib/typescript/store/transcriptPersistence.test.d.ts.map +1 -0
  299. package/lib/typescript/store/turnRendering.test.d.ts.map +1 -0
  300. package/lib/typescript/store/useAskBuoy.d.ts.map +1 -0
  301. package/lib/typescript/store/useAskBuoySettings.d.ts.map +1 -0
  302. package/lib/typescript/sync/askBuoySyncAdapter.d.ts.map +1 -0
  303. package/lib/typescript/sync/askBuoySyncAdapter.test.d.ts.map +1 -0
  304. package/lib/typescript/sync/wire.d.ts.map +1 -0
  305. package/lib/typescript/types.d.ts.map +1 -0
  306. package/package.json +8 -8
@@ -1 +1,474 @@
1
- "use strict";import{useCallback,useEffect,useMemo,useRef,useState}from"react";import{Alert,Animated,StyleSheet,Text,View}from"react-native";import{isReversible}from"@buoy-gg/agent-core";import{dispatchToolAction,FeatureGate,Info,JsModal,ModalHeader,night,setToolAttention,useSafeAreaInsets}from"@buoy-gg/shared-ui";import{BlockHandlersProvider}from"../blocks";import{ApprovalCard}from"./ApprovalCard";import{ChangesBar}from"./ChangesBar";import{Composer}from"./Composer";import{KeyboardPad}from"./KeyboardPad";import{AskBuoyHeader}from"./AskBuoyHeader";import{AskBuoySettings}from"./AskBuoySettings";import{EmptyState}from"./EmptyState";import{MessageList,transcriptToText}from"./MessageList";import{QueuedMessages}from"./QueuedMessages";import{askBuoyStore,queuePauseReason}from"../store/askBuoyStore";import{TICKET_PROMPT}from"../store/ticketPrompt";import{useAskBuoy}from"../store/useAskBuoy";import{useAskBuoySettings}from"../store/useAskBuoySettings";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";export function AskBuoyModal({visible:e,onClose:t,onBack:s,onMinimize:o,persistenceKey:n,config:a}){const{state:r,send:i,stop:l,reset:u,undoThenReset:d,approve:c,retry:g,answer:m,runAction:p,editQueued:y,removeQueued:f,configured:b,toolCount:k,availableToolIds:h}=useAskBuoy(a),[A,x]=useState(!1),C=useCallback(()=>{l(),t()},[l,t]),S=useCallback(()=>askBuoyStore.clearDraft(),[]),[B,T]=useState(!1),v=useCallback(()=>T(!1),[]),j=useCallback(()=>T(!0),[]),_=!e,w=!!r.pending||!!r.awaitingBlockId,M=r.messages[r.messages.length-1],P=useRef(!1),R=useRef(r.busy);useEffect(()=>{_&&R.current&&!r.busy&&(P.current=!0),_||(P.current=!1),R.current=r.busy},[_,r.busy]),useEffect(()=>{_?w?setToolAttention("ask-buoy",{kind:"needsInput",label:r.pending?"Needs your approval":"Has a question for you"}):P.current&&"assistant"===M?.role&&M.error?setToolAttention("ask-buoy",{kind:"failed",label:"The last turn failed"}):P.current&&!r.busy?setToolAttention("ask-buoy",{kind:"done",label:"Finished"}):setToolAttention("ask-buoy",null):setToolAttention("ask-buoy",null)},[_,w,r.busy,r.pending,M]),useEffect(()=>()=>setToolAttention("ask-buoy",null),[]),useEffect(()=>{r.pending&&B&&T(!1)},[r.pending,B]);const $=useSafeAreaInsets({minBottom:16}),[I,H]=useState("bottomSheet"),E="floating"===I?0:$.bottom,K=useCallback(()=>{const e=askBuoyStore.getLedger();e&&(async()=>{const t=await e.revertAll(dispatchToolAction);if(0===t.failed.length)return void askBuoyStore.setNotice(null);const s=t.failed.map(e=>`${e.label} (${e.error})`).join("; ");askBuoyStore.setNotice(`Couldn't undo ${t.failed.length} change${1===t.failed.length?"":"s"} — ${s}`)})()},[]),L=useCallback(()=>x(e=>!e),[]),O=useRef(new Animated.Value(560)).current,z=useRef(!1),D=useCallback(()=>{z.current||(z.current=!0,O.stopAnimation(e=>{const t="number"==typeof e&&e>200?e:560;Animated.timing(O,{toValue:120,duration:220,useNativeDriver:!1}).start(()=>{setTimeout(()=>{Animated.spring(O,{toValue:t,friction:9,useNativeDriver:!1}).start(()=>{z.current=!1})},2500)})}))},[O]),F=useMemo(()=>{const e=r.messages[r.messages.length-1];if(!e||"assistant"!==e.role)return"";const t=e.blocks.filter(e=>"peek"===e.block.kind).length;return t>0?`${e.id}:${t}`:""},[r.messages]),N=useRef("");useEffect(()=>{F&&F!==N.current&&!1!==a?.peek&&D(),N.current=F},[F,D,a]);const V=useCallback(()=>{const e=askBuoyStore.getLedger(),t=e?.list().filter(e=>!e.undoneAt&&isReversible(e.effect)).length??0;0!==t?Alert.alert("Undo changes first?",`Ask Buoy made ${t} change${1===t?"":"s"} that can still be undone. Clearing the conversation loses the only automatic undo for ${1===t?"it":"them"}.`,[{text:"Undo, then clear",onPress:()=>{(async()=>{const e=await d();if(e.cleared)return;const t=e.reverted+e.failed.length,s=e.failed.map(e=>`${e.label} (${e.error})`).join("\n");Alert.alert(`Couldn't undo ${e.failed.length} of ${t} change${1===t?"":"s"}`,`${s}\n\nStill applied in the app. Clear the conversation anyway?`,[{text:"Keep conversation",style:"cancel"},{text:"Clear anyway",style:"destructive",onPress:u}])})()}},{text:"Clear anyway",style:"destructive",onPress:u},{text:"Cancel",style:"cancel"}]):u()},[u,d]),Q=useMemo(()=>{const e=r.messages[r.messages.length-1];return e&&"assistant"===e.role&&e.streaming?e.toolCalls.find(e=>"running"===e.status)?.label??null:null},[r.messages]),q=useMemo(()=>({answer:m,runAction:(e,t)=>{if(!e.minimize)return p(e,t);o?.({mode:"bottomSheet"})},answered:r.answers,actionState:r.actionState,busy:r.busy,supports:{openTool:!1,minimize:!!o,dispatch:!0}}),[m,p,o,r.answers,r.actionState,r.busy]),U=!r.busy&&"assistant"===M?.role&&!!M.error,G=r.busy||"assistant"!==M?.role||!M.stopped||M.error?null:M.id,J=queuePauseReason(r),{showThinking:W,readOnly:X}=useAskBuoySettings(),Y=useCallback(()=>transcriptToText(r.messages,W),[r.messages,W]),Z=useCallback(()=>i(TICKET_PROMPT),[i]),ee=B?_jsxs(ModalHeader,{children:[_jsx(ModalHeader.Navigation,{onBack:v}),_jsx(ModalHeader.Content,{title:"Settings",subtitle:"Ask Buoy",testID:"buoy-ask-buoy-settings-title"})]}):_jsx(AskBuoyHeader,{configured:b,busy:r.busy,failed:U,activeLabel:Q,awaitingApproval:!!r.pending,startedAt:"assistant"===M?.role&&M.streaming?M.startedAt??null:null,stopping:r.stopping,readOnly:X,toolCount:k,hasMessages:r.messages.length>0,onBack:s,onReset:V,getTranscript:Y,onOpenSettings:j,onTicket:Z});return _jsx(JsModal,{visible:e,onClose:C,disableScrollWrapper:!0,background:!1,initialHeight:560,animatedHeight:O,header:{customContent:ee,showToggleButton:!1},onBack:s,onMinimize:o,onModeChange:H,persistenceKey:n??"buoy-ask-buoy",enablePersistence:!0,children:_jsx(BlockHandlersProvider,{value:q,children:_jsxs(View,{style:[styles.root,{paddingBottom:E}],children:[_jsx(ChangesBar,{ledger:askBuoyStore.getLedger(),onUndoAll:K,expanded:A,onToggle:L}),r.notice&&_jsxs(View,{style:styles.notice,testID:"buoy-ask-buoy-notice",children:[_jsx(Info,{size:14,color:night.color.info}),_jsx(Text,{style:styles.noticeText,children:r.notice})]}),_jsx(KeyboardPad,{children:_jsx(FeatureGate,{featureName:"Ask Buoy",children:B?_jsx(AskBuoySettings,{}):_jsxs(_Fragment,{children:[_jsx(MessageList,{messages:r.messages,onRetry:g,waitingOnUser:!!r.pending||!!r.awaitingBlockId,ListEmptyComponent:_jsx(EmptyState,{configured:b,onPick:i,availableToolIds:h,readOnly:X||!!a?.policy?.readOnly})}),_jsx(QueuedMessages,{items:r.queued,paused:J,onEdit:y,onRemove:f}),r.pending&&_jsx(ApprovalCard,{pending:r.pending,onAnswer:c}),_jsx(Composer,{onSend:i,onStop:l,busy:r.busy,draft:r.draft,onDraftTaken:S,disabled:!b,focusKey:G,canFocus:e,placeholder:G?"Tell it what to do differently…":r.awaitingBlockId?"Pick an option above, or type…":void 0})]})})})]})})})}const styles=StyleSheet.create({root:{flex:1,backgroundColor:"transparent"},notice:{flexDirection:"row",alignItems:"flex-start",gap:8,paddingHorizontal:night.gutter,paddingVertical:10,backgroundColor:night.color.infoSoft},noticeText:{flex:1,color:night.color.text,fontSize:night.font.caption,lineHeight:18}});
1
+ "use strict";
2
+
3
+ /**
4
+ * Ask Buoy — the sheet.
5
+ *
6
+ * Manual JsModal chrome rather than the declarative `InstalledApp.modal` path,
7
+ * because `ToolModalShell` forwards neither `footer`/`footerHeight` nor
8
+ * `initialHeight`, and a conversation in a 400pt sheet with no sticky composer
9
+ * is not usable.
10
+ *
11
+ * The layout rules here are all learned ones, each noted at its line: one
12
+ * scroller owned by the message list, no animated background competing with
13
+ * streaming text, transparent containers so the sheet's own chrome shows, and
14
+ * an iOS-only keyboard offset.
15
+ *
16
+ * Top to bottom: header (title, live status, new-conversation) · changes bar
17
+ * (only once something has been changed) · transcript · approval card (only
18
+ * with `requireApproval`) · composer. Nothing else. The old "New conversation"
19
+ * text link under the composer is gone — it is the header's + button now.
20
+ */
21
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
22
+ import { Alert, Animated, StyleSheet, Text, View } from "react-native";
23
+ import { isReversible } from "@buoy-gg/agent-core";
24
+ import { dispatchToolAction, FeatureGate, Info, JsModal, ModalHeader, night, setToolAttention, useSafeAreaInsets } from "@buoy-gg/shared-ui";
25
+ import { BlockHandlersProvider } from "../blocks";
26
+ import { ApprovalCard } from "./ApprovalCard";
27
+ import { ChangesBar } from "./ChangesBar";
28
+ import { Composer } from "./Composer";
29
+ import { KeyboardPad } from "./KeyboardPad";
30
+ import { AskBuoyHeader } from "./AskBuoyHeader";
31
+ import { AskBuoySettings } from "./AskBuoySettings";
32
+ import { EmptyState } from "./EmptyState";
33
+ import { MessageList, transcriptToText } from "./MessageList";
34
+ import { QueuedMessages } from "./QueuedMessages";
35
+ import { askBuoyStore, queuePauseReason } from "../store/askBuoyStore";
36
+ import { TICKET_PROMPT } from "../store/ticketPrompt";
37
+ import { useAskBuoy } from "../store/useAskBuoy";
38
+ import { useAskBuoySettings } from "../store/useAskBuoySettings";
39
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
40
+ export function AskBuoyModal({
41
+ visible,
42
+ onClose,
43
+ onBack,
44
+ onMinimize,
45
+ persistenceKey,
46
+ config
47
+ }) {
48
+ const {
49
+ state,
50
+ send,
51
+ stop,
52
+ reset,
53
+ undoThenReset,
54
+ approve,
55
+ retry,
56
+ answer,
57
+ runAction,
58
+ editQueued,
59
+ removeQueued,
60
+ configured,
61
+ toolCount,
62
+ availableToolIds
63
+ } = useAskBuoy(config);
64
+ const [changesOpen, setChangesOpen] = useState(false);
65
+
66
+ /**
67
+ * Closing the sheet stops the turn.
68
+ *
69
+ * It did not, and the turn had no Stop left once the window was gone: closed
70
+ * mid-answer, the agent ran on invisibly — finishing tool calls and writing
71
+ * a full reply into a transcript nobody was watching. Dismissing the chat is
72
+ * the most natural "make it stop" gesture there is, and tool calls CHANGE
73
+ * THE APP, so a turn nobody can see or halt is the wrong thing to leave
74
+ * running. Minimise is the affordance for "keep going while I look" — that
75
+ * one deliberately does not stop anything.
76
+ */
77
+ const closeAndStop = useCallback(() => {
78
+ stop();
79
+ onClose();
80
+ }, [stop, onClose]);
81
+ const takeDraft = useCallback(() => askBuoyStore.clearDraft(), []);
82
+
83
+ /**
84
+ * Settings replaces the transcript in place rather than opening over it. The
85
+ * sheet's own back arrow is the way out, and the conversation is untouched
86
+ * underneath — a toggle you flip here should be visible the moment you go
87
+ * back, not after dismissing something.
88
+ */
89
+ const [showSettings, setShowSettings] = useState(false);
90
+ const closeSettings = useCallback(() => setShowSettings(false), []);
91
+ const openSettings = useCallback(() => setShowSettings(true), []);
92
+
93
+ /**
94
+ * An approval that arrives while the sheet is hidden HOLDS, and the rail says
95
+ * so.
96
+ *
97
+ * It used to auto-decline: minimised, the card was simply not on screen —
98
+ * the host keeps this component mounted with `visible={false}` — so the turn
99
+ * parked on a promise nobody could answer, and failing safe meant declining
100
+ * the change and ending the turn. Which made minimise mean "stop", the
101
+ * opposite of what it is for ("keep going while I look at the app").
102
+ *
103
+ * Now the chip in the minimised rail gets a badge — "!" for needs-input, a
104
+ * dot for finished or failed — through the `setToolAttention` seam, and
105
+ * tapping the chip is the existing restore path, so the card is one tap
106
+ * away rather than gone. The approval wait is already excluded from the
107
+ * turn's deadline, so holding costs nothing. Closing the sheet still stops.
108
+ *
109
+ * The settings view hides the card while `visible` stays true, so a question
110
+ * arriving there flips back to the chat: a card you cannot see is the
111
+ * original bug in a different coat.
112
+ */
113
+ const hidden = !visible;
114
+ const awaitingUser = !!state.pending || !!state.awaitingBlockId;
115
+ const lastMessage = state.messages[state.messages.length - 1];
116
+ const finishedWhileHidden = useRef(false);
117
+ const wasBusy = useRef(state.busy);
118
+ useEffect(() => {
119
+ if (hidden && wasBusy.current && !state.busy) finishedWhileHidden.current = true;
120
+ if (!hidden) finishedWhileHidden.current = false;
121
+ wasBusy.current = state.busy;
122
+ }, [hidden, state.busy]);
123
+ useEffect(() => {
124
+ if (!hidden) {
125
+ setToolAttention("ask-buoy", null);
126
+ return;
127
+ }
128
+ if (awaitingUser) {
129
+ setToolAttention("ask-buoy", {
130
+ kind: "needsInput",
131
+ label: state.pending ? "Needs your approval" : "Has a question for you"
132
+ });
133
+ } else if (finishedWhileHidden.current && lastMessage?.role === "assistant" && lastMessage.error) {
134
+ setToolAttention("ask-buoy", {
135
+ kind: "failed",
136
+ label: "The last turn failed"
137
+ });
138
+ } else if (finishedWhileHidden.current && !state.busy) {
139
+ setToolAttention("ask-buoy", {
140
+ kind: "done",
141
+ label: "Finished"
142
+ });
143
+ } else {
144
+ setToolAttention("ask-buoy", null);
145
+ }
146
+ }, [hidden, awaitingUser, state.busy, state.pending, lastMessage]);
147
+ useEffect(() => () => setToolAttention("ask-buoy", null), []);
148
+ useEffect(() => {
149
+ if (state.pending && showSettings) setShowSettings(false);
150
+ }, [state.pending, showSettings]);
151
+ // A hardcoded device map, not the native library — an unmapped phone
152
+ // silently returns bottom: 0, which is how footers ended up sitting on the
153
+ // home indicator.
154
+ const insets = useSafeAreaInsets({
155
+ minBottom: 16
156
+ });
157
+ /**
158
+ * The safe-area inset is for the HOME INDICATOR, and only a bottom sheet
159
+ * touches it. A floating window is positioned away from the screen edge and
160
+ * clips its own rounded corner, so the same padding is just a band of dead
161
+ * space under the composer in the smallest layout the tool has.
162
+ *
163
+ * JsModal owns the mode (it restores a persisted one on mount and reports it
164
+ * here), so this mirrors rather than decides. Default matches JsModal's own:
165
+ * a sheet until told otherwise.
166
+ */
167
+ const [mode, setMode] = useState("bottomSheet");
168
+ const bottomInset = mode === "floating" ? 0 : insets.bottom;
169
+
170
+ /**
171
+ * `dispatchToolAction` is imported STATICALLY at the top of this file, not
172
+ * with `import()`. A dynamic import here resolves through Metro's
173
+ * async-require path, which in a lazy dev bundle rejects with "Expected
174
+ * HMRClient.setup() call at startup" — and because the promise was voided,
175
+ * Undo did nothing at all while the bar went on claiming the changes were
176
+ * undoable. shared-ui is already a static dependency of this component.
177
+ *
178
+ * A failed revert is SHOWN. `revertAll` reports what it could not put back,
179
+ * and swallowing that is the same failure in a quieter form: the whole
180
+ * reason mutations may auto-run is that undo is real.
181
+ */
182
+ const undoAll = useCallback(() => {
183
+ const ledger = askBuoyStore.getLedger();
184
+ if (!ledger) return;
185
+ void (async () => {
186
+ const outcome = await ledger.revertAll(dispatchToolAction);
187
+ if (outcome.failed.length === 0) {
188
+ askBuoyStore.setNotice(null);
189
+ return;
190
+ }
191
+ const detail = outcome.failed.map(f => `${f.label} (${f.error})`).join("; ");
192
+ askBuoyStore.setNotice(`Couldn't undo ${outcome.failed.length} change${outcome.failed.length === 1 ? "" : "s"} — ${detail}`);
193
+ })();
194
+ }, []);
195
+ const toggleChanges = useCallback(() => setChangesOpen(v => !v), []);
196
+
197
+ /**
198
+ * PEEK. When the agent navigates or taps, the sheet drops to a 120pt strip
199
+ * for ~2.5s so the user watches the app do it, then springs back to the
200
+ * height it had (including a user's drag-resize — the value is read live,
201
+ * never assumed). Rides JsModal's external `animatedHeight` seam, so the
202
+ * modal's own drag-resize keeps working on the same value.
203
+ */
204
+ const sheetHeight = useRef(new Animated.Value(560)).current;
205
+ const peeking = useRef(false);
206
+ const runPeek = useCallback(() => {
207
+ if (peeking.current) return;
208
+ peeking.current = true;
209
+ sheetHeight.stopAnimation(from => {
210
+ const restoreTo = typeof from === "number" && from > 200 ? from : 560;
211
+ Animated.timing(sheetHeight, {
212
+ toValue: 120,
213
+ duration: 220,
214
+ useNativeDriver: false
215
+ }).start(() => {
216
+ setTimeout(() => {
217
+ Animated.spring(sheetHeight, {
218
+ toValue: restoreTo,
219
+ friction: 9,
220
+ useNativeDriver: false
221
+ }).start(() => {
222
+ peeking.current = false;
223
+ });
224
+ }, 2500);
225
+ });
226
+ });
227
+ }, [sheetHeight]);
228
+
229
+ // A new `peek` receipt (navigate, tap) triggers the shrink. Keyed by
230
+ // message id + count so a fresh assistant message restarts the count.
231
+ const peekKey = useMemo(() => {
232
+ const last = state.messages[state.messages.length - 1];
233
+ if (!last || last.role !== "assistant") return "";
234
+ const peeks = last.blocks.filter(p => p.block.kind === "peek").length;
235
+ return peeks > 0 ? `${last.id}:${peeks}` : "";
236
+ }, [state.messages]);
237
+ const prevPeekKey = useRef("");
238
+ useEffect(() => {
239
+ if (peekKey && peekKey !== prevPeekKey.current && config?.peek !== false) runPeek();
240
+ prevPeekKey.current = peekKey;
241
+ }, [peekKey, runPeek, config]);
242
+
243
+ /**
244
+ * New conversation, guarded. Clearing the session clears the ledger — the
245
+ * ONLY undo surface — while the agent's changes stay live in the app, so
246
+ * with reversible changes outstanding the user chooses their fate first.
247
+ *
248
+ * "Undo, then clear" reads the outcome. It did not: two of five reverts
249
+ * would fail (a key changed since) and the conversation cleared anyway,
250
+ * leaving two changes live with no record. Now a failed undo keeps the
251
+ * conversation and names what is still applied; clearing is a second,
252
+ * explicit tap. See resetConversation.ts.
253
+ */
254
+ const confirmReset = useCallback(() => {
255
+ const ledger = askBuoyStore.getLedger();
256
+ const reversible = ledger?.list().filter(e => !e.undoneAt && isReversible(e.effect)).length ?? 0;
257
+ if (reversible === 0) {
258
+ reset();
259
+ return;
260
+ }
261
+ Alert.alert("Undo changes first?", `Ask Buoy made ${reversible} change${reversible === 1 ? "" : "s"} that can still be undone. Clearing the conversation loses the only automatic undo for ${reversible === 1 ? "it" : "them"}.`, [{
262
+ text: "Undo, then clear",
263
+ onPress: () => {
264
+ void (async () => {
265
+ const outcome = await undoThenReset();
266
+ if (outcome.cleared) return;
267
+ const total = outcome.reverted + outcome.failed.length;
268
+ const stillApplied = outcome.failed.map(f => `${f.label} (${f.error})`).join("\n");
269
+ Alert.alert(`Couldn't undo ${outcome.failed.length} of ${total} change${total === 1 ? "" : "s"}`, `${stillApplied}\n\nStill applied in the app. Clear the conversation anyway?`, [{
270
+ text: "Keep conversation",
271
+ style: "cancel"
272
+ }, {
273
+ text: "Clear anyway",
274
+ style: "destructive",
275
+ onPress: reset
276
+ }]);
277
+ })();
278
+ }
279
+ }, {
280
+ text: "Clear anyway",
281
+ style: "destructive",
282
+ onPress: reset
283
+ }, {
284
+ text: "Cancel",
285
+ style: "cancel"
286
+ }]);
287
+ }, [reset, undoThenReset]);
288
+
289
+ // The header's live status: the title of whichever tool call is in flight.
290
+ const activeLabel = useMemo(() => {
291
+ const last = state.messages[state.messages.length - 1];
292
+ if (!last || last.role !== "assistant" || !last.streaming) return null;
293
+ return last.toolCalls.find(c => c.status === "running")?.label ?? null;
294
+ }, [state.messages]);
295
+
296
+ /**
297
+ * What a block can do in THIS host. `minimize` collapses the sheet to the
298
+ * rail so the user can look at the app (the peek chip). `openTool` has no
299
+ * seam yet, so those buttons don't render here rather than render dead.
300
+ */
301
+ const blockHandlers = useMemo(() => ({
302
+ answer,
303
+ runAction: (action, blockId) => {
304
+ if (action.minimize) {
305
+ onMinimize?.({
306
+ mode: "bottomSheet"
307
+ });
308
+ return;
309
+ }
310
+ return runAction(action, blockId);
311
+ },
312
+ answered: state.answers,
313
+ actionState: state.actionState,
314
+ busy: state.busy,
315
+ supports: {
316
+ openTool: false,
317
+ minimize: !!onMinimize,
318
+ dispatch: true
319
+ }
320
+ }), [answer, runAction, onMinimize, state.answers, state.actionState, state.busy]);
321
+
322
+ // The last assistant turn carrying an error is the only "it went wrong"
323
+ // signal the header can read; it clears as soon as the next send starts.
324
+ const failed = !state.busy && lastMessage?.role === "assistant" && !!lastMessage.error;
325
+ /**
326
+ * Stop invites a redirect. The turn just ended because the user said so;
327
+ * the likeliest next move is "do this instead", not "do that again" — so
328
+ * the composer takes focus with that prompt. Keyed by the stopped message so
329
+ * it happens once per stop, and only while the sheet is on screen.
330
+ */
331
+ const redirectKey = !state.busy && lastMessage?.role === "assistant" && lastMessage.stopped && !lastMessage.error ? lastMessage.id : null;
332
+ const queuePaused = queuePauseReason(state);
333
+
334
+ // Built on press, not on render — a streaming answer would otherwise rebuild
335
+ // the whole transcript on every frame for a button nobody tapped.
336
+ const {
337
+ showThinking,
338
+ readOnly
339
+ } = useAskBuoySettings();
340
+ const getTranscript = useCallback(() => transcriptToText(state.messages, showThinking), [state.messages, showThinking]);
341
+ const requestTicket = useCallback(() => send(TICKET_PROMPT), [send]);
342
+ const header = showSettings ? /*#__PURE__*/_jsxs(ModalHeader, {
343
+ children: [/*#__PURE__*/_jsx(ModalHeader.Navigation, {
344
+ onBack: closeSettings
345
+ }), /*#__PURE__*/_jsx(ModalHeader.Content, {
346
+ title: "Settings",
347
+ subtitle: "Ask Buoy",
348
+ testID: "buoy-ask-buoy-settings-title"
349
+ })]
350
+ }) : /*#__PURE__*/_jsx(AskBuoyHeader, {
351
+ configured: configured,
352
+ busy: state.busy,
353
+ failed: failed,
354
+ activeLabel: activeLabel,
355
+ awaitingApproval: !!state.pending,
356
+ startedAt: lastMessage?.role === "assistant" && lastMessage.streaming ? lastMessage.startedAt ?? null : null,
357
+ stopping: state.stopping,
358
+ readOnly: readOnly,
359
+ toolCount: toolCount,
360
+ hasMessages: state.messages.length > 0,
361
+ onBack: onBack,
362
+ onReset: confirmReset,
363
+ getTranscript: getTranscript,
364
+ onOpenSettings: openSettings,
365
+ onTicket: requestTicket
366
+ });
367
+ return /*#__PURE__*/_jsx(JsModal, {
368
+ visible: visible,
369
+ onClose: closeAndStop
370
+ // The message list is the only scroller. JsModal's default wrapper is
371
+ // flexGrow:1, which makes a nested flex:1 scroller resolve against the
372
+ // content and never scroll at all.
373
+ ,
374
+ disableScrollWrapper: true
375
+ // ToolBackground is an animated star field. A chat re-renders on every
376
+ // streamed token; two continuous animations competing is a dropped
377
+ // frame budget for no benefit.
378
+ ,
379
+ background: false,
380
+ initialHeight: 560,
381
+ animatedHeight: sheetHeight,
382
+ header: {
383
+ customContent: header,
384
+ showToggleButton: false
385
+ },
386
+ onBack: onBack,
387
+ onMinimize: onMinimize,
388
+ onModeChange: setMode,
389
+ persistenceKey: persistenceKey ?? "buoy-ask-buoy",
390
+ enablePersistence: true,
391
+ children: /*#__PURE__*/_jsx(BlockHandlersProvider, {
392
+ value: blockHandlers,
393
+ children: /*#__PURE__*/_jsxs(View, {
394
+ style: [styles.root, {
395
+ paddingBottom: bottomInset
396
+ }],
397
+ children: [/*#__PURE__*/_jsx(ChangesBar, {
398
+ ledger: askBuoyStore.getLedger(),
399
+ onUndoAll: undoAll,
400
+ expanded: changesOpen,
401
+ onToggle: toggleChanges
402
+ }), state.notice && /*#__PURE__*/_jsxs(View, {
403
+ style: styles.notice,
404
+ testID: "buoy-ask-buoy-notice",
405
+ children: [/*#__PURE__*/_jsx(Info, {
406
+ size: 14,
407
+ color: night.color.info
408
+ }), /*#__PURE__*/_jsx(Text, {
409
+ style: styles.noticeText,
410
+ children: state.notice
411
+ })]
412
+ }), /*#__PURE__*/_jsx(KeyboardPad, {
413
+ children: /*#__PURE__*/_jsx(FeatureGate, {
414
+ featureName: "Ask Buoy",
415
+ children: showSettings ? /*#__PURE__*/_jsx(AskBuoySettings, {}) : /*#__PURE__*/_jsxs(_Fragment, {
416
+ children: [/*#__PURE__*/_jsx(MessageList, {
417
+ messages: state.messages,
418
+ onRetry: retry,
419
+ waitingOnUser: !!state.pending || !!state.awaitingBlockId,
420
+ ListEmptyComponent: /*#__PURE__*/_jsx(EmptyState, {
421
+ configured: configured,
422
+ onPick: send,
423
+ availableToolIds: availableToolIds,
424
+ readOnly: readOnly || !!config?.policy?.readOnly
425
+ })
426
+ }), /*#__PURE__*/_jsx(QueuedMessages, {
427
+ items: state.queued,
428
+ paused: queuePaused,
429
+ onEdit: editQueued,
430
+ onRemove: removeQueued
431
+ }), state.pending && /*#__PURE__*/_jsx(ApprovalCard, {
432
+ pending: state.pending,
433
+ onAnswer: approve
434
+ }), /*#__PURE__*/_jsx(Composer, {
435
+ onSend: send,
436
+ onStop: stop,
437
+ busy: state.busy,
438
+ draft: state.draft,
439
+ onDraftTaken: takeDraft,
440
+ disabled: !configured,
441
+ focusKey: redirectKey,
442
+ canFocus: visible,
443
+ placeholder: redirectKey ? "Tell it what to do differently…" : state.awaitingBlockId ? "Pick an option above, or type…" : undefined
444
+ })]
445
+ })
446
+ })
447
+ })]
448
+ })
449
+ })
450
+ });
451
+ }
452
+ const styles = StyleSheet.create({
453
+ // Transparent or it paints over the sheet's own chrome — the convention is
454
+ // repeated verbatim across every Buoy tool body.
455
+ root: {
456
+ flex: 1,
457
+ backgroundColor: "transparent"
458
+ },
459
+ notice: {
460
+ flexDirection: "row",
461
+ alignItems: "flex-start",
462
+ gap: 8,
463
+ paddingHorizontal: night.gutter,
464
+ paddingVertical: 10,
465
+ backgroundColor: night.color.infoSoft
466
+ },
467
+ noticeText: {
468
+ flex: 1,
469
+ color: night.color.text,
470
+ fontSize: night.font.caption,
471
+ lineHeight: 18
472
+ }
473
+ });
474
+ //# sourceMappingURL=AskBuoyModal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useEffect","useMemo","useRef","useState","Alert","Animated","StyleSheet","Text","View","isReversible","dispatchToolAction","FeatureGate","Info","JsModal","ModalHeader","night","setToolAttention","useSafeAreaInsets","BlockHandlersProvider","ApprovalCard","ChangesBar","Composer","KeyboardPad","AskBuoyHeader","AskBuoySettings","EmptyState","MessageList","transcriptToText","QueuedMessages","askBuoyStore","queuePauseReason","TICKET_PROMPT","useAskBuoy","useAskBuoySettings","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","AskBuoyModal","visible","onClose","onBack","onMinimize","persistenceKey","config","state","send","stop","reset","undoThenReset","approve","retry","answer","runAction","editQueued","removeQueued","configured","toolCount","availableToolIds","changesOpen","setChangesOpen","closeAndStop","takeDraft","clearDraft","showSettings","setShowSettings","closeSettings","openSettings","hidden","awaitingUser","pending","awaitingBlockId","lastMessage","messages","length","finishedWhileHidden","wasBusy","busy","current","kind","label","role","error","insets","minBottom","mode","setMode","bottomInset","bottom","undoAll","ledger","getLedger","outcome","revertAll","failed","setNotice","detail","map","f","join","toggleChanges","v","sheetHeight","Value","peeking","runPeek","stopAnimation","from","restoreTo","timing","toValue","duration","useNativeDriver","start","setTimeout","spring","friction","peekKey","last","peeks","blocks","filter","p","block","id","prevPeekKey","peek","confirmReset","reversible","list","e","undoneAt","effect","alert","text","onPress","cleared","total","reverted","stillApplied","style","activeLabel","streaming","toolCalls","find","c","status","blockHandlers","action","blockId","minimize","answered","answers","actionState","supports","openTool","dispatch","redirectKey","stopped","queuePaused","showThinking","readOnly","getTranscript","requestTicket","header","children","Navigation","Content","title","subtitle","testID","awaitingApproval","startedAt","stopping","hasMessages","onReset","onOpenSettings","onTicket","disableScrollWrapper","background","initialHeight","animatedHeight","customContent","showToggleButton","onModeChange","enablePersistence","value","styles","root","paddingBottom","onUndoAll","expanded","onToggle","notice","size","color","info","noticeText","featureName","onRetry","waitingOnUser","ListEmptyComponent","onPick","policy","items","queued","paused","onEdit","onRemove","onAnswer","onSend","onStop","draft","onDraftTaken","disabled","focusKey","canFocus","placeholder","undefined","create","flex","backgroundColor","flexDirection","alignItems","gap","paddingHorizontal","gutter","paddingVertical","infoSoft","fontSize","font","caption","lineHeight"],"sourceRoot":"../../../src","sources":["components/AskBuoyModal.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACzE,SACEC,KAAK,EACLC,QAAQ,EACRC,UAAU,EACVC,IAAI,EACJC,IAAI,QACC,cAAc;AACrB,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SACEC,kBAAkB,EAClBC,WAAW,EACXC,IAAI,EACJC,OAAO,EACPC,WAAW,EACXC,KAAK,EACLC,gBAAgB,EAChBC,iBAAiB,QACZ,oBAAoB;AAG3B,SAASC,qBAAqB,QAA4B,WAAW;AACrE,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,UAAU,QAAQ,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