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