@buoy-gg/ask-buoy 7.0.40 → 7.0.42

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 (314) hide show
  1. package/README.md +13 -94
  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 +2 -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/blocks/ruleStates.js +1 -0
  20. package/lib/commonjs/components/ApprovalCard.js +1 -297
  21. package/lib/commonjs/components/AskBuoyHeader.js +1 -196
  22. package/lib/commonjs/components/AskBuoyIcon.js +1 -19
  23. package/lib/commonjs/components/AskBuoyModal.js +2 -478
  24. package/lib/commonjs/components/AskBuoySettings.js +1 -181
  25. package/lib/commonjs/components/ChangesBar.js +1 -211
  26. package/lib/commonjs/components/Composer.js +1 -255
  27. package/lib/commonjs/components/EmptyState.js +1 -161
  28. package/lib/commonjs/components/KeyboardPad.js +1 -80
  29. package/lib/commonjs/components/Markdown.js +1 -310
  30. package/lib/commonjs/components/MessageList.js +1 -970
  31. package/lib/commonjs/components/QueuedMessages.js +1 -145
  32. package/lib/commonjs/components/ThinkingStrip.js +1 -223
  33. package/lib/commonjs/components/TypingDots.js +1 -63
  34. package/lib/commonjs/components/markdownParse.js +1 -131
  35. package/lib/commonjs/components/markdownParse.test.js +1 -99
  36. package/lib/commonjs/components/useCopyAction.js +1 -50
  37. package/lib/commonjs/index.js +1 -252
  38. package/lib/commonjs/preset.js +1 -91
  39. package/lib/commonjs/store/activityGroups.js +1 -110
  40. package/lib/commonjs/store/activityGroups.test.js +1 -78
  41. package/lib/commonjs/store/askBuoySettings.js +1 -72
  42. package/lib/commonjs/store/askBuoyStore.js +2 -588
  43. package/lib/commonjs/store/blockPlacement.js +1 -64
  44. package/lib/commonjs/store/blockPlacement.test.js +1 -123
  45. package/lib/commonjs/store/queue.test.js +1 -150
  46. package/lib/commonjs/store/resetConversation.js +1 -77
  47. package/lib/commonjs/store/restorePending.test.js +1 -63
  48. package/lib/commonjs/store/restoredIds.test.js +1 -47
  49. package/lib/commonjs/store/suggestions.js +1 -54
  50. package/lib/commonjs/store/suggestions.test.js +1 -58
  51. package/lib/commonjs/store/systemLine.test.js +1 -77
  52. package/lib/commonjs/store/ticketPrompt.js +1 -17
  53. package/lib/commonjs/store/traceText.js +1 -81
  54. package/lib/commonjs/store/traceText.test.js +1 -112
  55. package/lib/commonjs/store/transcriptPersistence.js +1 -297
  56. package/lib/commonjs/store/transcriptPersistence.test.js +1 -333
  57. package/lib/commonjs/store/turnRendering.test.js +1 -151
  58. package/lib/commonjs/store/useAskBuoy.js +1 -651
  59. package/lib/commonjs/store/useAskBuoySettings.js +1 -14
  60. package/lib/commonjs/sync/askBuoySyncAdapter.js +1 -153
  61. package/lib/commonjs/sync/askBuoySyncAdapter.test.js +1 -141
  62. package/lib/commonjs/sync/wire.js +1 -58
  63. package/lib/commonjs/types.js +1 -6
  64. package/lib/module/blocks/AskBlocks.js +1 -331
  65. package/lib/module/blocks/BlockRenderer.js +1 -257
  66. package/lib/module/blocks/ChromePrototypes.js +1 -503
  67. package/lib/module/blocks/DataBlocks.js +1 -767
  68. package/lib/module/blocks/ExtraBlocks.js +1 -1833
  69. package/lib/module/blocks/MediaBlocks.js +1 -151
  70. package/lib/module/blocks/ReceiptBlocks.js +2 -574
  71. package/lib/module/blocks/blockText.js +1 -55
  72. package/lib/module/blocks/blockText.test.js +1 -53
  73. package/lib/module/blocks/context.js +1 -35
  74. package/lib/module/blocks/icons.js +1 -91
  75. package/lib/module/blocks/index.js +1 -8
  76. package/lib/module/blocks/listRow.test.js +1 -56
  77. package/lib/module/blocks/pageState.js +1 -30
  78. package/lib/module/blocks/pageState.test.js +1 -56
  79. package/lib/module/blocks/primitives.js +1 -445
  80. package/lib/module/blocks/primitivesIndex.js +1 -5
  81. package/lib/module/blocks/ruleStates.js +1 -0
  82. package/lib/module/components/ApprovalCard.js +1 -292
  83. package/lib/module/components/AskBuoyHeader.js +1 -193
  84. package/lib/module/components/AskBuoyIcon.js +1 -8
  85. package/lib/module/components/AskBuoyModal.js +2 -473
  86. package/lib/module/components/AskBuoySettings.js +1 -176
  87. package/lib/module/components/ChangesBar.js +1 -206
  88. package/lib/module/components/Composer.js +1 -250
  89. package/lib/module/components/EmptyState.js +1 -156
  90. package/lib/module/components/KeyboardPad.js +1 -75
  91. package/lib/module/components/Markdown.js +1 -305
  92. package/lib/module/components/MessageList.js +1 -964
  93. package/lib/module/components/QueuedMessages.js +1 -140
  94. package/lib/module/components/ThinkingStrip.js +1 -218
  95. package/lib/module/components/TypingDots.js +1 -58
  96. package/lib/module/components/markdownParse.js +1 -125
  97. package/lib/module/components/markdownParse.test.js +1 -98
  98. package/lib/module/components/useCopyAction.js +1 -46
  99. package/lib/module/index.js +1 -34
  100. package/lib/module/preset.js +1 -74
  101. package/lib/module/store/activityGroups.js +1 -103
  102. package/lib/module/store/activityGroups.test.js +1 -77
  103. package/lib/module/store/askBuoySettings.js +1 -67
  104. package/lib/module/store/askBuoyStore.js +2 -582
  105. package/lib/module/store/blockPlacement.js +1 -59
  106. package/lib/module/store/blockPlacement.test.js +1 -122
  107. package/lib/module/store/queue.test.js +1 -149
  108. package/lib/module/store/resetConversation.js +1 -72
  109. package/lib/module/store/restorePending.test.js +1 -62
  110. package/lib/module/store/restoredIds.test.js +1 -46
  111. package/lib/module/store/suggestions.js +1 -49
  112. package/lib/module/store/suggestions.test.js +1 -57
  113. package/lib/module/store/systemLine.test.js +1 -76
  114. package/lib/module/store/ticketPrompt.js +1 -13
  115. package/lib/module/store/traceText.js +1 -75
  116. package/lib/module/store/traceText.test.js +1 -111
  117. package/lib/module/store/transcriptPersistence.js +1 -287
  118. package/lib/module/store/transcriptPersistence.test.js +1 -332
  119. package/lib/module/store/turnRendering.test.js +1 -150
  120. package/lib/module/store/useAskBuoy.js +1 -646
  121. package/lib/module/store/useAskBuoySettings.js +1 -9
  122. package/lib/module/sync/askBuoySyncAdapter.js +1 -148
  123. package/lib/module/sync/askBuoySyncAdapter.test.js +1 -140
  124. package/lib/module/sync/wire.js +1 -47
  125. package/lib/module/types.js +1 -4
  126. package/lib/typescript/blocks/context.d.ts +3 -0
  127. package/lib/typescript/blocks/ruleStates.d.ts +15 -0
  128. package/lib/typescript/components/ChangesBar.d.ts +2 -1
  129. package/lib/typescript/sync/askBuoySyncAdapter.d.ts +2 -2
  130. package/lib/web/index.mjs +15 -0
  131. package/package.json +44 -11
  132. package/lib/commonjs/blocks/AskBlocks.js.map +0 -1
  133. package/lib/commonjs/blocks/BlockRenderer.js.map +0 -1
  134. package/lib/commonjs/blocks/ChromePrototypes.js.map +0 -1
  135. package/lib/commonjs/blocks/DataBlocks.js.map +0 -1
  136. package/lib/commonjs/blocks/ExtraBlocks.js.map +0 -1
  137. package/lib/commonjs/blocks/MediaBlocks.js.map +0 -1
  138. package/lib/commonjs/blocks/ReceiptBlocks.js.map +0 -1
  139. package/lib/commonjs/blocks/blockText.js.map +0 -1
  140. package/lib/commonjs/blocks/blockText.test.js.map +0 -1
  141. package/lib/commonjs/blocks/context.js.map +0 -1
  142. package/lib/commonjs/blocks/icons.js.map +0 -1
  143. package/lib/commonjs/blocks/index.js.map +0 -1
  144. package/lib/commonjs/blocks/listRow.test.js.map +0 -1
  145. package/lib/commonjs/blocks/pageState.js.map +0 -1
  146. package/lib/commonjs/blocks/pageState.test.js.map +0 -1
  147. package/lib/commonjs/blocks/primitives.js.map +0 -1
  148. package/lib/commonjs/blocks/primitivesIndex.js.map +0 -1
  149. package/lib/commonjs/components/ApprovalCard.js.map +0 -1
  150. package/lib/commonjs/components/AskBuoyHeader.js.map +0 -1
  151. package/lib/commonjs/components/AskBuoyIcon.js.map +0 -1
  152. package/lib/commonjs/components/AskBuoyModal.js.map +0 -1
  153. package/lib/commonjs/components/AskBuoySettings.js.map +0 -1
  154. package/lib/commonjs/components/ChangesBar.js.map +0 -1
  155. package/lib/commonjs/components/Composer.js.map +0 -1
  156. package/lib/commonjs/components/EmptyState.js.map +0 -1
  157. package/lib/commonjs/components/KeyboardPad.js.map +0 -1
  158. package/lib/commonjs/components/Markdown.js.map +0 -1
  159. package/lib/commonjs/components/MessageList.js.map +0 -1
  160. package/lib/commonjs/components/QueuedMessages.js.map +0 -1
  161. package/lib/commonjs/components/ThinkingStrip.js.map +0 -1
  162. package/lib/commonjs/components/TypingDots.js.map +0 -1
  163. package/lib/commonjs/components/markdownParse.js.map +0 -1
  164. package/lib/commonjs/components/markdownParse.test.js.map +0 -1
  165. package/lib/commonjs/components/useCopyAction.js.map +0 -1
  166. package/lib/commonjs/index.js.map +0 -1
  167. package/lib/commonjs/preset.js.map +0 -1
  168. package/lib/commonjs/store/activityGroups.js.map +0 -1
  169. package/lib/commonjs/store/activityGroups.test.js.map +0 -1
  170. package/lib/commonjs/store/askBuoySettings.js.map +0 -1
  171. package/lib/commonjs/store/askBuoyStore.js.map +0 -1
  172. package/lib/commonjs/store/blockPlacement.js.map +0 -1
  173. package/lib/commonjs/store/blockPlacement.test.js.map +0 -1
  174. package/lib/commonjs/store/queue.test.js.map +0 -1
  175. package/lib/commonjs/store/resetConversation.js.map +0 -1
  176. package/lib/commonjs/store/restorePending.test.js.map +0 -1
  177. package/lib/commonjs/store/restoredIds.test.js.map +0 -1
  178. package/lib/commonjs/store/suggestions.js.map +0 -1
  179. package/lib/commonjs/store/suggestions.test.js.map +0 -1
  180. package/lib/commonjs/store/systemLine.test.js.map +0 -1
  181. package/lib/commonjs/store/ticketPrompt.js.map +0 -1
  182. package/lib/commonjs/store/traceText.js.map +0 -1
  183. package/lib/commonjs/store/traceText.test.js.map +0 -1
  184. package/lib/commonjs/store/transcriptPersistence.js.map +0 -1
  185. package/lib/commonjs/store/transcriptPersistence.test.js.map +0 -1
  186. package/lib/commonjs/store/turnRendering.test.js.map +0 -1
  187. package/lib/commonjs/store/useAskBuoy.js.map +0 -1
  188. package/lib/commonjs/store/useAskBuoySettings.js.map +0 -1
  189. package/lib/commonjs/sync/askBuoySyncAdapter.js.map +0 -1
  190. package/lib/commonjs/sync/askBuoySyncAdapter.test.js.map +0 -1
  191. package/lib/commonjs/sync/wire.js.map +0 -1
  192. package/lib/commonjs/types.js.map +0 -1
  193. package/lib/module/blocks/AskBlocks.js.map +0 -1
  194. package/lib/module/blocks/BlockRenderer.js.map +0 -1
  195. package/lib/module/blocks/ChromePrototypes.js.map +0 -1
  196. package/lib/module/blocks/DataBlocks.js.map +0 -1
  197. package/lib/module/blocks/ExtraBlocks.js.map +0 -1
  198. package/lib/module/blocks/MediaBlocks.js.map +0 -1
  199. package/lib/module/blocks/ReceiptBlocks.js.map +0 -1
  200. package/lib/module/blocks/blockText.js.map +0 -1
  201. package/lib/module/blocks/blockText.test.js.map +0 -1
  202. package/lib/module/blocks/context.js.map +0 -1
  203. package/lib/module/blocks/icons.js.map +0 -1
  204. package/lib/module/blocks/index.js.map +0 -1
  205. package/lib/module/blocks/listRow.test.js.map +0 -1
  206. package/lib/module/blocks/pageState.js.map +0 -1
  207. package/lib/module/blocks/pageState.test.js.map +0 -1
  208. package/lib/module/blocks/primitives.js.map +0 -1
  209. package/lib/module/blocks/primitivesIndex.js.map +0 -1
  210. package/lib/module/components/ApprovalCard.js.map +0 -1
  211. package/lib/module/components/AskBuoyHeader.js.map +0 -1
  212. package/lib/module/components/AskBuoyIcon.js.map +0 -1
  213. package/lib/module/components/AskBuoyModal.js.map +0 -1
  214. package/lib/module/components/AskBuoySettings.js.map +0 -1
  215. package/lib/module/components/ChangesBar.js.map +0 -1
  216. package/lib/module/components/Composer.js.map +0 -1
  217. package/lib/module/components/EmptyState.js.map +0 -1
  218. package/lib/module/components/KeyboardPad.js.map +0 -1
  219. package/lib/module/components/Markdown.js.map +0 -1
  220. package/lib/module/components/MessageList.js.map +0 -1
  221. package/lib/module/components/QueuedMessages.js.map +0 -1
  222. package/lib/module/components/ThinkingStrip.js.map +0 -1
  223. package/lib/module/components/TypingDots.js.map +0 -1
  224. package/lib/module/components/markdownParse.js.map +0 -1
  225. package/lib/module/components/markdownParse.test.js.map +0 -1
  226. package/lib/module/components/useCopyAction.js.map +0 -1
  227. package/lib/module/index.js.map +0 -1
  228. package/lib/module/preset.js.map +0 -1
  229. package/lib/module/store/activityGroups.js.map +0 -1
  230. package/lib/module/store/activityGroups.test.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/blockPlacement.js.map +0 -1
  234. package/lib/module/store/blockPlacement.test.js.map +0 -1
  235. package/lib/module/store/queue.test.js.map +0 -1
  236. package/lib/module/store/resetConversation.js.map +0 -1
  237. package/lib/module/store/restorePending.test.js.map +0 -1
  238. package/lib/module/store/restoredIds.test.js.map +0 -1
  239. package/lib/module/store/suggestions.js.map +0 -1
  240. package/lib/module/store/suggestions.test.js.map +0 -1
  241. package/lib/module/store/systemLine.test.js.map +0 -1
  242. package/lib/module/store/ticketPrompt.js.map +0 -1
  243. package/lib/module/store/traceText.js.map +0 -1
  244. package/lib/module/store/traceText.test.js.map +0 -1
  245. package/lib/module/store/transcriptPersistence.js.map +0 -1
  246. package/lib/module/store/transcriptPersistence.test.js.map +0 -1
  247. package/lib/module/store/turnRendering.test.js.map +0 -1
  248. package/lib/module/store/useAskBuoy.js.map +0 -1
  249. package/lib/module/store/useAskBuoySettings.js.map +0 -1
  250. package/lib/module/sync/askBuoySyncAdapter.js.map +0 -1
  251. package/lib/module/sync/askBuoySyncAdapter.test.js.map +0 -1
  252. package/lib/module/sync/wire.js.map +0 -1
  253. package/lib/module/types.js.map +0 -1
  254. package/lib/typescript/blocks/AskBlocks.d.ts.map +0 -1
  255. package/lib/typescript/blocks/BlockRenderer.d.ts.map +0 -1
  256. package/lib/typescript/blocks/ChromePrototypes.d.ts.map +0 -1
  257. package/lib/typescript/blocks/DataBlocks.d.ts.map +0 -1
  258. package/lib/typescript/blocks/ExtraBlocks.d.ts.map +0 -1
  259. package/lib/typescript/blocks/MediaBlocks.d.ts.map +0 -1
  260. package/lib/typescript/blocks/ReceiptBlocks.d.ts.map +0 -1
  261. package/lib/typescript/blocks/blockText.d.ts.map +0 -1
  262. package/lib/typescript/blocks/blockText.test.d.ts.map +0 -1
  263. package/lib/typescript/blocks/context.d.ts.map +0 -1
  264. package/lib/typescript/blocks/icons.d.ts.map +0 -1
  265. package/lib/typescript/blocks/index.d.ts.map +0 -1
  266. package/lib/typescript/blocks/listRow.test.d.ts.map +0 -1
  267. package/lib/typescript/blocks/pageState.d.ts.map +0 -1
  268. package/lib/typescript/blocks/pageState.test.d.ts.map +0 -1
  269. package/lib/typescript/blocks/primitives.d.ts.map +0 -1
  270. package/lib/typescript/blocks/primitivesIndex.d.ts.map +0 -1
  271. package/lib/typescript/components/ApprovalCard.d.ts.map +0 -1
  272. package/lib/typescript/components/AskBuoyHeader.d.ts.map +0 -1
  273. package/lib/typescript/components/AskBuoyIcon.d.ts.map +0 -1
  274. package/lib/typescript/components/AskBuoyModal.d.ts.map +0 -1
  275. package/lib/typescript/components/AskBuoySettings.d.ts.map +0 -1
  276. package/lib/typescript/components/ChangesBar.d.ts.map +0 -1
  277. package/lib/typescript/components/Composer.d.ts.map +0 -1
  278. package/lib/typescript/components/EmptyState.d.ts.map +0 -1
  279. package/lib/typescript/components/KeyboardPad.d.ts.map +0 -1
  280. package/lib/typescript/components/Markdown.d.ts.map +0 -1
  281. package/lib/typescript/components/MessageList.d.ts.map +0 -1
  282. package/lib/typescript/components/QueuedMessages.d.ts.map +0 -1
  283. package/lib/typescript/components/ThinkingStrip.d.ts.map +0 -1
  284. package/lib/typescript/components/TypingDots.d.ts.map +0 -1
  285. package/lib/typescript/components/markdownParse.d.ts.map +0 -1
  286. package/lib/typescript/components/markdownParse.test.d.ts.map +0 -1
  287. package/lib/typescript/components/useCopyAction.d.ts.map +0 -1
  288. package/lib/typescript/index.d.ts.map +0 -1
  289. package/lib/typescript/preset.d.ts.map +0 -1
  290. package/lib/typescript/store/activityGroups.d.ts.map +0 -1
  291. package/lib/typescript/store/activityGroups.test.d.ts.map +0 -1
  292. package/lib/typescript/store/askBuoySettings.d.ts.map +0 -1
  293. package/lib/typescript/store/askBuoyStore.d.ts.map +0 -1
  294. package/lib/typescript/store/blockPlacement.d.ts.map +0 -1
  295. package/lib/typescript/store/blockPlacement.test.d.ts.map +0 -1
  296. package/lib/typescript/store/queue.test.d.ts.map +0 -1
  297. package/lib/typescript/store/resetConversation.d.ts.map +0 -1
  298. package/lib/typescript/store/restorePending.test.d.ts.map +0 -1
  299. package/lib/typescript/store/restoredIds.test.d.ts.map +0 -1
  300. package/lib/typescript/store/suggestions.d.ts.map +0 -1
  301. package/lib/typescript/store/suggestions.test.d.ts.map +0 -1
  302. package/lib/typescript/store/systemLine.test.d.ts.map +0 -1
  303. package/lib/typescript/store/ticketPrompt.d.ts.map +0 -1
  304. package/lib/typescript/store/traceText.d.ts.map +0 -1
  305. package/lib/typescript/store/traceText.test.d.ts.map +0 -1
  306. package/lib/typescript/store/transcriptPersistence.d.ts.map +0 -1
  307. package/lib/typescript/store/transcriptPersistence.test.d.ts.map +0 -1
  308. package/lib/typescript/store/turnRendering.test.d.ts.map +0 -1
  309. package/lib/typescript/store/useAskBuoy.d.ts.map +0 -1
  310. package/lib/typescript/store/useAskBuoySettings.d.ts.map +0 -1
  311. package/lib/typescript/sync/askBuoySyncAdapter.d.ts.map +0 -1
  312. package/lib/typescript/sync/askBuoySyncAdapter.test.d.ts.map +0 -1
  313. package/lib/typescript/sync/wire.d.ts.map +0 -1
  314. package/lib/typescript/types.d.ts.map +0 -1
@@ -1,13 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * The "Summarize for a ticket" request, sent as an ordinary user message.
5
- *
6
- * One button, one canned sentence, because the machinery already exists: the
7
- * prompt teaches the `finding` block and the renderer draws it. What was
8
- * missing was a way to ASK for one without knowing the word, and a Copy that
9
- * includes it (see blockText.ts). Facts and inference are separated in the
10
- * ask, nothing is re-run to produce it, and nothing is submitted anywhere.
11
- */
12
- export const TICKET_PROMPT = "Summarize this conversation as a bug ticket, using one buoy_ui finding block and nothing else. " + "Title it with the problem in one line. Evidence rows, in this order: Steps (what we did), Expected, Observed, " + "Build (dev or release, platform), Evidence (the exact requests, statuses, logs or values you actually saw this conversation), " + "Still applied (overrides or changes from your changes list that are still live, or 'none'). " + "Only facts you observed in this conversation; write 'unknown' where you don't know rather than guessing, and put anything " + "you inferred rather than saw in a final row labelled Inference. Do not run any tool or change anything to produce this.";
13
- //# sourceMappingURL=ticketPrompt.js.map
1
+ "use strict";export const TICKET_PROMPT="Summarize this conversation as a bug ticket, using one buoy_ui finding block and nothing else. Title it with the problem in one line. Evidence rows, in this order: Steps (what we did), Expected, Observed, Build (dev or release, platform), Evidence (the exact requests, statuses, logs or values you actually saw this conversation), Still applied (overrides or changes from your changes list that are still live, or 'none'). Only facts you observed in this conversation; write 'unknown' where you don't know rather than guessing, and put anything you inferred rather than saw in a final row labelled Inference. Do not run any tool or change anything to produce this.";
@@ -1,75 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * The agent's work for one answer, laid out in the order it happened.
5
- *
6
- * `traceEntries` is the ordering, shared by the collapsible strip in the chat
7
- * and by the JSON export — the two must agree, because the point of the export
8
- * is reading elsewhere the run you were just looking at. `traceToText` is the
9
- * plain-text rendering, kept for a quick paste into Slack; the debugging
10
- * artefact is `sessionExport.ts`.
11
- *
12
- * Reasoning and steps INTERLEAVE. One assistant bubble spans every turn of a
13
- * multi-step run, so the real shape is "think, act, think, act"; lumping the
14
- * thoughts at the top would misreport when the model knew what.
15
- */
16
-
17
- export function traceEntries(message) {
18
- const thoughts = [...(message.reasoning ?? [])].sort((a, b) => a.afterCalls - b.afterCalls);
19
- const out = [];
20
- let t = 0;
21
- const drainTo = calls => {
22
- while (t < thoughts.length && thoughts[t].afterCalls <= calls) {
23
- out.push({
24
- kind: "thought",
25
- text: thoughts[t].text
26
- });
27
- t += 1;
28
- }
29
- };
30
- message.toolCalls.forEach((call, i) => {
31
- drainTo(i);
32
- out.push({
33
- kind: "step",
34
- n: i + 1,
35
- call
36
- });
37
- });
38
- // Anything the model thought after its last tool call — usually the reasoning
39
- // behind the answer itself, which is the most useful line in the trace.
40
- drainTo(message.toolCalls.length);
41
- return out;
42
- }
43
-
44
- /** Has this message anything to show? Drives whether the strip renders at all. */
45
- export function hasTrace(message) {
46
- return (message.reasoning?.length ?? 0) > 0 || message.toolCalls.length > 0;
47
- }
48
- const statusWord = call => call.status === "ok" ? call.summary || "done" : call.status === "running" ? "running" : `${call.status}${call.summary ? ` — ${call.summary}` : ""}`;
49
-
50
- /**
51
- * The trace as plain text, for the clipboard.
52
- *
53
- * Indented under the answer it belongs to so a pasted session still reads as a
54
- * conversation rather than a log dump.
55
- */
56
- export function traceToText(message, indent = " ") {
57
- const lines = [];
58
- for (const entry of traceEntries(message)) {
59
- if (entry.kind === "thought") {
60
- lines.push(`${indent}[thinking]`);
61
- for (const line of entry.text.trim().split("\n")) {
62
- lines.push(`${indent} ${line}`);
63
- }
64
- } else {
65
- const {
66
- n,
67
- call
68
- } = entry;
69
- lines.push(`${indent}[${n}] ${call.toolId}.${call.action} — ${statusWord(call)}`);
70
- if (call.params) lines.push(`${indent} ${call.params}`);
71
- }
72
- }
73
- return lines;
74
- }
75
- //# sourceMappingURL=traceText.js.map
1
+ "use strict";export function traceEntries(t){const s=[...t.reasoning??[]].sort((n,e)=>n.afterCalls-e.afterCalls);const o=[];let r=0;const u=n=>{while(r<s.length&&s[r].afterCalls<=n){o.push({kind:"thought",text:s[r].text});r+=1}};t.toolCalls.forEach((n,e)=>{u(e);o.push({kind:"step",n:e+1,call:n})});u(t.toolCalls.length);return o}export function hasTrace(t){return(t.reasoning?.length??0)>0||t.toolCalls.length>0}const a=t=>t.status==="ok"?t.summary||"done":t.status==="running"?"running":`${t.status}${t.summary?` \u2014 ${t.summary}`:""}`;export function traceToText(t,s=" "){const o=[];for(const r of traceEntries(t)){if(r.kind==="thought"){o.push(`${s}[thinking]`);for(const u of r.text.trim().split("\n")){o.push(`${s} ${u}`)}}else{const{n:u,call:n}=r;o.push(`${s}[${u}] ${n.toolId}.${n.action} \u2014 ${a(n)}`);if(n.params)o.push(`${s} ${n.params}`)}}return o}
@@ -1,111 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * The agent's working, as text.
5
- *
6
- * This exists so a tester can paste a run somewhere and find the step that
7
- * broke, which puts two properties on it: reasoning and steps come out in the
8
- * order they HAPPENED (a multi-step turn is think, act, think, act — not all
9
- * the thoughts and then all the steps), and a failed step says so with its
10
- * parameters attached, since "storage.set failed" without the value it wrote
11
- * is not a bug report.
12
- */
13
- import { describe, expect, it } from "vitest";
14
- import { hasTrace, traceEntries, traceToText } from "./traceText";
15
- const call = (over = {}) => ({
16
- id: "c1",
17
- toolId: "zustand",
18
- action: "getStoreState",
19
- label: "Read the bag",
20
- status: "ok",
21
- summary: "Done",
22
- ...over
23
- });
24
- const msg = (over = {}) => ({
25
- id: "m1",
26
- role: "assistant",
27
- text: "Five items.",
28
- toolCalls: [],
29
- blocks: [],
30
- ...over
31
- });
32
- describe("the order of a trace", () => {
33
- it("interleaves thinking with the steps it led to", () => {
34
- const m = msg({
35
- toolCalls: [call({
36
- id: "c1"
37
- }), call({
38
- id: "c2",
39
- action: "setState"
40
- })],
41
- reasoning: [{
42
- text: "I should read the bag first.",
43
- afterCalls: 0
44
- }, {
45
- text: "Now I can write the new quantity.",
46
- afterCalls: 1
47
- }]
48
- });
49
- expect(traceEntries(m).map(e => e.kind === "thought" ? "T" : `S${e.n}`)).toEqual(["T", "S1", "T", "S2"]);
50
- });
51
- it("keeps a closing thought after the last step", () => {
52
- // Usually the reasoning behind the ANSWER, which is the most useful line
53
- // in the whole trace.
54
- const m = msg({
55
- toolCalls: [call()],
56
- reasoning: [{
57
- text: "That is everything the user asked for.",
58
- afterCalls: 1
59
- }]
60
- });
61
- const entries = traceEntries(m);
62
- expect(entries[entries.length - 1]).toEqual({
63
- kind: "thought",
64
- text: "That is everything the user asked for."
65
- });
66
- });
67
- it("handles a turn with steps and no reasoning at all", () => {
68
- // The common case: gpt-4.1 and friends report none.
69
- const m = msg({
70
- toolCalls: [call()]
71
- });
72
- expect(traceEntries(m)).toHaveLength(1);
73
- expect(hasTrace(m)).toBe(true);
74
- });
75
- it("has nothing to show for a plain answer", () => {
76
- expect(hasTrace(msg())).toBe(false);
77
- });
78
- });
79
- describe("the text it produces", () => {
80
- it("names the tool, the action, the outcome and the parameters", () => {
81
- const m = msg({
82
- toolCalls: [call({
83
- params: '{"storeName":"Poké Mart bag"}'
84
- })]
85
- });
86
- expect(traceToText(m)).toEqual([" [1] zustand.getStoreState — Done", ' {"storeName":"Poké Mart bag"}']);
87
- });
88
- it("makes a failure and its parameters findable", () => {
89
- const m = msg({
90
- toolCalls: [call({
91
- toolId: "storage",
92
- action: "async.setItem",
93
- status: "failed",
94
- summary: "key not found",
95
- params: '{"key":"@pokemart/bag"}'
96
- })]
97
- });
98
- expect(traceToText(m).join("\n")).toContain("failed — key not found");
99
- expect(traceToText(m).join("\n")).toContain("@pokemart/bag");
100
- });
101
- it("indents a multi-line thought so a pasted session still reads as one", () => {
102
- const m = msg({
103
- reasoning: [{
104
- text: "First line.\nSecond line.",
105
- afterCalls: 0
106
- }]
107
- });
108
- expect(traceToText(m)).toEqual([" [thinking]", " First line.", " Second line."]);
109
- });
110
- });
111
- //# sourceMappingURL=traceText.test.js.map
1
+ "use strict";import{describe as r,expect as e,it as a}from"vitest";import{hasTrace as h,traceEntries as l,traceToText as i}from"./traceText";const s=(t={})=>({id:"c1",toolId:"zustand",action:"getStoreState",label:"Read the bag",status:"ok",summary:"Done",...t});const o=(t={})=>({id:"m1",role:"assistant",text:"Five items.",toolCalls:[],blocks:[],...t});r("the order of a trace",()=>{a("interleaves thinking with the steps it led to",()=>{const t=o({toolCalls:[s({id:"c1"}),s({id:"c2",action:"setState"})],reasoning:[{text:"I should read the bag first.",afterCalls:0},{text:"Now I can write the new quantity.",afterCalls:1}]});e(l(t).map(n=>n.kind==="thought"?"T":`S${n.n}`)).toEqual(["T","S1","T","S2"])});a("keeps a closing thought after the last step",()=>{const t=o({toolCalls:[s()],reasoning:[{text:"That is everything the user asked for.",afterCalls:1}]});const n=l(t);e(n[n.length-1]).toEqual({kind:"thought",text:"That is everything the user asked for."})});a("handles a turn with steps and no reasoning at all",()=>{const t=o({toolCalls:[s()]});e(l(t)).toHaveLength(1);e(h(t)).toBe(true)});a("has nothing to show for a plain answer",()=>{e(h(o())).toBe(false)})});r("the text it produces",()=>{a("names the tool, the action, the outcome and the parameters",()=>{const t=o({toolCalls:[s({params:'{"storeName":"Pok\xE9 Mart bag"}'})]});e(i(t)).toEqual([" [1] zustand.getStoreState \u2014 Done",' {"storeName":"Pok\xE9 Mart bag"}'])});a("makes a failure and its parameters findable",()=>{const t=o({toolCalls:[s({toolId:"storage",action:"async.setItem",status:"failed",summary:"key not found",params:'{"key":"@pokemart/bag"}'})]});e(i(t).join("\n")).toContain("failed \u2014 key not found");e(i(t).join("\n")).toContain("@pokemart/bag")});a("indents a multi-line thought so a pasted session still reads as one",()=>{const t=o({reasoning:[{text:"First line.\nSecond line.",afterCalls:0}]});e(i(t)).toEqual([" [thinking]"," First line."," Second line."])})});
@@ -1,287 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * The conversation, across a reload or a crash.
5
- *
6
- * This reverses a deliberate earlier decision, so the reasoning is worth
7
- * stating. The transcript used to live only in memory because it can quote
8
- * anything the agent read — a storage value, a response body, a customer
9
- * record — and a Buoy key on disk is readable by the Storage tool, which the
10
- * unauthenticated broker mirrors to every connected dashboard. That risk did
11
- * not go away; it is now a trade the host app makes knowingly, and can decline
12
- * with `askBuoy={{ persistTranscript: false }}`.
13
- *
14
- * What lowers it:
15
- * - Tool RESULTS are never written. The model's saved history keeps the shape
16
- * of each round (which tool ran, what it was asked) and replaces every result
17
- * payload with a placeholder — so the agent resumes knowing what it did, not
18
- * what it saw. Raw payloads are the sensitive part and they stay in memory.
19
- * - Everything written passes `redactForWire`, the same credential scrubber the
20
- * broker wire uses.
21
- * - It is capped, oldest-first, so a long QA session cannot grow a file without
22
- * bound.
23
- * - "New conversation" deletes it, rather than leaving the last chat on disk.
24
- */
25
- import { persistentStorage, devToolsStorageKeys } from "@buoy-gg/shared-ui";
26
- import { redactForWire } from "../sync/wire";
27
-
28
- /** `@react_buoy` prefix, so the Storage tool treats it as one of its own. */
29
- export const TRANSCRIPT_KEY = `${devToolsStorageKeys.base}_ask_buoy_transcript`;
30
-
31
- /**
32
- * Bumped when the saved shape changes; an older payload is dropped, not parsed.
33
- *
34
- * Purely ADDITIVE optional fields do not bump it — `pending` reads back as
35
- * absent from a v1 file written before it existed, and throwing away someone's
36
- * conversation to add a field they did not have is a worse trade than the one
37
- * this version number exists to make.
38
- */
39
- const VERSION = 1;
40
-
41
- /** Newest N bubbles. Beyond this a reader is scrolling history, not testing. */
42
- const MAX_MESSAGES = 60;
43
-
44
- /**
45
- * Hard ceiling on the file. Blocks carry image URLs and table rows, so a
46
- * message is not a small object; this is checked AFTER the message cap and
47
- * drops from the oldest end until it fits.
48
- */
49
- const MAX_BYTES = 256_000;
50
-
51
- /** What replaces a tool result. Addressed to the model, which will read it. */
52
- const DROPPED_RESULT = "[not kept across a restart — read it again if you need it]";
53
-
54
- /**
55
- * An approval the user never answered.
56
- *
57
- * Saved with the conversation because an unanswered question is exactly the
58
- * state a reload must not quietly resolve for them: nothing was tapped, so the
59
- * change is still pending as far as they know. `params` is the real call —
60
- * after a restart there is no turn left to resume, so Allow re-dispatches it.
61
- */
62
-
63
- function scrub(text) {
64
- return text ? redactForWire(text) : text;
65
- }
66
-
67
- /**
68
- * A bubble as it should look after a restart.
69
- *
70
- * `streaming` is cleared because nothing is streaming into a bubble the app
71
- * has just rebuilt, and a message caught mid-turn is marked as interrupted
72
- * rather than left looking like a silent, empty answer — which is exactly the
73
- * crash case this feature exists for. `actionState` is not saved at all: a
74
- * button stuck on "running" would be a lie about work that died with the
75
- * process.
76
- */
77
- function settle(m) {
78
- const cutOff = m.streaming === true;
79
- return {
80
- ...m,
81
- text: scrub(m.text),
82
- streaming: false,
83
- // The thinking view's payloads go through the same scrubber as the answer:
84
- // step parameters carry whatever the model passed a tool, which is exactly
85
- // where a token ends up when the agent has been asked to set one.
86
- reasoning: m.reasoning?.map(r => ({
87
- ...r,
88
- text: scrub(r.text)
89
- })),
90
- toolCalls: m.toolCalls.map(c => {
91
- const params = c.params ? scrub(c.params) : undefined;
92
- // `result` is dropped, never scrubbed. It is the tool payload itself —
93
- // a store's whole state, a response body — and "tool results are never
94
- // written to disk" is the promise this file is built on. It stays in
95
- // memory for the thinking view and the JSON export.
96
- const {
97
- result: _dropped,
98
- ...rest
99
- } = c;
100
- return c.status === "running" ? {
101
- ...rest,
102
- params,
103
- status: "failed",
104
- summary: "Interrupted"
105
- } : {
106
- ...rest,
107
- params
108
- };
109
- }),
110
- error: m.error ?? (cutOff && !m.text ? "This answer was interrupted — the app restarted mid-turn." : undefined)
111
- };
112
- }
113
-
114
- /** Model history with every tool result replaced by a placeholder. */
115
- function withoutResults(history) {
116
- return history.map(m => {
117
- if (m.role === "tool-results") {
118
- return {
119
- ...m,
120
- results: m.results.map(r => ({
121
- ...r,
122
- content: DROPPED_RESULT
123
- }))
124
- };
125
- }
126
- if (m.role === "assistant") return {
127
- ...m,
128
- text: scrub(m.text)
129
- };
130
- return {
131
- ...m,
132
- text: scrub(m.text)
133
- };
134
- });
135
- }
136
-
137
- /**
138
- * Trim to the caps. Messages and history are trimmed together and from the
139
- * same end, so what the user sees and what the model remembers stay the same
140
- * conversation rather than drifting apart across restarts.
141
- */
142
- export function fitToCaps(payload) {
143
- let out = {
144
- ...payload,
145
- messages: payload.messages.slice(-MAX_MESSAGES),
146
- history: payload.history.slice(-MAX_MESSAGES * 2)
147
- };
148
- let json = JSON.stringify(out);
149
- while (json.length > MAX_BYTES && out.messages.length > 1) {
150
- out = {
151
- ...out,
152
- messages: out.messages.slice(1),
153
- history: out.history.slice(Math.min(2, out.history.length))
154
- };
155
- json = JSON.stringify(out);
156
- }
157
- return out;
158
- }
159
-
160
- /**
161
- * The pending approval, if it is safe to bring back.
162
- *
163
- * Params are NOT scrubbed on the way out, and that is the point of the check:
164
- * a redacted token written back into the call is no longer the change the user
165
- * was asked about, so re-running it would apply something they never saw. A
166
- * call the wire scrubber touches at all is therefore not persisted — an action
167
- * carrying a credential is precisely the one that should not come back after a
168
- * restart and run itself. The card is lost in that case, which is the same
169
- * behaviour as before this existed.
170
- */
171
- function storableApproval(pending) {
172
- // A RESTORED card is saved again too: reloading twice without answering must
173
- // not be the thing that finally loses the question.
174
- if (!pending) return null;
175
- const params = pending.params;
176
- if (!params) return null;
177
- let json;
178
- try {
179
- json = JSON.stringify(params);
180
- } catch {
181
- return null;
182
- }
183
- if (redactForWire(json) !== json) return null;
184
- return {
185
- id: pending.id,
186
- toolId: pending.toolId,
187
- action: pending.action,
188
- label: scrub(pending.label),
189
- description: pending.description ? scrub(pending.description) : undefined,
190
- reason: scrub(pending.reason),
191
- params,
192
- targetDigest: pending.targetDigest
193
- };
194
- }
195
- function isStoredApproval(value) {
196
- if (typeof value !== "object" || value === null) return false;
197
- const v = value;
198
- return typeof v.id === "string" && typeof v.toolId === "string" && typeof v.action === "string" && typeof v.label === "string" && typeof v.reason === "string" && typeof v.params === "object" && v.params !== null;
199
- }
200
-
201
- /**
202
- * Ledger entries safe to write.
203
- *
204
- * Same rule as `storableApproval`: an entry the wire scrubber would touch
205
- * carries a credential in the value it is holding for the undo, and scrubbing
206
- * it would make the undo restore a redacted string over the real one. Such an
207
- * entry is dropped rather than rewritten — losing an undo is recoverable,
208
- * writing "[redacted]" into the user's storage is not.
209
- */
210
- function storableLedger(entries) {
211
- if (!entries?.length) return undefined;
212
- const kept = entries.filter(e => {
213
- try {
214
- const json = JSON.stringify(e);
215
- return redactForWire(json) === json;
216
- } catch {
217
- return false;
218
- }
219
- });
220
- return kept.length ? kept : undefined;
221
- }
222
- export function buildPayload(input) {
223
- return fitToCaps({
224
- v: VERSION,
225
- savedAt: Date.now(),
226
- messages: input.messages.map(settle),
227
- history: withoutResults(input.history),
228
- answers: input.answers,
229
- usage: input.usage,
230
- pending: storableApproval(input.pending),
231
- ledger: storableLedger(input.ledger),
232
- queued: input.queued?.length ? input.queued.map(q => ({
233
- id: q.id,
234
- text: scrub(q.text)
235
- })) : undefined
236
- });
237
- }
238
-
239
- /** Anything unparseable, or from an older shape, is treated as "no transcript". */
240
- export function parsePayload(raw) {
241
- if (!raw) return null;
242
- try {
243
- const parsed = JSON.parse(raw);
244
- if (parsed?.v !== VERSION || !Array.isArray(parsed.messages)) return null;
245
- if (parsed.messages.length === 0) return null;
246
- return {
247
- v: VERSION,
248
- savedAt: typeof parsed.savedAt === "number" ? parsed.savedAt : 0,
249
- messages: parsed.messages,
250
- history: Array.isArray(parsed.history) ? parsed.history : [],
251
- answers: parsed.answers ?? {},
252
- usage: parsed.usage ?? {
253
- input: 0,
254
- output: 0,
255
- requests: 0
256
- },
257
- pending: isStoredApproval(parsed.pending) ? parsed.pending : null,
258
- ledger: Array.isArray(parsed.ledger) ? parsed.ledger.filter(e => typeof e === "object" && e !== null && typeof e.id === "string") : undefined,
259
- queued: Array.isArray(parsed.queued) ? parsed.queued.filter(q => typeof q === "object" && q !== null && typeof q.id === "string" && typeof q.text === "string") : undefined
260
- };
261
- } catch {
262
- return null;
263
- }
264
- }
265
- export async function readTranscript() {
266
- try {
267
- return parsePayload(await persistentStorage.getItem(TRANSCRIPT_KEY));
268
- } catch {
269
- return null;
270
- }
271
- }
272
- export async function writeTranscript(payload) {
273
- try {
274
- await persistentStorage.setItem(TRANSCRIPT_KEY, JSON.stringify(payload));
275
- } catch {
276
- // A transcript that cannot be saved must never break the chat that
277
- // produced it.
278
- }
279
- }
280
- export async function clearTranscript() {
281
- try {
282
- await persistentStorage.removeItem(TRANSCRIPT_KEY);
283
- } catch {
284
- /* nothing to do — see writeTranscript */
285
- }
286
- }
287
- //# sourceMappingURL=transcriptPersistence.js.map
1
+ "use strict";import{persistentStorage as a,devToolsStorageKeys as c}from"@buoy-gg/shared-ui";import{redactForWire as o}from"../sync/wire";export const TRANSCRIPT_KEY=`${c.base}_ask_buoy_transcript`;const i=1;const l=60;const f=256e3;const d="[not kept across a restart \u2014 read it again if you need it]";function s(e){return e?o(e):e}function g(e){const t=e.streaming===true;return{...e,text:s(e.text),streaming:false,reasoning:e.reasoning?.map(r=>({...r,text:s(r.text)})),toolCalls:e.toolCalls.map(r=>{const n=r.params?s(r.params):void 0;const{result:A,...u}=r;return r.status==="running"?{...u,params:n,status:"failed",summary:"Interrupted"}:{...u,params:n}}),error:e.error??(t&&!e.text?"This answer was interrupted \u2014 the app restarted mid-turn.":void 0)}}function y(e){return e.map(t=>{if(t.role==="tool-results"){return{...t,results:t.results.map(r=>({...r,content:d}))}}if(t.role==="assistant")return{...t,text:s(t.text)};return{...t,text:s(t.text)}})}export function fitToCaps(e){let t={...e,messages:e.messages.slice(-l),history:e.history.slice(-l*2)};let r=JSON.stringify(t);while(r.length>f&&t.messages.length>1){t={...t,messages:t.messages.slice(1),history:t.history.slice(Math.min(2,t.history.length))};r=JSON.stringify(t)}return t}function p(e){if(!e)return null;const t=e.params;if(!t)return null;let r;try{r=JSON.stringify(t)}catch{return null}if(o(r)!==r)return null;return{id:e.id,toolId:e.toolId,action:e.action,label:s(e.label),description:e.description?s(e.description):void 0,reason:s(e.reason),params:t,targetDigest:e.targetDigest}}function h(e){if(typeof e!=="object"||e===null)return false;const t=e;return typeof t.id==="string"&&typeof t.toolId==="string"&&typeof t.action==="string"&&typeof t.label==="string"&&typeof t.reason==="string"&&typeof t.params==="object"&&t.params!==null}function m(e){if(!e?.length)return void 0;const t=e.filter(r=>{try{const n=JSON.stringify(r);return o(n)===n}catch{return false}});return t.length?t:void 0}export function buildPayload(e){return fitToCaps({v:i,savedAt:Date.now(),messages:e.messages.map(g),history:y(e.history),answers:e.answers,usage:e.usage,pending:p(e.pending),ledger:m(e.ledger),queued:e.queued?.length?e.queued.map(t=>({id:t.id,text:s(t.text)})):void 0})}export function parsePayload(e){if(!e)return null;try{const t=JSON.parse(e);if(t?.v!==i||!Array.isArray(t.messages))return null;if(t.messages.length===0)return null;return{v:i,savedAt:typeof t.savedAt==="number"?t.savedAt:0,messages:t.messages,history:Array.isArray(t.history)?t.history:[],answers:t.answers??{},usage:t.usage??{input:0,output:0,requests:0},pending:h(t.pending)?t.pending:null,ledger:Array.isArray(t.ledger)?t.ledger.filter(r=>typeof r==="object"&&r!==null&&typeof r.id==="string"):void 0,queued:Array.isArray(t.queued)?t.queued.filter(r=>typeof r==="object"&&r!==null&&typeof r.id==="string"&&typeof r.text==="string"):void 0}}catch{return null}}export async function readTranscript(){try{return parsePayload(await a.getItem(TRANSCRIPT_KEY))}catch{return null}}export async function writeTranscript(e){try{await a.setItem(TRANSCRIPT_KEY,JSON.stringify(e))}catch{}}export async function clearTranscript(){try{await a.removeItem(TRANSCRIPT_KEY)}catch{}}