@buoy-gg/ask-buoy 7.0.35 → 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 (286) hide show
  1. package/README.md +73 -15
  2. package/lib/commonjs/blocks/AskBlocks.js +1 -338
  3. package/lib/commonjs/blocks/BlockRenderer.js +1 -250
  4. package/lib/commonjs/blocks/ChromePrototypes.js +1 -514
  5. package/lib/commonjs/blocks/DataBlocks.js +1 -688
  6. package/lib/commonjs/blocks/ExtraBlocks.js +1 -1854
  7. package/lib/commonjs/blocks/MediaBlocks.js +1 -140
  8. package/lib/commonjs/blocks/ReceiptBlocks.js +1 -586
  9. package/lib/commonjs/blocks/blockText.js +1 -0
  10. package/lib/commonjs/blocks/blockText.test.js +1 -0
  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 -401
  18. package/lib/commonjs/blocks/primitivesIndex.js +1 -62
  19. package/lib/commonjs/components/ApprovalCard.js +1 -140
  20. package/lib/commonjs/components/AskBuoyHeader.js +1 -164
  21. package/lib/commonjs/components/AskBuoyIcon.js +1 -19
  22. package/lib/commonjs/components/AskBuoyModal.js +1 -353
  23. package/lib/commonjs/components/AskBuoySettings.js +1 -69
  24. package/lib/commonjs/components/ChangesBar.js +1 -211
  25. package/lib/commonjs/components/Composer.js +1 -175
  26. package/lib/commonjs/components/EmptyState.js +1 -154
  27. package/lib/commonjs/components/KeyboardPad.js +1 -0
  28. package/lib/commonjs/components/Markdown.js +1 -252
  29. package/lib/commonjs/components/MessageList.js +1 -683
  30. package/lib/commonjs/components/QueuedMessages.js +1 -0
  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 -0
  34. package/lib/commonjs/components/markdownParse.test.js +1 -0
  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 -0
  39. package/lib/commonjs/store/activityGroups.test.js +1 -0
  40. package/lib/commonjs/store/askBuoySettings.js +1 -67
  41. package/lib/commonjs/store/askBuoyStore.js +1 -365
  42. package/lib/commonjs/store/blockPlacement.js +1 -0
  43. package/lib/commonjs/store/blockPlacement.test.js +1 -0
  44. package/lib/commonjs/store/queue.test.js +1 -0
  45. package/lib/commonjs/store/resetConversation.js +1 -0
  46. package/lib/commonjs/store/restorePending.test.js +1 -0
  47. package/lib/commonjs/store/restoredIds.test.js +1 -47
  48. package/lib/commonjs/store/suggestions.js +1 -0
  49. package/lib/commonjs/store/suggestions.test.js +1 -0
  50. package/lib/commonjs/store/systemLine.test.js +1 -0
  51. package/lib/commonjs/store/ticketPrompt.js +1 -0
  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 -208
  55. package/lib/commonjs/store/transcriptPersistence.test.js +1 -185
  56. package/lib/commonjs/store/turnRendering.test.js +1 -0
  57. package/lib/commonjs/store/useAskBuoy.js +1 -400
  58. package/lib/commonjs/store/useAskBuoySettings.js +1 -14
  59. package/lib/commonjs/sync/askBuoySyncAdapter.js +1 -119
  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 -245
  65. package/lib/module/blocks/ChromePrototypes.js +1 -503
  66. package/lib/module/blocks/DataBlocks.js +1 -674
  67. package/lib/module/blocks/ExtraBlocks.js +1 -1827
  68. package/lib/module/blocks/MediaBlocks.js +1 -135
  69. package/lib/module/blocks/ReceiptBlocks.js +1 -574
  70. package/lib/module/blocks/blockText.js +1 -0
  71. package/lib/module/blocks/blockText.test.js +1 -0
  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 -389
  79. package/lib/module/blocks/primitivesIndex.js +1 -5
  80. package/lib/module/components/ApprovalCard.js +1 -135
  81. package/lib/module/components/AskBuoyHeader.js +1 -161
  82. package/lib/module/components/AskBuoyIcon.js +1 -8
  83. package/lib/module/components/AskBuoyModal.js +1 -348
  84. package/lib/module/components/AskBuoySettings.js +1 -64
  85. package/lib/module/components/ChangesBar.js +1 -206
  86. package/lib/module/components/Composer.js +1 -170
  87. package/lib/module/components/EmptyState.js +1 -149
  88. package/lib/module/components/KeyboardPad.js +1 -0
  89. package/lib/module/components/Markdown.js +1 -246
  90. package/lib/module/components/MessageList.js +1 -677
  91. package/lib/module/components/QueuedMessages.js +1 -0
  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 -0
  95. package/lib/module/components/markdownParse.test.js +1 -0
  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 -0
  100. package/lib/module/store/activityGroups.test.js +1 -0
  101. package/lib/module/store/askBuoySettings.js +1 -62
  102. package/lib/module/store/askBuoyStore.js +1 -361
  103. package/lib/module/store/blockPlacement.js +1 -0
  104. package/lib/module/store/blockPlacement.test.js +1 -0
  105. package/lib/module/store/queue.test.js +1 -0
  106. package/lib/module/store/resetConversation.js +1 -0
  107. package/lib/module/store/restorePending.test.js +1 -0
  108. package/lib/module/store/restoredIds.test.js +1 -46
  109. package/lib/module/store/suggestions.js +1 -0
  110. package/lib/module/store/suggestions.test.js +1 -0
  111. package/lib/module/store/systemLine.test.js +1 -0
  112. package/lib/module/store/ticketPrompt.js +1 -0
  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 -198
  116. package/lib/module/store/transcriptPersistence.test.js +1 -184
  117. package/lib/module/store/turnRendering.test.js +1 -0
  118. package/lib/module/store/useAskBuoy.js +1 -394
  119. package/lib/module/store/useAskBuoySettings.js +1 -9
  120. package/lib/module/sync/askBuoySyncAdapter.js +1 -114
  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/blocks/DataBlocks.d.ts +11 -0
  125. package/lib/typescript/blocks/ExtraBlocks.d.ts +18 -2
  126. package/lib/typescript/blocks/blockText.d.ts +14 -0
  127. package/lib/typescript/blocks/blockText.test.d.ts +2 -0
  128. package/lib/typescript/blocks/primitives.d.ts +16 -1
  129. package/lib/typescript/components/ApprovalCard.d.ts +9 -1
  130. package/lib/typescript/components/AskBuoyHeader.d.ts +31 -1
  131. package/lib/typescript/components/Composer.d.ts +16 -1
  132. package/lib/typescript/components/EmptyState.d.ts +5 -1
  133. package/lib/typescript/components/KeyboardPad.d.ts +33 -0
  134. package/lib/typescript/components/Markdown.d.ts +0 -10
  135. package/lib/typescript/components/MessageList.d.ts +7 -2
  136. package/lib/typescript/components/QueuedMessages.d.ts +10 -0
  137. package/lib/typescript/components/markdownParse.d.ts +49 -0
  138. package/lib/typescript/components/markdownParse.test.d.ts +2 -0
  139. package/lib/typescript/preset.d.ts +4 -2
  140. package/lib/typescript/store/activityGroups.d.ts +29 -0
  141. package/lib/typescript/store/activityGroups.test.d.ts +2 -0
  142. package/lib/typescript/store/askBuoySettings.d.ts +22 -0
  143. package/lib/typescript/store/askBuoyStore.d.ts +174 -9
  144. package/lib/typescript/store/blockPlacement.d.ts +30 -0
  145. package/lib/typescript/store/blockPlacement.test.d.ts +2 -0
  146. package/lib/typescript/store/queue.test.d.ts +2 -0
  147. package/lib/typescript/store/resetConversation.d.ts +38 -0
  148. package/lib/typescript/store/restorePending.test.d.ts +2 -0
  149. package/lib/typescript/store/suggestions.d.ts +32 -0
  150. package/lib/typescript/store/suggestions.test.d.ts +2 -0
  151. package/lib/typescript/store/systemLine.test.d.ts +2 -0
  152. package/lib/typescript/store/ticketPrompt.d.ts +11 -0
  153. package/lib/typescript/store/transcriptPersistence.d.ts +41 -2
  154. package/lib/typescript/store/turnRendering.test.d.ts +2 -0
  155. package/lib/typescript/store/useAskBuoy.d.ts +26 -3
  156. package/lib/typescript/sync/askBuoySyncAdapter.d.ts +29 -6
  157. package/package.json +10 -10
  158. package/lib/commonjs/blocks/AskBlocks.js.map +0 -1
  159. package/lib/commonjs/blocks/BlockRenderer.js.map +0 -1
  160. package/lib/commonjs/blocks/ChromePrototypes.js.map +0 -1
  161. package/lib/commonjs/blocks/DataBlocks.js.map +0 -1
  162. package/lib/commonjs/blocks/ExtraBlocks.js.map +0 -1
  163. package/lib/commonjs/blocks/MediaBlocks.js.map +0 -1
  164. package/lib/commonjs/blocks/ReceiptBlocks.js.map +0 -1
  165. package/lib/commonjs/blocks/context.js.map +0 -1
  166. package/lib/commonjs/blocks/icons.js.map +0 -1
  167. package/lib/commonjs/blocks/index.js.map +0 -1
  168. package/lib/commonjs/blocks/listRow.test.js.map +0 -1
  169. package/lib/commonjs/blocks/pageState.js.map +0 -1
  170. package/lib/commonjs/blocks/pageState.test.js.map +0 -1
  171. package/lib/commonjs/blocks/primitives.js.map +0 -1
  172. package/lib/commonjs/blocks/primitivesIndex.js.map +0 -1
  173. package/lib/commonjs/components/ApprovalCard.js.map +0 -1
  174. package/lib/commonjs/components/AskBuoyHeader.js.map +0 -1
  175. package/lib/commonjs/components/AskBuoyIcon.js.map +0 -1
  176. package/lib/commonjs/components/AskBuoyModal.js.map +0 -1
  177. package/lib/commonjs/components/AskBuoySettings.js.map +0 -1
  178. package/lib/commonjs/components/ChangesBar.js.map +0 -1
  179. package/lib/commonjs/components/Composer.js.map +0 -1
  180. package/lib/commonjs/components/EmptyState.js.map +0 -1
  181. package/lib/commonjs/components/Markdown.js.map +0 -1
  182. package/lib/commonjs/components/MessageList.js.map +0 -1
  183. package/lib/commonjs/components/ThinkingStrip.js.map +0 -1
  184. package/lib/commonjs/components/TypingDots.js.map +0 -1
  185. package/lib/commonjs/components/useCopyAction.js.map +0 -1
  186. package/lib/commonjs/index.js.map +0 -1
  187. package/lib/commonjs/preset.js.map +0 -1
  188. package/lib/commonjs/store/askBuoySettings.js.map +0 -1
  189. package/lib/commonjs/store/askBuoyStore.js.map +0 -1
  190. package/lib/commonjs/store/restoredIds.test.js.map +0 -1
  191. package/lib/commonjs/store/traceText.js.map +0 -1
  192. package/lib/commonjs/store/traceText.test.js.map +0 -1
  193. package/lib/commonjs/store/transcriptPersistence.js.map +0 -1
  194. package/lib/commonjs/store/transcriptPersistence.test.js.map +0 -1
  195. package/lib/commonjs/store/useAskBuoy.js.map +0 -1
  196. package/lib/commonjs/store/useAskBuoySettings.js.map +0 -1
  197. package/lib/commonjs/sync/askBuoySyncAdapter.js.map +0 -1
  198. package/lib/commonjs/sync/askBuoySyncAdapter.test.js.map +0 -1
  199. package/lib/commonjs/sync/wire.js.map +0 -1
  200. package/lib/commonjs/types.js.map +0 -1
  201. package/lib/module/blocks/AskBlocks.js.map +0 -1
  202. package/lib/module/blocks/BlockRenderer.js.map +0 -1
  203. package/lib/module/blocks/ChromePrototypes.js.map +0 -1
  204. package/lib/module/blocks/DataBlocks.js.map +0 -1
  205. package/lib/module/blocks/ExtraBlocks.js.map +0 -1
  206. package/lib/module/blocks/MediaBlocks.js.map +0 -1
  207. package/lib/module/blocks/ReceiptBlocks.js.map +0 -1
  208. package/lib/module/blocks/context.js.map +0 -1
  209. package/lib/module/blocks/icons.js.map +0 -1
  210. package/lib/module/blocks/index.js.map +0 -1
  211. package/lib/module/blocks/listRow.test.js.map +0 -1
  212. package/lib/module/blocks/pageState.js.map +0 -1
  213. package/lib/module/blocks/pageState.test.js.map +0 -1
  214. package/lib/module/blocks/primitives.js.map +0 -1
  215. package/lib/module/blocks/primitivesIndex.js.map +0 -1
  216. package/lib/module/components/ApprovalCard.js.map +0 -1
  217. package/lib/module/components/AskBuoyHeader.js.map +0 -1
  218. package/lib/module/components/AskBuoyIcon.js.map +0 -1
  219. package/lib/module/components/AskBuoyModal.js.map +0 -1
  220. package/lib/module/components/AskBuoySettings.js.map +0 -1
  221. package/lib/module/components/ChangesBar.js.map +0 -1
  222. package/lib/module/components/Composer.js.map +0 -1
  223. package/lib/module/components/EmptyState.js.map +0 -1
  224. package/lib/module/components/Markdown.js.map +0 -1
  225. package/lib/module/components/MessageList.js.map +0 -1
  226. package/lib/module/components/ThinkingStrip.js.map +0 -1
  227. package/lib/module/components/TypingDots.js.map +0 -1
  228. package/lib/module/components/useCopyAction.js.map +0 -1
  229. package/lib/module/index.js.map +0 -1
  230. package/lib/module/preset.js.map +0 -1
  231. package/lib/module/store/askBuoySettings.js.map +0 -1
  232. package/lib/module/store/askBuoyStore.js.map +0 -1
  233. package/lib/module/store/restoredIds.test.js.map +0 -1
  234. package/lib/module/store/traceText.js.map +0 -1
  235. package/lib/module/store/traceText.test.js.map +0 -1
  236. package/lib/module/store/transcriptPersistence.js.map +0 -1
  237. package/lib/module/store/transcriptPersistence.test.js.map +0 -1
  238. package/lib/module/store/useAskBuoy.js.map +0 -1
  239. package/lib/module/store/useAskBuoySettings.js.map +0 -1
  240. package/lib/module/sync/askBuoySyncAdapter.js.map +0 -1
  241. package/lib/module/sync/askBuoySyncAdapter.test.js.map +0 -1
  242. package/lib/module/sync/wire.js.map +0 -1
  243. package/lib/module/types.js.map +0 -1
  244. package/lib/typescript/blocks/AskBlocks.d.ts.map +0 -1
  245. package/lib/typescript/blocks/BlockRenderer.d.ts.map +0 -1
  246. package/lib/typescript/blocks/ChromePrototypes.d.ts.map +0 -1
  247. package/lib/typescript/blocks/DataBlocks.d.ts.map +0 -1
  248. package/lib/typescript/blocks/ExtraBlocks.d.ts.map +0 -1
  249. package/lib/typescript/blocks/MediaBlocks.d.ts.map +0 -1
  250. package/lib/typescript/blocks/ReceiptBlocks.d.ts.map +0 -1
  251. package/lib/typescript/blocks/context.d.ts.map +0 -1
  252. package/lib/typescript/blocks/icons.d.ts.map +0 -1
  253. package/lib/typescript/blocks/index.d.ts.map +0 -1
  254. package/lib/typescript/blocks/listRow.test.d.ts.map +0 -1
  255. package/lib/typescript/blocks/pageState.d.ts.map +0 -1
  256. package/lib/typescript/blocks/pageState.test.d.ts.map +0 -1
  257. package/lib/typescript/blocks/primitives.d.ts.map +0 -1
  258. package/lib/typescript/blocks/primitivesIndex.d.ts.map +0 -1
  259. package/lib/typescript/components/ApprovalCard.d.ts.map +0 -1
  260. package/lib/typescript/components/AskBuoyHeader.d.ts.map +0 -1
  261. package/lib/typescript/components/AskBuoyIcon.d.ts.map +0 -1
  262. package/lib/typescript/components/AskBuoyModal.d.ts.map +0 -1
  263. package/lib/typescript/components/AskBuoySettings.d.ts.map +0 -1
  264. package/lib/typescript/components/ChangesBar.d.ts.map +0 -1
  265. package/lib/typescript/components/Composer.d.ts.map +0 -1
  266. package/lib/typescript/components/EmptyState.d.ts.map +0 -1
  267. package/lib/typescript/components/Markdown.d.ts.map +0 -1
  268. package/lib/typescript/components/MessageList.d.ts.map +0 -1
  269. package/lib/typescript/components/ThinkingStrip.d.ts.map +0 -1
  270. package/lib/typescript/components/TypingDots.d.ts.map +0 -1
  271. package/lib/typescript/components/useCopyAction.d.ts.map +0 -1
  272. package/lib/typescript/index.d.ts.map +0 -1
  273. package/lib/typescript/preset.d.ts.map +0 -1
  274. package/lib/typescript/store/askBuoySettings.d.ts.map +0 -1
  275. package/lib/typescript/store/askBuoyStore.d.ts.map +0 -1
  276. package/lib/typescript/store/restoredIds.test.d.ts.map +0 -1
  277. package/lib/typescript/store/traceText.d.ts.map +0 -1
  278. package/lib/typescript/store/traceText.test.d.ts.map +0 -1
  279. package/lib/typescript/store/transcriptPersistence.d.ts.map +0 -1
  280. package/lib/typescript/store/transcriptPersistence.test.d.ts.map +0 -1
  281. package/lib/typescript/store/useAskBuoy.d.ts.map +0 -1
  282. package/lib/typescript/store/useAskBuoySettings.d.ts.map +0 -1
  283. package/lib/typescript/sync/askBuoySyncAdapter.d.ts.map +0 -1
  284. package/lib/typescript/sync/askBuoySyncAdapter.test.d.ts.map +0 -1
  285. package/lib/typescript/sync/wire.d.ts.map +0 -1
  286. package/lib/typescript/types.d.ts.map +0 -1
@@ -1,586 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Crash = Crash;
7
- exports.LogList = LogList;
8
- exports.Peek = Peek;
9
- exports.RequestCard = RequestCard;
10
- exports.RequestList = RequestList;
11
- exports.RouteChips = RouteChips;
12
- exports.RuleCard = RuleCard;
13
- exports.ScreenElements = ScreenElements;
14
- var _react = require("react");
15
- var _reactNative = require("react-native");
16
- var _sharedUi = require("@buoy-gg/shared-ui");
17
- var _agentCore = require("@buoy-gg/agent-core");
18
- var _context = require("./context");
19
- var _primitives = require("./primitives");
20
- var _jsxRuntime = require("react/jsx-runtime");
21
- /**
22
- * Receipts — engine-made blocks for the tools people ask about most.
23
- * Each one is a card the matching Buoy tool could have drawn, with one tap
24
- * into that tool where the host supports it.
25
- */
26
-
27
- function statusColor(status) {
28
- if (status === undefined) return _sharedUi.night.color.textTertiary;
29
- if (status >= 500) return _sharedUi.night.color.danger;
30
- if (status >= 400) return _sharedUi.night.color.warning;
31
- if (status >= 300) return _sharedUi.night.color.info;
32
- return _sharedUi.night.color.accent;
33
- }
34
- function pathOf(url) {
35
- try {
36
- const u = new URL(url);
37
- return u.pathname + (u.search ? "?…" : "");
38
- } catch {
39
- return url;
40
- }
41
- }
42
- function StatusPill({
43
- status
44
- }) {
45
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
46
- style: [_primitives.blockStyles.pill, {
47
- backgroundColor: `${statusColor(status)}22`
48
- }],
49
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
50
- style: [_primitives.blockStyles.pillText, {
51
- color: statusColor(status)
52
- }],
53
- children: status ?? "…"
54
- })
55
- });
56
- }
57
- function RequestList({
58
- block
59
- }) {
60
- const h = (0, _context.useBlockHandlers)();
61
- const canOpen = h.supports?.openTool !== false;
62
- const paged = (0, _primitives.usePaged)(block.requests, _agentCore.CAPS.listItems);
63
- const {
64
- visible
65
- } = paged;
66
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.Card, {
67
- title: block.title ?? "Network requests",
68
- source: block.source,
69
- testID: `buoy-block-requests-${block.id}`,
70
- children: [visible.map((r, i) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
71
- disabled: !canOpen,
72
- onPress: () => void h.runAction({
73
- label: "Open in Network",
74
- openTool: {
75
- toolId: "network",
76
- select: r.id
77
- }
78
- }, block.id),
79
- style: [_primitives.blockStyles.row, i > 0 && _primitives.blockStyles.rowDivider],
80
- accessibilityRole: canOpen ? "button" : undefined,
81
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
82
- style: styles.method,
83
- children: r.method
84
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
85
- style: _primitives.blockStyles.rowTitle,
86
- numberOfLines: 1,
87
- children: pathOf(r.url)
88
- }), r.mocked ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
89
- style: styles.mockedChip,
90
- children: "MOCKED"
91
- }) : null, r.durationMs !== undefined ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
92
- style: _primitives.blockStyles.rowTrailing,
93
- children: [r.durationMs, " ms"]
94
- }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(StatusPill, {
95
- status: r.status
96
- }), canOpen ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ChevronRight, {
97
- size: 12,
98
- color: _sharedUi.night.color.textTertiary
99
- }) : null]
100
- }, `${r.id}-${i}`)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.More, {
101
- paged: paged
102
- })]
103
- });
104
- }
105
-
106
- /** Module scope — a fresh array per render is a new prop identity for nothing. */
107
- const REQUEST_TABS = [{
108
- key: "response",
109
- label: "Response"
110
- }, {
111
- key: "request",
112
- label: "Request"
113
- }];
114
- function RequestCard({
115
- block
116
- }) {
117
- const [tab, setTab] = (0, _react.useState)("response");
118
- const body = tab === "response" ? block.responseBody : block.requestBody;
119
- const text = body === undefined ? "(none)" : typeof body === "string" ? body : JSON.stringify(body, null, 2);
120
- const h = (0, _context.useBlockHandlers)();
121
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.Card, {
122
- source: block.source,
123
- testID: `buoy-block-request-${block.id}`,
124
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
125
- style: [_primitives.blockStyles.row, styles.reqHead],
126
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
127
- style: styles.method,
128
- children: block.request.method
129
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
130
- style: _primitives.blockStyles.rowTitle,
131
- numberOfLines: 2,
132
- children: pathOf(block.request.url)
133
- }), block.request.mocked ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
134
- style: styles.mockedChip,
135
- children: "MOCKED"
136
- }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(StatusPill, {
137
- status: block.request.status
138
- })]
139
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
140
- style: styles.tabs,
141
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.NightSegmented, {
142
- tabs: REQUEST_TABS,
143
- activeKey: tab,
144
- onChange: key => setTab(key),
145
- size: "sm"
146
- })
147
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
148
- style: [_primitives.blockStyles.mono, styles.body],
149
- numberOfLines: 14,
150
- selectable: true,
151
- children: text.length > 1600 ? `${text.slice(0, 1600)}\n…` : text
152
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.ActionRow, {
153
- blockId: block.id,
154
- actions: [{
155
- label: "Open in Network",
156
- openTool: {
157
- toolId: "network",
158
- select: block.request.id
159
- }
160
- }]
161
- }), h.supports?.openTool === false ? null : null]
162
- });
163
- }
164
- function RuleCard({
165
- block
166
- }) {
167
- const r = block.rule;
168
- const outcome = r.kind === "fail" ? "fails (no network)" : r.kind === "delay" ? `delayed ${r.delayMs ?? 0} ms` : `returns ${r.status ?? 200}`;
169
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.Card, {
170
- title: r.name ?? "Network override",
171
- source: block.source,
172
- testID: `buoy-block-rule-${block.id}`,
173
- tone: r.enabled ? "warning" : undefined,
174
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
175
- style: styles.ruleBody,
176
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
177
- style: styles.ruleLine,
178
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
179
- style: styles.ruleKey,
180
- children: [r.methods?.length ? r.methods.join("/") : "ANY", " "]
181
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
182
- style: _primitives.blockStyles.mono,
183
- children: r.urlPattern
184
- })]
185
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
186
- style: styles.ruleLine,
187
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
188
- style: styles.ruleKey,
189
- children: "\u2192 "
190
- }), outcome, r.times ? ` · ${r.times === 1 ? "once" : `${r.times} times`}` : " · every time", r.hits !== undefined ? ` · ${r.hits} hit${r.hits === 1 ? "" : "s"}` : ""]
191
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
192
- style: [_primitives.blockStyles.pill, r.enabled ? styles.on : styles.off],
193
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
194
- style: [_primitives.blockStyles.pillText, {
195
- color: r.enabled ? _sharedUi.night.color.onAccent : _sharedUi.night.color.textSecondary
196
- }],
197
- children: r.enabled ? "ON" : "OFF"
198
- })
199
- })]
200
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.ActionRow, {
201
- blockId: block.id,
202
- actions: [r.enabled ? {
203
- label: "Turn off",
204
- dispatch: {
205
- toolId: "network",
206
- action: "setOverrideRuleEnabled",
207
- params: {
208
- id: r.id,
209
- enabled: false
210
- }
211
- }
212
- } : {
213
- label: "Turn on",
214
- primary: true,
215
- dispatch: {
216
- toolId: "network",
217
- action: "setOverrideRuleEnabled",
218
- params: {
219
- id: r.id,
220
- enabled: true
221
- }
222
- }
223
- }, {
224
- label: "Delete",
225
- dispatch: {
226
- toolId: "network",
227
- action: "deleteOverrideRule",
228
- params: {
229
- id: r.id
230
- }
231
- }
232
- }]
233
- })]
234
- });
235
- }
236
- function ScreenElements({
237
- block
238
- }) {
239
- const h = (0, _context.useBlockHandlers)();
240
- const paged = (0, _primitives.usePaged)(block.elements, _agentCore.CAPS.chips);
241
- const {
242
- visible
243
- } = paged;
244
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.Card, {
245
- title: block.title ?? "On screen right now",
246
- source: block.source,
247
- testID: `buoy-block-screen-${block.id}`,
248
- children: [visible.map((e, i) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
249
- onPress: () => void h.runAction({
250
- label: "Highlight",
251
- dispatch: {
252
- toolId: "highlight-updates",
253
- action: "setSpotlight",
254
- params: {
255
- nativeTag: e.nativeTag
256
- }
257
- }
258
- }, block.id),
259
- disabled: h.supports?.dispatch === false,
260
- style: [_primitives.blockStyles.row, i > 0 && _primitives.blockStyles.rowDivider],
261
- accessibilityRole: "button",
262
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Eye, {
263
- size: 12,
264
- color: _sharedUi.night.color.textTertiary
265
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
266
- style: _primitives.blockStyles.rowTitle,
267
- numberOfLines: 1,
268
- children: e.label ?? e.testID ?? e.name
269
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
270
- style: _primitives.blockStyles.rowTrailing,
271
- numberOfLines: 1,
272
- children: e.name
273
- })]
274
- }, `${e.nativeTag}-${i}`)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.More, {
275
- paged: paged
276
- })]
277
- });
278
- }
279
- function RouteChips({
280
- block
281
- }) {
282
- const h = (0, _context.useBlockHandlers)();
283
- const paged = (0, _primitives.usePaged)(block.routes, _agentCore.CAPS.chips);
284
- const routes = paged.visible;
285
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.Card, {
286
- title: block.current ? `Routes · you're on ${block.current}` : "Routes",
287
- source: block.source,
288
- testID: `buoy-block-routes-${block.id}`,
289
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
290
- style: styles.chips,
291
- children: routes.map((r, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
292
- disabled: h.supports?.dispatch === false,
293
- onPress: () => r.dynamic ? h.answer({
294
- blockId: block.id,
295
- kind: "input",
296
- value: `Open ${r.path} — which id?`
297
- }) : void h.runAction({
298
- label: `Open ${r.path}`,
299
- dispatch: {
300
- toolId: "route-events",
301
- action: "navigate",
302
- params: {
303
- path: r.path
304
- }
305
- }
306
- }, block.id),
307
- style: [styles.chip, r.path === block.current && styles.chipCurrent],
308
- accessibilityRole: "button",
309
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
310
- style: [styles.chipText, r.dynamic && styles.chipDynamic],
311
- children: r.path
312
- })
313
- }, `${r.path}-${i}`))
314
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.More, {
315
- paged: paged
316
- })]
317
- });
318
- }
319
- const LEVEL_COLOR = {
320
- error: _sharedUi.night.color.danger,
321
- warn: _sharedUi.night.color.warning,
322
- warning: _sharedUi.night.color.warning,
323
- info: _sharedUi.night.color.info
324
- };
325
- function LogList({
326
- block
327
- }) {
328
- const paged = (0, _primitives.usePaged)(block.entries, _agentCore.CAPS.listItems);
329
- const {
330
- visible
331
- } = paged;
332
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.Card, {
333
- title: "Console",
334
- source: block.source,
335
- testID: `buoy-block-logs-${block.id}`,
336
- children: [visible.map((e, i) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
337
- style: [_primitives.blockStyles.row, i > 0 && _primitives.blockStyles.rowDivider, styles.logRow],
338
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
339
- style: [_primitives.blockStyles.pill, {
340
- backgroundColor: `${LEVEL_COLOR[e.level] ?? _sharedUi.night.color.textTertiary}22`
341
- }],
342
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
343
- style: [_primitives.blockStyles.pillText, {
344
- color: LEVEL_COLOR[e.level] ?? _sharedUi.night.color.textSecondary
345
- }],
346
- children: e.level.toUpperCase()
347
- })
348
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
349
- style: [_primitives.blockStyles.rowTitle, _primitives.blockStyles.mono],
350
- numberOfLines: 3,
351
- children: e.message
352
- }), e.count > 1 ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
353
- style: _primitives.blockStyles.rowTrailing,
354
- children: ["\xD7", e.count]
355
- }) : null]
356
- }, `${e.level}-${e.message}-${i}`)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.More, {
357
- paged: paged
358
- })]
359
- });
360
- }
361
- function Crash({
362
- block
363
- }) {
364
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.Card, {
365
- tone: "danger",
366
- testID: `buoy-block-crash-${block.id}`,
367
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
368
- style: styles.crashHead,
369
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.AlertTriangle, {
370
- size: 14,
371
- color: _sharedUi.night.color.danger
372
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
373
- style: styles.crashTitle,
374
- children: ["The app crashed", block.route ? ` on ${block.route}` : ""]
375
- })]
376
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
377
- style: [_primitives.blockStyles.mono, styles.crashMsg],
378
- numberOfLines: 4,
379
- selectable: true,
380
- children: block.message
381
- }), block.suspect ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
382
- style: styles.suspect,
383
- children: ["Most likely cause: ", block.suspect.label]
384
- }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.ActionRow, {
385
- blockId: block.id,
386
- actions: [...(block.suspect?.action ? [{
387
- ...block.suspect.action,
388
- primary: true
389
- }] : []), ...(block.actions ?? [])].slice(0, 2)
390
- })]
391
- });
392
- }
393
-
394
- /** A chip, not a card: the agent moved the app; let the user look. */
395
- function Peek({
396
- block
397
- }) {
398
- const h = (0, _context.useBlockHandlers)();
399
- const can = h.supports?.minimize !== false;
400
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
401
- testID: `buoy-block-peek-${block.id}`,
402
- disabled: !can,
403
- onPress: () => void h.runAction({
404
- label: "Look",
405
- minimize: true
406
- }, block.id),
407
- style: ({
408
- pressed
409
- }) => [styles.peek, pressed && {
410
- opacity: 0.7
411
- }],
412
- accessibilityRole: "button",
413
- accessibilityLabel: `${block.label}. Look at the app`,
414
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
415
- style: styles.peekText,
416
- children: block.label
417
- }), can ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
418
- style: styles.peekLook,
419
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Eye, {
420
- size: 12,
421
- color: _sharedUi.night.color.accent
422
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
423
- style: styles.peekLookText,
424
- children: "Look"
425
- })]
426
- }) : null]
427
- });
428
- }
429
- const styles = _reactNative.StyleSheet.create({
430
- method: {
431
- color: _sharedUi.night.color.textSecondary,
432
- fontSize: _sharedUi.night.font.micro,
433
- fontWeight: "700",
434
- letterSpacing: 0.4,
435
- width: 44
436
- },
437
- // The provenance chip for a response an override rule synthesized. Loud on
438
- // purpose: mocked data rendered like live data is how testers file bugs
439
- // against reality that never existed.
440
- mockedChip: {
441
- color: _sharedUi.night.color.warning,
442
- backgroundColor: _sharedUi.night.color.warningSoft,
443
- fontSize: 9,
444
- fontWeight: "700",
445
- letterSpacing: 0.6,
446
- paddingHorizontal: 5,
447
- paddingVertical: 1,
448
- borderRadius: _sharedUi.night.radius.badge,
449
- overflow: "hidden"
450
- },
451
- reqHead: {
452
- paddingTop: 12
453
- },
454
- // The segmented control draws its own track; this is only its gutter.
455
- tabs: {
456
- paddingHorizontal: 12,
457
- paddingTop: 4,
458
- paddingBottom: 8
459
- },
460
- tab: {
461
- paddingHorizontal: 10,
462
- paddingVertical: 5,
463
- borderRadius: _sharedUi.night.radius.badge,
464
- backgroundColor: _sharedUi.night.color.fill
465
- },
466
- tabOn: {
467
- backgroundColor: _sharedUi.night.color.accentSoft
468
- },
469
- tabText: {
470
- color: _sharedUi.night.color.textSecondary,
471
- fontSize: _sharedUi.night.font.micro,
472
- fontWeight: "600"
473
- },
474
- tabTextOn: {
475
- color: _sharedUi.night.color.accent
476
- },
477
- body: {
478
- paddingHorizontal: 12,
479
- paddingBottom: 4,
480
- lineHeight: 16,
481
- color: _sharedUi.night.color.textSecondary
482
- },
483
- ruleBody: {
484
- paddingHorizontal: 12,
485
- paddingTop: 4,
486
- paddingBottom: 4,
487
- gap: 4
488
- },
489
- ruleLine: {
490
- color: _sharedUi.night.color.text,
491
- fontSize: _sharedUi.night.font.caption,
492
- lineHeight: 18
493
- },
494
- ruleKey: {
495
- color: _sharedUi.night.color.textSecondary,
496
- fontWeight: "700"
497
- },
498
- on: {
499
- alignSelf: "flex-start",
500
- backgroundColor: _sharedUi.night.color.accent,
501
- marginTop: 4
502
- },
503
- off: {
504
- alignSelf: "flex-start",
505
- backgroundColor: _sharedUi.night.color.fillTertiary,
506
- marginTop: 4
507
- },
508
- chips: {
509
- flexDirection: "row",
510
- flexWrap: "wrap",
511
- gap: 6,
512
- padding: 12
513
- },
514
- chip: {
515
- paddingHorizontal: 10,
516
- paddingVertical: 6,
517
- borderRadius: _sharedUi.night.radius.chip,
518
- backgroundColor: _sharedUi.night.color.fill,
519
- borderWidth: _reactNative.StyleSheet.hairlineWidth,
520
- borderColor: _sharedUi.night.color.border
521
- },
522
- chipCurrent: {
523
- backgroundColor: _sharedUi.night.color.accentSoft,
524
- borderColor: _sharedUi.night.color.accentBorderStrong
525
- },
526
- chipText: {
527
- color: _sharedUi.night.color.text,
528
- fontSize: _sharedUi.night.font.caption,
529
- fontFamily: "Menlo"
530
- },
531
- chipDynamic: {
532
- color: _sharedUi.night.color.textSecondary
533
- },
534
- logRow: {
535
- alignItems: "flex-start"
536
- },
537
- crashHead: {
538
- flexDirection: "row",
539
- alignItems: "center",
540
- gap: 8,
541
- paddingHorizontal: 12,
542
- paddingTop: 12
543
- },
544
- crashTitle: {
545
- color: _sharedUi.night.color.danger,
546
- fontSize: _sharedUi.night.font.row,
547
- fontWeight: "600"
548
- },
549
- crashMsg: {
550
- paddingHorizontal: 12,
551
- paddingTop: 6,
552
- color: _sharedUi.night.color.text
553
- },
554
- suspect: {
555
- color: _sharedUi.night.color.textSecondary,
556
- fontSize: _sharedUi.night.font.caption,
557
- paddingHorizontal: 12,
558
- paddingTop: 6
559
- },
560
- peek: {
561
- alignSelf: "flex-start",
562
- flexDirection: "row",
563
- alignItems: "center",
564
- gap: 10,
565
- paddingLeft: 12,
566
- paddingRight: 10,
567
- paddingVertical: 7,
568
- borderRadius: _sharedUi.night.radius.chip,
569
- backgroundColor: _sharedUi.night.color.fill
570
- },
571
- peekText: {
572
- color: _sharedUi.night.color.textSecondary,
573
- fontSize: _sharedUi.night.font.caption
574
- },
575
- peekLook: {
576
- flexDirection: "row",
577
- alignItems: "center",
578
- gap: 4
579
- },
580
- peekLookText: {
581
- color: _sharedUi.night.color.accent,
582
- fontSize: _sharedUi.night.font.caption,
583
- fontWeight: "600"
584
- }
585
- });
586
- //# sourceMappingURL=ReceiptBlocks.js.map
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Crash=Crash,exports.LogList=LogList,exports.Peek=Peek,exports.RequestCard=RequestCard,exports.RequestList=RequestList,exports.RouteChips=RouteChips,exports.RuleCard=RuleCard,exports.ScreenElements=ScreenElements;var _react=require("react"),_reactNative=require("react-native"),_sharedUi=require("@buoy-gg/shared-ui"),_agentCore=require("@buoy-gg/agent-core"),_context=require("./context"),_primitives=require("./primitives"),_jsxRuntime=require("react/jsx-runtime");function statusColor(e){return void 0===e?_sharedUi.night.color.textTertiary:e>=500?_sharedUi.night.color.danger:e>=400?_sharedUi.night.color.warning:e>=300?_sharedUi.night.color.info:_sharedUi.night.color.accent}function pathOf(e){try{const t=new URL(e);return t.pathname+(t.search?"?…":"")}catch{return e}}function StatusPill({status:e}){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[_primitives.blockStyles.pill,{backgroundColor:`${statusColor(e)}22`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitives.blockStyles.pillText,{color:statusColor(e)}],children:e??"…"})})}function RequestList({block:e}){const t=(0,_context.useBlockHandlers)(),i=!1!==t.supports?.openTool,s=(0,_primitives.usePaged)(e.requests,_agentCore.CAPS.listItems),{visible:r}=s;return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:e.title??"Network requests",source:e.source,testID:`buoy-block-requests-${e.id}`,children:[r.map((s,r)=>(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{disabled:!i,onPress:()=>{t.runAction({label:"Open in Network",openTool:{toolId:"network",select:s.id}},e.id)},style:[_primitives.blockStyles.row,r>0&&_primitives.blockStyles.rowDivider],accessibilityRole:i?"button":void 0,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.method,children:s.method}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitives.blockStyles.rowTitle,numberOfLines:1,children:pathOf(s.url)}),s.mocked?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.mockedChip,children:"MOCKED"}):null,void 0!==s.durationMs?(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:_primitives.blockStyles.rowTrailing,children:[s.durationMs," ms"]}):null,(0,_jsxRuntime.jsx)(StatusPill,{status:s.status}),i?(0,_jsxRuntime.jsx)(_sharedUi.ChevronRight,{size:12,color:_sharedUi.night.color.textTertiary}):null]},`${s.id}-${r}`)),(0,_jsxRuntime.jsx)(_primitives.More,{paged:s})]})}const REQUEST_TABS=[{key:"response",label:"Response"},{key:"request",label:"Request"}];function RequestCard({block:e}){const[t,i]=(0,_react.useState)("response"),s="response"===t?e.responseBody:e.requestBody,r=void 0===s?"(none)":"string"==typeof s?s:JSON.stringify(s,null,2),o=(0,_context.useBlockHandlers)();return(0,_jsxRuntime.jsxs)(_primitives.Card,{source:e.source,testID:`buoy-block-request-${e.id}`,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[_primitives.blockStyles.row,styles.reqHead],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.method,children:e.request.method}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitives.blockStyles.rowTitle,numberOfLines:2,children:pathOf(e.request.url)}),e.request.mocked?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.mockedChip,children:"MOCKED"}):null,(0,_jsxRuntime.jsx)(StatusPill,{status:e.request.status})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.tabs,children:(0,_jsxRuntime.jsx)(_sharedUi.NightSegmented,{tabs:REQUEST_TABS,activeKey:t,onChange:e=>i(e),size:"sm"})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitives.blockStyles.mono,styles.body],numberOfLines:14,selectable:!0,children:r.length>1600?`${r.slice(0,1600)}\n…`:r}),(0,_jsxRuntime.jsx)(_primitives.ActionRow,{blockId:e.id,actions:[{label:"Open in Network",openTool:{toolId:"network",select:e.request.id}}]}),(o.supports,null)]})}function RuleCard({block:e}){const t=e.rule,i="fail"===t.kind?"fails (no network)":"delay"===t.kind?`delayed ${t.delayMs??0} ms`:`returns ${t.status??200}`;return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:t.name??"Network override",source:e.source,testID:`buoy-block-rule-${e.id}`,tone:t.enabled?"warning":void 0,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.ruleBody,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.ruleLine,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.ruleKey,children:[t.methods?.length?t.methods.join("/"):"ANY"," "]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitives.blockStyles.mono,children:t.urlPattern})]}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.ruleLine,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.ruleKey,children:"→ "}),i,t.times?" · "+(1===t.times?"once":`${t.times} times`):" · every time",void 0!==t.hits?` · ${t.hits} hit${1===t.hits?"":"s"}`:""]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[_primitives.blockStyles.pill,t.enabled?styles.on:styles.off],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitives.blockStyles.pillText,{color:t.enabled?_sharedUi.night.color.onAccent:_sharedUi.night.color.textSecondary}],children:t.enabled?"ON":"OFF"})})]}),(0,_jsxRuntime.jsx)(_primitives.ActionRow,{blockId:e.id,actions:[t.enabled?{label:"Turn off",dispatch:{toolId:"network",action:"setOverrideRuleEnabled",params:{id:t.id,enabled:!1}}}:{label:"Turn on",primary:!0,dispatch:{toolId:"network",action:"setOverrideRuleEnabled",params:{id:t.id,enabled:!0}}},{label:"Delete",dispatch:{toolId:"network",action:"deleteOverrideRule",params:{id:t.id}}}]})]})}function ScreenElements({block:e}){const t=(0,_context.useBlockHandlers)(),i=(0,_primitives.usePaged)(e.elements,_agentCore.CAPS.chips),{visible:s}=i;return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:e.title??"On screen right now",source:e.source,testID:`buoy-block-screen-${e.id}`,children:[s.map((i,s)=>(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>{t.runAction({label:"Highlight",dispatch:{toolId:"highlight-updates",action:"setSpotlight",params:{nativeTag:i.nativeTag}}},e.id)},disabled:!1===t.supports?.dispatch,style:[_primitives.blockStyles.row,s>0&&_primitives.blockStyles.rowDivider],accessibilityRole:"button",children:[(0,_jsxRuntime.jsx)(_sharedUi.Eye,{size:12,color:_sharedUi.night.color.textTertiary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitives.blockStyles.rowTitle,numberOfLines:1,children:i.label??i.testID??i.name}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitives.blockStyles.rowTrailing,numberOfLines:1,children:i.name})]},`${i.nativeTag}-${s}`)),(0,_jsxRuntime.jsx)(_primitives.More,{paged:i})]})}function RouteChips({block:e}){const t=(0,_context.useBlockHandlers)(),i=(0,_primitives.usePaged)(e.routes,_agentCore.CAPS.chips),s=i.visible;return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:e.current?`Routes · you're on ${e.current}`:"Routes",source:e.source,testID:`buoy-block-routes-${e.id}`,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.chips,children:s.map((i,s)=>(0,_jsxRuntime.jsx)(_reactNative.Pressable,{disabled:!1===t.supports?.dispatch,onPress:()=>i.dynamic?t.answer({blockId:e.id,kind:"input",value:`Open ${i.path} — which id?`}):void t.runAction({label:`Open ${i.path}`,dispatch:{toolId:"route-events",action:"navigate",params:{path:i.path}}},e.id),style:[styles.chip,i.path===e.current&&styles.chipCurrent],accessibilityRole:"button",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.chipText,i.dynamic&&styles.chipDynamic],children:i.path})},`${i.path}-${s}`))}),(0,_jsxRuntime.jsx)(_primitives.More,{paged:i})]})}const LEVEL_COLOR={error:_sharedUi.night.color.danger,warn:_sharedUi.night.color.warning,warning:_sharedUi.night.color.warning,info:_sharedUi.night.color.info};function LogList({block:e}){const t=(0,_primitives.usePaged)(e.entries,_agentCore.CAPS.listItems),{visible:i}=t;return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:"Console",source:e.source,testID:`buoy-block-logs-${e.id}`,children:[i.map((e,t)=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[_primitives.blockStyles.row,t>0&&_primitives.blockStyles.rowDivider,styles.logRow],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[_primitives.blockStyles.pill,{backgroundColor:`${LEVEL_COLOR[e.level]??_sharedUi.night.color.textTertiary}22`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitives.blockStyles.pillText,{color:LEVEL_COLOR[e.level]??_sharedUi.night.color.textSecondary}],children:e.level.toUpperCase()})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitives.blockStyles.rowTitle,_primitives.blockStyles.mono],numberOfLines:3,children:e.message}),e.count>1?(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:_primitives.blockStyles.rowTrailing,children:["×",e.count]}):null]},`${e.level}-${e.message}-${t}`)),(0,_jsxRuntime.jsx)(_primitives.More,{paged:t})]})}function Crash({block:e}){return(0,_jsxRuntime.jsxs)(_primitives.Card,{tone:"danger",testID:`buoy-block-crash-${e.id}`,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.crashHead,children:[(0,_jsxRuntime.jsx)(_sharedUi.AlertTriangle,{size:14,color:_sharedUi.night.color.danger}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.crashTitle,children:["The app crashed",e.route?` on ${e.route}`:""]})]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitives.blockStyles.mono,styles.crashMsg],numberOfLines:4,selectable:!0,children:e.message}),e.suspect?(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.suspect,children:["Most likely cause: ",e.suspect.label]}):null,(0,_jsxRuntime.jsx)(_primitives.ActionRow,{blockId:e.id,actions:[...e.suspect?.action?[{...e.suspect.action,primary:!0}]:[],...e.actions??[]].slice(0,2)})]})}function Peek({block:e}){const t=(0,_context.useBlockHandlers)(),i=!1!==t.supports?.minimize;return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{testID:`buoy-block-peek-${e.id}`,disabled:!i,onPress:()=>{t.runAction({label:"Look",minimize:!0},e.id)},style:({pressed:e})=>[styles.peek,e&&{opacity:.7}],accessibilityRole:"button",accessibilityLabel:`${e.label}. Look at the app`,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.peekText,children:e.label}),i?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.peekLook,children:[(0,_jsxRuntime.jsx)(_sharedUi.Eye,{size:12,color:_sharedUi.night.color.accent}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.peekLookText,children:"Look"})]}):null]})}const styles=_reactNative.StyleSheet.create({method:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.micro,fontWeight:"700",letterSpacing:.4,width:44},mockedChip:{color:_sharedUi.night.color.warning,backgroundColor:_sharedUi.night.color.warningSoft,fontSize:9,fontWeight:"700",letterSpacing:.6,paddingHorizontal:5,paddingVertical:1,borderRadius:_sharedUi.night.radius.badge,overflow:"hidden"},reqHead:{paddingTop:12},tabs:{paddingHorizontal:12,paddingTop:4,paddingBottom:8},tab:{paddingHorizontal:10,paddingVertical:5,borderRadius:_sharedUi.night.radius.badge,backgroundColor:_sharedUi.night.color.fill},tabOn:{backgroundColor:_sharedUi.night.color.accentSoft},tabText:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.micro,fontWeight:"600"},tabTextOn:{color:_sharedUi.night.color.accent},body:{paddingHorizontal:12,paddingBottom:4,lineHeight:16,color:_sharedUi.night.color.textSecondary},ruleBody:{paddingHorizontal:12,paddingTop:4,paddingBottom:4,gap:4},ruleLine:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,lineHeight:18},ruleKey:{color:_sharedUi.night.color.textSecondary,fontWeight:"700"},on:{alignSelf:"flex-start",backgroundColor:_sharedUi.night.color.accent,marginTop:4},off:{alignSelf:"flex-start",backgroundColor:_sharedUi.night.color.fillTertiary,marginTop:4},chips:{flexDirection:"row",flexWrap:"wrap",gap:6,padding:12},chip:{paddingHorizontal:10,paddingVertical:6,borderRadius:_sharedUi.night.radius.chip,backgroundColor:_sharedUi.night.color.fill,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border},chipCurrent:{backgroundColor:_sharedUi.night.color.accentSoft,borderColor:_sharedUi.night.color.accentBorderStrong},chipText:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,fontFamily:"Menlo"},chipDynamic:{color:_sharedUi.night.color.textSecondary},logRow:{alignItems:"flex-start"},crashHead:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:12,paddingTop:12},crashTitle:{color:_sharedUi.night.color.danger,fontSize:_sharedUi.night.font.row,fontWeight:"600"},crashMsg:{paddingHorizontal:12,paddingTop:6,color:_sharedUi.night.color.text},suspect:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,paddingHorizontal:12,paddingTop:6},peek:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",gap:10,paddingLeft:12,paddingRight:10,paddingVertical:7,borderRadius:_sharedUi.night.radius.chip,backgroundColor:_sharedUi.night.color.fill},peekText:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption},peekLook:{flexDirection:"row",alignItems:"center",gap:4},peekLookText:{color:_sharedUi.night.color.accent,fontSize:_sharedUi.night.font.caption,fontWeight:"600"}});
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.blockToText=blockToText,exports.blocksToText=blocksToText;const cellText=e=>"string"==typeof e?e:e.text;function blockToText(e){switch(e.kind){case"finding":return[e.title,...e.evidence.map(e=>`${e.label}: ${e.value}`)].join("\n");case"keyValue":return[e.title,...e.pairs.map(e=>`${e.key}: ${"string"==typeof e.value?e.value:JSON.stringify(e.value)}`)].filter(Boolean).join("\n");case"table":{const t=e.columns.join(" | "),l=e.rows.map(e=>e.map(cellText).join(" | ")),o=e.total&&e.total>e.rows.length?`… ${e.total-e.rows.length} more rows`:null;return[e.title,t,...l,o].filter(Boolean).join("\n")}case"list":{const t=e.items.map(e=>`- ${e.title}${e.subtitle?` — ${e.subtitle}`:""}${e.trailing?` (${e.trailing})`:""}`),l=e.total&&e.total>e.items.length?`… ${e.total-e.items.length} more`:null;return[e.title,...t,l].filter(Boolean).join("\n")}case"notice":case"claim":return e.text;case"diff":case"chart":case"imageGrid":case"requestList":case"requestCard":case"logList":case"crash":case"screenElements":return`[${e.kind} card${"title"in e&&"string"==typeof e.title?`: ${e.title}`:""}]`;default:return null}}function blocksToText(e){return e.map(blockToText).filter(e=>!!e)}
@@ -0,0 +1 @@
1
+ "use strict";var _vitest=require("vitest"),_blockText=require("./blockText");(0,_vitest.describe)("blockToText",()=>{(0,_vitest.it)("writes a finding as title and evidence rows",()=>{(0,_vitest.expect)((0,_blockText.blockToText)({id:"f1",kind:"finding",title:"Bag screen empty after /api/bag 500",evidence:[{label:"Steps",value:"Open Bag as user 4412"},{label:"Observed",value:"empty state, no error shown",tone:"danger"}]})).toBe("Bag screen empty after /api/bag 500\nSteps: Open Bag as user 4412\nObserved: empty state, no error shown")}),(0,_vitest.it)("writes a table with its cut noted",()=>{(0,_vitest.expect)((0,_blockText.blockToText)({id:"t1",kind:"table",columns:["Item","Qty"],rows:[["Charizard",{text:"14"}]],total:30})).toBe("Item | Qty\nCharizard | 14\n… 29 more rows")}),(0,_vitest.it)("names a card it cannot flatten instead of skipping it",()=>{(0,_vitest.expect)((0,_blockText.blockToText)({id:"d1",kind:"diff",title:"Bag store",before:{},after:{}})).toBe("[diff card: Bag store]")}),(0,_vitest.it)("drops blocks with nothing to say",()=>{(0,_vitest.expect)((0,_blockText.blocksToText)([{id:"p",kind:"peek"},{id:"n",kind:"notice",tone:"info",text:"hi"}])).toEqual(["hi"])})});
@@ -1,42 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.BlockHandlersProvider = BlockHandlersProvider;
7
- exports.actionKey = actionKey;
8
- exports.useBlockHandlers = useBlockHandlers;
9
- var _react = require("react");
10
- var _jsxRuntime = require("react/jsx-runtime");
11
- /**
12
- * How a block talks back to the sheet.
13
- *
14
- * Blocks are pure data; everything that happens when one is tapped goes
15
- * through this context so the same renderers work inside the real transcript,
16
- * on the example app's review page, and (later) on the desktop with a
17
- * different set of handlers behind them.
18
- */
19
-
20
- const noop = {
21
- answer: () => {},
22
- runAction: () => {},
23
- answered: {},
24
- supports: {}
25
- };
26
- const Ctx = /*#__PURE__*/(0, _react.createContext)(noop);
27
- function BlockHandlersProvider({
28
- value,
29
- children
30
- }) {
31
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(Ctx.Provider, {
32
- value: value,
33
- children: children
34
- });
35
- }
36
- function useBlockHandlers() {
37
- return (0, _react.useContext)(Ctx);
38
- }
39
- function actionKey(blockId, action) {
40
- return `${blockId}:${action.label}`;
41
- }
42
- //# sourceMappingURL=context.js.map
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BlockHandlersProvider=BlockHandlersProvider,exports.actionKey=actionKey,exports.useBlockHandlers=useBlockHandlers;var _react=require("react"),_jsxRuntime=require("react/jsx-runtime");const noop={answer:()=>{},runAction:()=>{},answered:{},supports:{}},Ctx=(0,_react.createContext)(noop);function BlockHandlersProvider({value:e,children:r}){return(0,_jsxRuntime.jsx)(Ctx.Provider,{value:e,children:r})}function useBlockHandlers(){return(0,_react.useContext)(Ctx)}function actionKey(e,r){return`${e}:${r.label}`}