@buoy-gg/ask-buoy 7.0.36 → 7.0.38

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 (312) hide show
  1. package/README.md +58 -27
  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 -781
  6. package/lib/commonjs/blocks/ExtraBlocks.js +1 -1860
  7. package/lib/commonjs/blocks/MediaBlocks.js +1 -156
  8. package/lib/commonjs/blocks/ReceiptBlocks.js +1 -586
  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/components/ApprovalCard.js +1 -244
  20. package/lib/commonjs/components/AskBuoyHeader.js +1 -196
  21. package/lib/commonjs/components/AskBuoyIcon.js +1 -19
  22. package/lib/commonjs/components/AskBuoyModal.js +1 -479
  23. package/lib/commonjs/components/AskBuoySettings.js +1 -119
  24. package/lib/commonjs/components/ChangesBar.js +1 -211
  25. package/lib/commonjs/components/Composer.js +1 -255
  26. package/lib/commonjs/components/EmptyState.js +1 -161
  27. package/lib/commonjs/components/KeyboardPad.js +1 -80
  28. package/lib/commonjs/components/Markdown.js +1 -310
  29. package/lib/commonjs/components/MessageList.js +1 -930
  30. package/lib/commonjs/components/QueuedMessages.js +1 -145
  31. package/lib/commonjs/components/ThinkingStrip.js +1 -223
  32. package/lib/commonjs/components/TypingDots.js +1 -63
  33. package/lib/commonjs/components/markdownParse.js +1 -131
  34. package/lib/commonjs/components/markdownParse.test.js +1 -99
  35. package/lib/commonjs/components/useCopyAction.js +1 -50
  36. package/lib/commonjs/index.js +1 -252
  37. package/lib/commonjs/preset.js +1 -90
  38. package/lib/commonjs/store/activityGroups.js +1 -110
  39. package/lib/commonjs/store/activityGroups.test.js +1 -78
  40. package/lib/commonjs/store/askBuoySettings.js +1 -72
  41. package/lib/commonjs/store/askBuoyStore.js +1 -547
  42. package/lib/commonjs/store/blockPlacement.js +1 -64
  43. package/lib/commonjs/store/blockPlacement.test.js +1 -123
  44. package/lib/commonjs/store/queue.test.js +1 -150
  45. package/lib/commonjs/store/resetConversation.js +1 -77
  46. package/lib/commonjs/store/restorePending.test.js +1 -63
  47. package/lib/commonjs/store/restoredIds.test.js +1 -47
  48. package/lib/commonjs/store/suggestions.js +1 -54
  49. package/lib/commonjs/store/suggestions.test.js +1 -58
  50. package/lib/commonjs/store/systemLine.test.js +1 -77
  51. package/lib/commonjs/store/ticketPrompt.js +1 -17
  52. package/lib/commonjs/store/traceText.js +1 -81
  53. package/lib/commonjs/store/traceText.test.js +1 -112
  54. package/lib/commonjs/store/transcriptPersistence.js +1 -297
  55. package/lib/commonjs/store/transcriptPersistence.test.js +1 -333
  56. package/lib/commonjs/store/turnRendering.test.js +1 -151
  57. package/lib/commonjs/store/useAskBuoy.js +1 -622
  58. package/lib/commonjs/store/useAskBuoySettings.js +1 -14
  59. package/lib/commonjs/sync/askBuoySyncAdapter.js +1 -140
  60. package/lib/commonjs/sync/askBuoySyncAdapter.test.js +1 -141
  61. package/lib/commonjs/sync/wire.js +1 -58
  62. package/lib/commonjs/types.js +1 -6
  63. package/lib/module/blocks/AskBlocks.js +1 -331
  64. package/lib/module/blocks/BlockRenderer.js +1 -257
  65. package/lib/module/blocks/ChromePrototypes.js +1 -503
  66. package/lib/module/blocks/DataBlocks.js +1 -767
  67. package/lib/module/blocks/ExtraBlocks.js +1 -1833
  68. package/lib/module/blocks/MediaBlocks.js +1 -151
  69. package/lib/module/blocks/ReceiptBlocks.js +1 -574
  70. package/lib/module/blocks/blockText.js +1 -55
  71. package/lib/module/blocks/blockText.test.js +1 -53
  72. package/lib/module/blocks/context.js +1 -35
  73. package/lib/module/blocks/icons.js +1 -91
  74. package/lib/module/blocks/index.js +1 -8
  75. package/lib/module/blocks/listRow.test.js +1 -56
  76. package/lib/module/blocks/pageState.js +1 -30
  77. package/lib/module/blocks/pageState.test.js +1 -56
  78. package/lib/module/blocks/primitives.js +1 -445
  79. package/lib/module/blocks/primitivesIndex.js +1 -5
  80. package/lib/module/components/ApprovalCard.js +1 -239
  81. package/lib/module/components/AskBuoyHeader.js +1 -193
  82. package/lib/module/components/AskBuoyIcon.js +1 -8
  83. package/lib/module/components/AskBuoyModal.js +1 -474
  84. package/lib/module/components/AskBuoySettings.js +1 -114
  85. package/lib/module/components/ChangesBar.js +1 -206
  86. package/lib/module/components/Composer.js +1 -250
  87. package/lib/module/components/EmptyState.js +1 -156
  88. package/lib/module/components/KeyboardPad.js +1 -75
  89. package/lib/module/components/Markdown.js +1 -305
  90. package/lib/module/components/MessageList.js +1 -924
  91. package/lib/module/components/QueuedMessages.js +1 -140
  92. package/lib/module/components/ThinkingStrip.js +1 -218
  93. package/lib/module/components/TypingDots.js +1 -58
  94. package/lib/module/components/markdownParse.js +1 -125
  95. package/lib/module/components/markdownParse.test.js +1 -98
  96. package/lib/module/components/useCopyAction.js +1 -46
  97. package/lib/module/index.js +1 -34
  98. package/lib/module/preset.js +1 -73
  99. package/lib/module/store/activityGroups.js +1 -103
  100. package/lib/module/store/activityGroups.test.js +1 -77
  101. package/lib/module/store/askBuoySettings.js +1 -67
  102. package/lib/module/store/askBuoyStore.js +1 -541
  103. package/lib/module/store/blockPlacement.js +1 -59
  104. package/lib/module/store/blockPlacement.test.js +1 -122
  105. package/lib/module/store/queue.test.js +1 -149
  106. package/lib/module/store/resetConversation.js +1 -72
  107. package/lib/module/store/restorePending.test.js +1 -62
  108. package/lib/module/store/restoredIds.test.js +1 -46
  109. package/lib/module/store/suggestions.js +1 -49
  110. package/lib/module/store/suggestions.test.js +1 -57
  111. package/lib/module/store/systemLine.test.js +1 -76
  112. package/lib/module/store/ticketPrompt.js +1 -13
  113. package/lib/module/store/traceText.js +1 -75
  114. package/lib/module/store/traceText.test.js +1 -111
  115. package/lib/module/store/transcriptPersistence.js +1 -287
  116. package/lib/module/store/transcriptPersistence.test.js +1 -332
  117. package/lib/module/store/turnRendering.test.js +1 -150
  118. package/lib/module/store/useAskBuoy.js +1 -616
  119. package/lib/module/store/useAskBuoySettings.js +1 -9
  120. package/lib/module/sync/askBuoySyncAdapter.js +1 -135
  121. package/lib/module/sync/askBuoySyncAdapter.test.js +1 -140
  122. package/lib/module/sync/wire.js +1 -47
  123. package/lib/module/types.js +1 -4
  124. package/lib/typescript/components/ApprovalCard.d.ts +9 -1
  125. package/lib/typescript/preset.d.ts +4 -2
  126. package/lib/typescript/store/askBuoyStore.d.ts +32 -4
  127. package/lib/typescript/store/useAskBuoy.d.ts +3 -2
  128. package/lib/typescript/sync/askBuoySyncAdapter.d.ts +3 -0
  129. package/package.json +9 -9
  130. package/lib/commonjs/blocks/AskBlocks.js.map +0 -1
  131. package/lib/commonjs/blocks/BlockRenderer.js.map +0 -1
  132. package/lib/commonjs/blocks/ChromePrototypes.js.map +0 -1
  133. package/lib/commonjs/blocks/DataBlocks.js.map +0 -1
  134. package/lib/commonjs/blocks/ExtraBlocks.js.map +0 -1
  135. package/lib/commonjs/blocks/MediaBlocks.js.map +0 -1
  136. package/lib/commonjs/blocks/ReceiptBlocks.js.map +0 -1
  137. package/lib/commonjs/blocks/blockText.js.map +0 -1
  138. package/lib/commonjs/blocks/blockText.test.js.map +0 -1
  139. package/lib/commonjs/blocks/context.js.map +0 -1
  140. package/lib/commonjs/blocks/icons.js.map +0 -1
  141. package/lib/commonjs/blocks/index.js.map +0 -1
  142. package/lib/commonjs/blocks/listRow.test.js.map +0 -1
  143. package/lib/commonjs/blocks/pageState.js.map +0 -1
  144. package/lib/commonjs/blocks/pageState.test.js.map +0 -1
  145. package/lib/commonjs/blocks/primitives.js.map +0 -1
  146. package/lib/commonjs/blocks/primitivesIndex.js.map +0 -1
  147. package/lib/commonjs/components/ApprovalCard.js.map +0 -1
  148. package/lib/commonjs/components/AskBuoyHeader.js.map +0 -1
  149. package/lib/commonjs/components/AskBuoyIcon.js.map +0 -1
  150. package/lib/commonjs/components/AskBuoyModal.js.map +0 -1
  151. package/lib/commonjs/components/AskBuoySettings.js.map +0 -1
  152. package/lib/commonjs/components/ChangesBar.js.map +0 -1
  153. package/lib/commonjs/components/Composer.js.map +0 -1
  154. package/lib/commonjs/components/EmptyState.js.map +0 -1
  155. package/lib/commonjs/components/KeyboardPad.js.map +0 -1
  156. package/lib/commonjs/components/Markdown.js.map +0 -1
  157. package/lib/commonjs/components/MessageList.js.map +0 -1
  158. package/lib/commonjs/components/QueuedMessages.js.map +0 -1
  159. package/lib/commonjs/components/ThinkingStrip.js.map +0 -1
  160. package/lib/commonjs/components/TypingDots.js.map +0 -1
  161. package/lib/commonjs/components/markdownParse.js.map +0 -1
  162. package/lib/commonjs/components/markdownParse.test.js.map +0 -1
  163. package/lib/commonjs/components/useCopyAction.js.map +0 -1
  164. package/lib/commonjs/index.js.map +0 -1
  165. package/lib/commonjs/preset.js.map +0 -1
  166. package/lib/commonjs/store/activityGroups.js.map +0 -1
  167. package/lib/commonjs/store/activityGroups.test.js.map +0 -1
  168. package/lib/commonjs/store/askBuoySettings.js.map +0 -1
  169. package/lib/commonjs/store/askBuoyStore.js.map +0 -1
  170. package/lib/commonjs/store/blockPlacement.js.map +0 -1
  171. package/lib/commonjs/store/blockPlacement.test.js.map +0 -1
  172. package/lib/commonjs/store/queue.test.js.map +0 -1
  173. package/lib/commonjs/store/resetConversation.js.map +0 -1
  174. package/lib/commonjs/store/restorePending.test.js.map +0 -1
  175. package/lib/commonjs/store/restoredIds.test.js.map +0 -1
  176. package/lib/commonjs/store/suggestions.js.map +0 -1
  177. package/lib/commonjs/store/suggestions.test.js.map +0 -1
  178. package/lib/commonjs/store/systemLine.test.js.map +0 -1
  179. package/lib/commonjs/store/ticketPrompt.js.map +0 -1
  180. package/lib/commonjs/store/traceText.js.map +0 -1
  181. package/lib/commonjs/store/traceText.test.js.map +0 -1
  182. package/lib/commonjs/store/transcriptPersistence.js.map +0 -1
  183. package/lib/commonjs/store/transcriptPersistence.test.js.map +0 -1
  184. package/lib/commonjs/store/turnRendering.test.js.map +0 -1
  185. package/lib/commonjs/store/useAskBuoy.js.map +0 -1
  186. package/lib/commonjs/store/useAskBuoySettings.js.map +0 -1
  187. package/lib/commonjs/sync/askBuoySyncAdapter.js.map +0 -1
  188. package/lib/commonjs/sync/askBuoySyncAdapter.test.js.map +0 -1
  189. package/lib/commonjs/sync/wire.js.map +0 -1
  190. package/lib/commonjs/types.js.map +0 -1
  191. package/lib/module/blocks/AskBlocks.js.map +0 -1
  192. package/lib/module/blocks/BlockRenderer.js.map +0 -1
  193. package/lib/module/blocks/ChromePrototypes.js.map +0 -1
  194. package/lib/module/blocks/DataBlocks.js.map +0 -1
  195. package/lib/module/blocks/ExtraBlocks.js.map +0 -1
  196. package/lib/module/blocks/MediaBlocks.js.map +0 -1
  197. package/lib/module/blocks/ReceiptBlocks.js.map +0 -1
  198. package/lib/module/blocks/blockText.js.map +0 -1
  199. package/lib/module/blocks/blockText.test.js.map +0 -1
  200. package/lib/module/blocks/context.js.map +0 -1
  201. package/lib/module/blocks/icons.js.map +0 -1
  202. package/lib/module/blocks/index.js.map +0 -1
  203. package/lib/module/blocks/listRow.test.js.map +0 -1
  204. package/lib/module/blocks/pageState.js.map +0 -1
  205. package/lib/module/blocks/pageState.test.js.map +0 -1
  206. package/lib/module/blocks/primitives.js.map +0 -1
  207. package/lib/module/blocks/primitivesIndex.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/components/ApprovalCard.d.ts.map +0 -1
  270. package/lib/typescript/components/AskBuoyHeader.d.ts.map +0 -1
  271. package/lib/typescript/components/AskBuoyIcon.d.ts.map +0 -1
  272. package/lib/typescript/components/AskBuoyModal.d.ts.map +0 -1
  273. package/lib/typescript/components/AskBuoySettings.d.ts.map +0 -1
  274. package/lib/typescript/components/ChangesBar.d.ts.map +0 -1
  275. package/lib/typescript/components/Composer.d.ts.map +0 -1
  276. package/lib/typescript/components/EmptyState.d.ts.map +0 -1
  277. package/lib/typescript/components/KeyboardPad.d.ts.map +0 -1
  278. package/lib/typescript/components/Markdown.d.ts.map +0 -1
  279. package/lib/typescript/components/MessageList.d.ts.map +0 -1
  280. package/lib/typescript/components/QueuedMessages.d.ts.map +0 -1
  281. package/lib/typescript/components/ThinkingStrip.d.ts.map +0 -1
  282. package/lib/typescript/components/TypingDots.d.ts.map +0 -1
  283. package/lib/typescript/components/markdownParse.d.ts.map +0 -1
  284. package/lib/typescript/components/markdownParse.test.d.ts.map +0 -1
  285. package/lib/typescript/components/useCopyAction.d.ts.map +0 -1
  286. package/lib/typescript/index.d.ts.map +0 -1
  287. package/lib/typescript/preset.d.ts.map +0 -1
  288. package/lib/typescript/store/activityGroups.d.ts.map +0 -1
  289. package/lib/typescript/store/activityGroups.test.d.ts.map +0 -1
  290. package/lib/typescript/store/askBuoySettings.d.ts.map +0 -1
  291. package/lib/typescript/store/askBuoyStore.d.ts.map +0 -1
  292. package/lib/typescript/store/blockPlacement.d.ts.map +0 -1
  293. package/lib/typescript/store/blockPlacement.test.d.ts.map +0 -1
  294. package/lib/typescript/store/queue.test.d.ts.map +0 -1
  295. package/lib/typescript/store/resetConversation.d.ts.map +0 -1
  296. package/lib/typescript/store/restorePending.test.d.ts.map +0 -1
  297. package/lib/typescript/store/restoredIds.test.d.ts.map +0 -1
  298. package/lib/typescript/store/suggestions.d.ts.map +0 -1
  299. package/lib/typescript/store/suggestions.test.d.ts.map +0 -1
  300. package/lib/typescript/store/systemLine.test.d.ts.map +0 -1
  301. package/lib/typescript/store/ticketPrompt.d.ts.map +0 -1
  302. package/lib/typescript/store/traceText.d.ts.map +0 -1
  303. package/lib/typescript/store/traceText.test.d.ts.map +0 -1
  304. package/lib/typescript/store/transcriptPersistence.d.ts.map +0 -1
  305. package/lib/typescript/store/transcriptPersistence.test.d.ts.map +0 -1
  306. package/lib/typescript/store/turnRendering.test.d.ts.map +0 -1
  307. package/lib/typescript/store/useAskBuoy.d.ts.map +0 -1
  308. package/lib/typescript/store/useAskBuoySettings.d.ts.map +0 -1
  309. package/lib/typescript/sync/askBuoySyncAdapter.d.ts.map +0 -1
  310. package/lib/typescript/sync/askBuoySyncAdapter.test.d.ts.map +0 -1
  311. package/lib/typescript/sync/wire.d.ts.map +0 -1
  312. package/lib/typescript/types.d.ts.map +0 -1
@@ -1,445 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * The few visual pieces every block shares: the card, its title row with the
5
- * provenance badge, a "+N more" expander, and the two-button action row.
6
- * Night tokens only — a block must look like every other Buoy surface.
7
- */
8
- import { useState } from "react";
9
- import { ActivityIndicator, Pressable, StyleSheet, Text, View } from "react-native";
10
- import { Check, ChevronDown, ChevronUp, night, X } from "@buoy-gg/shared-ui";
11
- import { actionKey, useBlockHandlers } from "./context";
12
- import { pageState } from "./pageState";
13
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
- export function toneColor(tone) {
15
- switch (tone) {
16
- case "accent":
17
- return night.color.accent;
18
- case "warning":
19
- return night.color.warning;
20
- case "danger":
21
- return night.color.danger;
22
- case "info":
23
- return night.color.info;
24
- case "muted":
25
- return night.color.textTertiary;
26
- default:
27
- return night.color.text;
28
- }
29
- }
30
-
31
- /** Quiet when live; loud when the data was changed, mocked, or invented. */
32
- export function ProvenanceBadge({
33
- source
34
- }) {
35
- if (!source || source === "live") return null;
36
- const label = source === "changed" ? "CHANGED BY ASK BUOY" : source === "mocked" ? "MOCKED" : "FROM THE MODEL";
37
- const color = source === "changed" ? night.color.warning : source === "mocked" ? night.color.danger : night.color.textTertiary;
38
- return /*#__PURE__*/_jsx(View, {
39
- style: [styles.badge, {
40
- borderColor: color
41
- }],
42
- children: /*#__PURE__*/_jsx(Text, {
43
- style: [styles.badgeText, {
44
- color
45
- }],
46
- children: label
47
- })
48
- });
49
- }
50
-
51
- /**
52
- * The block card. Optionally folds its body away behind a one-line summary.
53
- *
54
- * A card is `collapsible` when its body is reference material rather than the
55
- * answer — raw JSON, a field-by-field diff, anything a person reads only when
56
- * they have a reason to. It stays folded until asked, because the chat is what
57
- * the reader came for and a screen of `promoCode: null` buries it. What must
58
- * NEVER fold is the part that carries meaning without being read: the title
59
- * and the provenance badge stay on the face of the card in both states, so
60
- * "CHANGED BY ASK BUOY" can't be hidden by the same tap that hides the detail.
61
- */
62
- export function Card({
63
- title,
64
- source,
65
- children,
66
- testID,
67
- tone,
68
- collapsible,
69
- summary
70
- }) {
71
- const [expanded, setExpanded] = useState(false);
72
- const folded = !!collapsible && !expanded;
73
- return /*#__PURE__*/_jsxs(View, {
74
- style: [styles.card, tone === "warning" && styles.cardWarning, tone === "danger" && styles.cardDanger, tone === "info" && styles.cardInfo],
75
- testID: testID,
76
- children: [(title || source && source !== "live") && /*#__PURE__*/_jsxs(View, {
77
- style: styles.titleRow,
78
- children: [title ? /*#__PURE__*/_jsx(Text, {
79
- style: styles.title,
80
- numberOfLines: 2,
81
- children: title
82
- }) : /*#__PURE__*/_jsx(View, {
83
- style: styles.flex
84
- }), /*#__PURE__*/_jsx(ProvenanceBadge, {
85
- source: source
86
- })]
87
- }), collapsible ? /*#__PURE__*/_jsxs(Pressable, {
88
- testID: testID ? `${testID}-toggle` : undefined,
89
- onPress: () => setExpanded(v => !v),
90
- accessibilityRole: "button",
91
- accessibilityState: {
92
- expanded
93
- },
94
- accessibilityLabel: `${summary ?? "Details"}, ${expanded ? "hide" : "show"}`,
95
- style: ({
96
- pressed
97
- }) => [styles.disclosure, !folded && styles.disclosureOpen, pressed && styles.pressed],
98
- children: [/*#__PURE__*/_jsx(Text, {
99
- style: styles.disclosureText,
100
- numberOfLines: 1,
101
- children: summary ?? "Details"
102
- }), folded ? /*#__PURE__*/_jsx(ChevronDown, {
103
- size: 12,
104
- color: night.color.textTertiary
105
- }) : /*#__PURE__*/_jsx(ChevronUp, {
106
- size: 12,
107
- color: night.color.textTertiary
108
- })]
109
- }) : null, folded ? null : children]
110
- });
111
- }
112
-
113
- /**
114
- * How many rows one tap of "Show N more" reveals.
115
- *
116
- * Deliberately smaller than any block's initial cap. Expanding used to be
117
- * all-or-nothing, so a hundred-row list arrived in one tap and buried the
118
- * answer it was attached to under a scroll the reader had to fight back up.
119
- * A page at a time keeps the conversation the thing you are reading.
120
- */
121
- const PAGE_STEP = 5;
122
- /**
123
- * A capped list that grows a page at a time.
124
- *
125
- * The callers used to spell the expander's enabled-ness out themselves
126
- * (`items.length > visible.length || expanded ? toggle : undefined`) at seven
127
- * call sites, and getting it wrong rendered a "+N more" that did nothing when
128
- * tapped. Both halves live here now so a call site cannot express that state.
129
- */
130
- export function usePaged(items, cap, step = PAGE_STEP) {
131
- const [limit, setLimit] = useState(cap);
132
- const {
133
- hidden,
134
- next,
135
- expanded,
136
- canExpand,
137
- canCollapse
138
- } = pageState(items.length, cap, limit, step);
139
- return {
140
- visible: items.slice(0, limit),
141
- hidden,
142
- next,
143
- expanded,
144
- showMore: canExpand ? () => setLimit(n => n + step) : undefined,
145
- showLess: canCollapse ? () => setLimit(cap) : undefined
146
- };
147
- }
148
-
149
- /**
150
- * The footer of a paged list: reveal one more page, or fold back to the cap.
151
- *
152
- * It knows nothing about any `total` the source reported, and that is the
153
- * point. The old version drew its count from that number while drawing its tap
154
- * target from the array actually in hand — so a block holding five items and
155
- * claiming six rendered "+1 more" with nothing behind it. The engine hands the
156
- * whole list over now (see agent-core's receipts), so what this can show and
157
- * what it can reveal are the same thing by construction.
158
- */
159
- export function More({
160
- paged
161
- }) {
162
- const {
163
- next,
164
- showMore,
165
- showLess
166
- } = paged;
167
- if (!showMore && !showLess) return null;
168
- return /*#__PURE__*/_jsxs(View, {
169
- style: styles.moreRow,
170
- children: [showMore ? /*#__PURE__*/_jsxs(Pressable, {
171
- testID: "buoy-block-show-more",
172
- onPress: showMore,
173
- style: [styles.more, styles.moreCell],
174
- accessibilityRole: "button",
175
- children: [/*#__PURE__*/_jsxs(Text, {
176
- style: styles.moreText,
177
- children: ["Show ", next, " more"]
178
- }), /*#__PURE__*/_jsx(ChevronDown, {
179
- size: 12,
180
- color: night.color.textTertiary
181
- })]
182
- }) : null, showLess ? /*#__PURE__*/_jsxs(Pressable, {
183
- testID: "buoy-block-show-fewer",
184
- onPress: showLess,
185
- style: [styles.more, styles.moreCell],
186
- accessibilityRole: "button",
187
- children: [/*#__PURE__*/_jsx(Text, {
188
- style: styles.moreText,
189
- children: "Show fewer"
190
- }), /*#__PURE__*/_jsx(ChevronUp, {
191
- size: 12,
192
- color: night.color.textTertiary
193
- })]
194
- }) : null]
195
- });
196
- }
197
-
198
- /**
199
- * A list that CANNOT grow: the cap was applied where the block was built, so
200
- * the rest was never sent. Stated, never offered as a tap.
201
- */
202
- export function MoreNote({
203
- shown,
204
- total
205
- }) {
206
- if (!total || total <= shown) return null;
207
- return /*#__PURE__*/_jsx(View, {
208
- style: styles.more,
209
- children: /*#__PURE__*/_jsxs(Text, {
210
- style: styles.moreNote,
211
- children: [shown, " of ", total, " shown"]
212
- })
213
- });
214
- }
215
-
216
- /** Up to two buttons. One primary (accent, dark ink), one plate. */
217
- export function ActionRow({
218
- actions,
219
- blockId,
220
- align = "left"
221
- }) {
222
- const h = useBlockHandlers();
223
- if (!actions?.length) return null;
224
- const supported = actions.filter(a => {
225
- if (a.openTool) return h.supports?.openTool !== false;
226
- if (a.minimize) return h.supports?.minimize !== false;
227
- if (a.dispatch) return h.supports?.dispatch !== false;
228
- return true;
229
- });
230
- if (supported.length === 0) return null;
231
- return /*#__PURE__*/_jsx(View, {
232
- style: [styles.actions, align === "right" && styles.actionsRight],
233
- children: supported.slice(0, 2).map(a => {
234
- const state = h.actionState?.[actionKey(blockId, a)];
235
- const disabled = !!h.busy || state === "running" || state === "done";
236
- return /*#__PURE__*/_jsxs(Pressable, {
237
- accessibilityRole: "button",
238
- accessibilityLabel: a.label,
239
- testID: `buoy-block-action-${a.label.toLowerCase().replace(/\s+/g, "-")}`,
240
- disabled: disabled,
241
- onPress: () => void h.runAction(a, blockId),
242
- style: ({
243
- pressed
244
- }) => [styles.button, a.primary ? styles.buttonPrimary : styles.buttonPlate, disabled && styles.buttonDisabled, pressed && !disabled && styles.pressed],
245
- children: [state === "running" ? /*#__PURE__*/_jsx(ActivityIndicator, {
246
- size: "small",
247
- color: a.primary ? night.color.onAccent : night.color.text
248
- }) : state === "done" ? /*#__PURE__*/_jsx(Check, {
249
- size: 12,
250
- color: a.primary ? night.color.onAccent : night.color.accent
251
- }) : state === "failed" ? /*#__PURE__*/_jsx(X, {
252
- size: 12,
253
- color: night.color.danger
254
- }) : null, /*#__PURE__*/_jsx(Text, {
255
- style: [styles.buttonText, a.primary ? styles.buttonTextPrimary : styles.buttonTextPlate],
256
- children: a.label
257
- })]
258
- }, a.label);
259
- })
260
- });
261
- }
262
- export const blockStyles = StyleSheet.create({
263
- row: {
264
- flexDirection: "row",
265
- alignItems: "center",
266
- gap: 10,
267
- paddingHorizontal: 12,
268
- paddingVertical: 9
269
- },
270
- rowDivider: {
271
- borderTopWidth: StyleSheet.hairlineWidth,
272
- borderTopColor: night.color.separator
273
- },
274
- rowTitle: {
275
- flex: 1,
276
- color: night.color.text,
277
- fontSize: night.font.body,
278
- lineHeight: 19
279
- },
280
- rowSub: {
281
- color: night.color.textSecondary,
282
- fontSize: night.font.caption,
283
- lineHeight: 17
284
- },
285
- rowTrailing: {
286
- color: night.color.textTertiary,
287
- fontSize: night.font.caption,
288
- maxWidth: 120,
289
- textAlign: "right"
290
- },
291
- mono: {
292
- fontFamily: "Menlo",
293
- fontSize: 12,
294
- color: night.color.text
295
- },
296
- pill: {
297
- paddingHorizontal: 7,
298
- paddingVertical: 2,
299
- borderRadius: night.radius.badge,
300
- backgroundColor: night.color.fill
301
- },
302
- pillText: {
303
- fontSize: night.font.micro,
304
- fontWeight: "700",
305
- letterSpacing: 0.4,
306
- color: night.color.textSecondary
307
- }
308
- });
309
- const styles = StyleSheet.create({
310
- card: {
311
- borderRadius: night.radius.card,
312
- borderWidth: StyleSheet.hairlineWidth,
313
- borderColor: night.color.border,
314
- backgroundColor: night.color.surface,
315
- overflow: "hidden"
316
- },
317
- cardWarning: {
318
- borderColor: night.color.warning,
319
- backgroundColor: night.color.warningSoft
320
- },
321
- cardDanger: {
322
- borderColor: night.color.danger,
323
- backgroundColor: night.color.dangerSoft
324
- },
325
- cardInfo: {
326
- borderColor: night.color.accentBorderStrong,
327
- backgroundColor: night.color.accentSoft
328
- },
329
- titleRow: {
330
- flexDirection: "row",
331
- alignItems: "center",
332
- gap: 8,
333
- paddingHorizontal: 12,
334
- paddingTop: 10,
335
- paddingBottom: 6
336
- },
337
- flex: {
338
- flex: 1
339
- },
340
- title: {
341
- flex: 1,
342
- color: night.color.text,
343
- fontSize: night.font.caption,
344
- fontWeight: "600"
345
- },
346
- disclosure: {
347
- flexDirection: "row",
348
- alignItems: "center",
349
- gap: 8,
350
- paddingHorizontal: 12,
351
- paddingVertical: 9
352
- },
353
- // Only when open: closed, the card ends at this row and a rule under it
354
- // would draw a line beneath nothing.
355
- disclosureOpen: {
356
- borderBottomWidth: StyleSheet.hairlineWidth,
357
- borderBottomColor: night.color.separator
358
- },
359
- disclosureText: {
360
- flex: 1,
361
- color: night.color.textSecondary,
362
- fontSize: night.font.caption
363
- },
364
- badge: {
365
- borderWidth: StyleSheet.hairlineWidth,
366
- borderRadius: night.radius.badge,
367
- paddingHorizontal: 6,
368
- paddingVertical: 2
369
- },
370
- badgeText: {
371
- fontSize: 9,
372
- fontWeight: "700",
373
- letterSpacing: 0.6
374
- },
375
- // The footer splits into up to three cells; each keeps the full-width rule
376
- // above it so the list still reads as ending at a line.
377
- moreRow: {
378
- flexDirection: "row"
379
- },
380
- more: {
381
- flexDirection: "row",
382
- alignItems: "center",
383
- justifyContent: "center",
384
- gap: 4,
385
- paddingVertical: 9,
386
- paddingHorizontal: 8,
387
- borderTopWidth: StyleSheet.hairlineWidth,
388
- borderTopColor: night.color.separator
389
- },
390
- // Only inside `moreRow` — a bare `MoreNote` sits in the Card's column,
391
- // where flex:1 means "grow vertically".
392
- moreCell: {
393
- flex: 1
394
- },
395
- moreText: {
396
- color: night.color.textSecondary,
397
- fontSize: night.font.caption,
398
- fontWeight: "600"
399
- },
400
- moreNote: {
401
- color: night.color.textTertiary,
402
- fontSize: night.font.caption
403
- },
404
- actions: {
405
- flexDirection: "row",
406
- gap: 8,
407
- paddingHorizontal: 12,
408
- paddingVertical: 10,
409
- flexWrap: "wrap"
410
- },
411
- actionsRight: {
412
- justifyContent: "flex-end"
413
- },
414
- button: {
415
- flexDirection: "row",
416
- alignItems: "center",
417
- gap: 6,
418
- paddingHorizontal: 14,
419
- paddingVertical: 9,
420
- borderRadius: night.radius.row
421
- },
422
- buttonPrimary: {
423
- backgroundColor: night.color.accent
424
- },
425
- buttonPlate: {
426
- backgroundColor: night.color.button
427
- },
428
- buttonDisabled: {
429
- opacity: 0.55
430
- },
431
- buttonText: {
432
- fontSize: night.font.caption,
433
- fontWeight: "600"
434
- },
435
- buttonTextPrimary: {
436
- color: night.color.onAccent
437
- },
438
- buttonTextPlate: {
439
- color: night.color.text
440
- },
441
- pressed: {
442
- opacity: 0.7
443
- }
444
- });
445
- //# sourceMappingURL=primitives.js.map
1
+ "use strict";import{useState}from"react";import{ActivityIndicator,Pressable,StyleSheet,Text,View}from"react-native";import{Check,ChevronDown,ChevronUp,night,X}from"@buoy-gg/shared-ui";import{actionKey,useBlockHandlers}from"./context";import{pageState}from"./pageState";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export function toneColor(e){switch(e){case"accent":return night.color.accent;case"warning":return night.color.warning;case"danger":return night.color.danger;case"info":return night.color.info;case"muted":return night.color.textTertiary;default:return night.color.text}}export function ProvenanceBadge({source:e}){if(!e||"live"===e)return null;const t="changed"===e?"CHANGED BY ASK BUOY":"mocked"===e?"MOCKED":"FROM THE MODEL",o="changed"===e?night.color.warning:"mocked"===e?night.color.danger:night.color.textTertiary;return _jsx(View,{style:[styles.badge,{borderColor:o}],children:_jsx(Text,{style:[styles.badgeText,{color:o}],children:t})})}export function Card({title:e,source:t,children:o,testID:r,tone:n,collapsible:i,summary:l}){const[s,c]=useState(!1),a=!!i&&!s;return _jsxs(View,{style:[styles.card,"warning"===n&&styles.cardWarning,"danger"===n&&styles.cardDanger,"info"===n&&styles.cardInfo],testID:r,children:[(e||t&&"live"!==t)&&_jsxs(View,{style:styles.titleRow,children:[e?_jsx(Text,{style:styles.title,numberOfLines:2,children:e}):_jsx(View,{style:styles.flex}),_jsx(ProvenanceBadge,{source:t})]}),i?_jsxs(Pressable,{testID:r?`${r}-toggle`:void 0,onPress:()=>c(e=>!e),accessibilityRole:"button",accessibilityState:{expanded:s},accessibilityLabel:`${l??"Details"}, ${s?"hide":"show"}`,style:({pressed:e})=>[styles.disclosure,!a&&styles.disclosureOpen,e&&styles.pressed],children:[_jsx(Text,{style:styles.disclosureText,numberOfLines:1,children:l??"Details"}),_jsx(a?ChevronDown:ChevronUp,{size:12,color:night.color.textTertiary})]}):null,a?null:o]})}const PAGE_STEP=5;export function usePaged(e,t,o=5){const[r,n]=useState(t),{hidden:i,next:l,expanded:s,canExpand:c,canCollapse:a}=pageState(e.length,t,r,o);return{visible:e.slice(0,r),hidden:i,next:l,expanded:s,showMore:c?()=>n(e=>e+o):void 0,showLess:a?()=>n(t):void 0}}export function More({paged:e}){const{next:t,showMore:o,showLess:r}=e;return o||r?_jsxs(View,{style:styles.moreRow,children:[o?_jsxs(Pressable,{testID:"buoy-block-show-more",onPress:o,style:[styles.more,styles.moreCell],accessibilityRole:"button",children:[_jsxs(Text,{style:styles.moreText,children:["Show ",t," more"]}),_jsx(ChevronDown,{size:12,color:night.color.textTertiary})]}):null,r?_jsxs(Pressable,{testID:"buoy-block-show-fewer",onPress:r,style:[styles.more,styles.moreCell],accessibilityRole:"button",children:[_jsx(Text,{style:styles.moreText,children:"Show fewer"}),_jsx(ChevronUp,{size:12,color:night.color.textTertiary})]}):null]}):null}export function MoreNote({shown:e,total:t}){return!t||t<=e?null:_jsx(View,{style:styles.more,children:_jsxs(Text,{style:styles.moreNote,children:[e," of ",t," shown"]})})}export function ActionRow({actions:e,blockId:t,align:o="left"}){const r=useBlockHandlers();if(!e?.length)return null;const n=e.filter(e=>e.openTool?!1!==r.supports?.openTool:e.minimize?!1!==r.supports?.minimize:!e.dispatch||!1!==r.supports?.dispatch);return 0===n.length?null:_jsx(View,{style:[styles.actions,"right"===o&&styles.actionsRight],children:n.slice(0,2).map(e=>{const o=r.actionState?.[actionKey(t,e)],n=!!r.busy||"running"===o||"done"===o;return _jsxs(Pressable,{accessibilityRole:"button",accessibilityLabel:e.label,testID:`buoy-block-action-${e.label.toLowerCase().replace(/\s+/g,"-")}`,disabled:n,onPress:()=>{r.runAction(e,t)},style:({pressed:t})=>[styles.button,e.primary?styles.buttonPrimary:styles.buttonPlate,n&&styles.buttonDisabled,t&&!n&&styles.pressed],children:["running"===o?_jsx(ActivityIndicator,{size:"small",color:e.primary?night.color.onAccent:night.color.text}):"done"===o?_jsx(Check,{size:12,color:e.primary?night.color.onAccent:night.color.accent}):"failed"===o?_jsx(X,{size:12,color:night.color.danger}):null,_jsx(Text,{style:[styles.buttonText,e.primary?styles.buttonTextPrimary:styles.buttonTextPlate],children:e.label})]},e.label)})})}export const blockStyles=StyleSheet.create({row:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:12,paddingVertical:9},rowDivider:{borderTopWidth:StyleSheet.hairlineWidth,borderTopColor:night.color.separator},rowTitle:{flex:1,color:night.color.text,fontSize:night.font.body,lineHeight:19},rowSub:{color:night.color.textSecondary,fontSize:night.font.caption,lineHeight:17},rowTrailing:{color:night.color.textTertiary,fontSize:night.font.caption,maxWidth:120,textAlign:"right"},mono:{fontFamily:"Menlo",fontSize:12,color:night.color.text},pill:{paddingHorizontal:7,paddingVertical:2,borderRadius:night.radius.badge,backgroundColor:night.color.fill},pillText:{fontSize:night.font.micro,fontWeight:"700",letterSpacing:.4,color:night.color.textSecondary}});const styles=StyleSheet.create({card:{borderRadius:night.radius.card,borderWidth:StyleSheet.hairlineWidth,borderColor:night.color.border,backgroundColor:night.color.surface,overflow:"hidden"},cardWarning:{borderColor:night.color.warning,backgroundColor:night.color.warningSoft},cardDanger:{borderColor:night.color.danger,backgroundColor:night.color.dangerSoft},cardInfo:{borderColor:night.color.accentBorderStrong,backgroundColor:night.color.accentSoft},titleRow:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:12,paddingTop:10,paddingBottom:6},flex:{flex:1},title:{flex:1,color:night.color.text,fontSize:night.font.caption,fontWeight:"600"},disclosure:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:12,paddingVertical:9},disclosureOpen:{borderBottomWidth:StyleSheet.hairlineWidth,borderBottomColor:night.color.separator},disclosureText:{flex:1,color:night.color.textSecondary,fontSize:night.font.caption},badge:{borderWidth:StyleSheet.hairlineWidth,borderRadius:night.radius.badge,paddingHorizontal:6,paddingVertical:2},badgeText:{fontSize:9,fontWeight:"700",letterSpacing:.6},moreRow:{flexDirection:"row"},more:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:4,paddingVertical:9,paddingHorizontal:8,borderTopWidth:StyleSheet.hairlineWidth,borderTopColor:night.color.separator},moreCell:{flex:1},moreText:{color:night.color.textSecondary,fontSize:night.font.caption,fontWeight:"600"},moreNote:{color:night.color.textTertiary,fontSize:night.font.caption},actions:{flexDirection:"row",gap:8,paddingHorizontal:12,paddingVertical:10,flexWrap:"wrap"},actionsRight:{justifyContent:"flex-end"},button:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:14,paddingVertical:9,borderRadius:night.radius.row},buttonPrimary:{backgroundColor:night.color.accent},buttonPlate:{backgroundColor:night.color.button},buttonDisabled:{opacity:.55},buttonText:{fontSize:night.font.caption,fontWeight:"600"},buttonTextPrimary:{color:night.color.onAccent},buttonTextPlate:{color:night.color.text},pressed:{opacity:.7}});
@@ -1,5 +1 @@
1
- "use strict";
2
-
3
- export { ActionRow, blockStyles, Card, More, MoreNote, ProvenanceBadge, toneColor, usePaged } from "./primitives";
4
- export { useBlockHandlers } from "./context";
5
- //# sourceMappingURL=primitivesIndex.js.map
1
+ "use strict";export{ActionRow,blockStyles,Card,More,MoreNote,ProvenanceBadge,toneColor,usePaged}from"./primitives";export{useBlockHandlers}from"./context";