@buoy-gg/ask-buoy 7.0.41 → 7.0.43

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