@buoy-gg/ask-buoy 7.0.38 → 7.0.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (306) hide show
  1. package/lib/commonjs/blocks/AskBlocks.js +338 -1
  2. package/lib/commonjs/blocks/AskBlocks.js.map +1 -0
  3. package/lib/commonjs/blocks/BlockRenderer.js +262 -1
  4. package/lib/commonjs/blocks/BlockRenderer.js.map +1 -0
  5. package/lib/commonjs/blocks/ChromePrototypes.js +514 -1
  6. package/lib/commonjs/blocks/ChromePrototypes.js.map +1 -0
  7. package/lib/commonjs/blocks/DataBlocks.js +781 -1
  8. package/lib/commonjs/blocks/DataBlocks.js.map +1 -0
  9. package/lib/commonjs/blocks/ExtraBlocks.js +1860 -1
  10. package/lib/commonjs/blocks/ExtraBlocks.js.map +1 -0
  11. package/lib/commonjs/blocks/MediaBlocks.js +156 -1
  12. package/lib/commonjs/blocks/MediaBlocks.js.map +1 -0
  13. package/lib/commonjs/blocks/ReceiptBlocks.js +586 -1
  14. package/lib/commonjs/blocks/ReceiptBlocks.js.map +1 -0
  15. package/lib/commonjs/blocks/blockText.js +60 -1
  16. package/lib/commonjs/blocks/blockText.js.map +1 -0
  17. package/lib/commonjs/blocks/blockText.test.js +53 -1
  18. package/lib/commonjs/blocks/blockText.test.js.map +1 -0
  19. package/lib/commonjs/blocks/context.js +42 -1
  20. package/lib/commonjs/blocks/context.js.map +1 -0
  21. package/lib/commonjs/blocks/icons.js +96 -1
  22. package/lib/commonjs/blocks/icons.js.map +1 -0
  23. package/lib/commonjs/blocks/index.js +95 -1
  24. package/lib/commonjs/blocks/index.js.map +1 -0
  25. package/lib/commonjs/blocks/listRow.test.js +55 -1
  26. package/lib/commonjs/blocks/listRow.test.js.map +1 -0
  27. package/lib/commonjs/blocks/pageState.js +34 -1
  28. package/lib/commonjs/blocks/pageState.js.map +1 -0
  29. package/lib/commonjs/blocks/pageState.test.js +57 -1
  30. package/lib/commonjs/blocks/pageState.test.js.map +1 -0
  31. package/lib/commonjs/blocks/primitives.js +457 -1
  32. package/lib/commonjs/blocks/primitives.js.map +1 -0
  33. package/lib/commonjs/blocks/primitivesIndex.js +62 -1
  34. package/lib/commonjs/blocks/primitivesIndex.js.map +1 -0
  35. package/lib/commonjs/components/ApprovalCard.js +297 -1
  36. package/lib/commonjs/components/ApprovalCard.js.map +1 -0
  37. package/lib/commonjs/components/AskBuoyHeader.js +196 -1
  38. package/lib/commonjs/components/AskBuoyHeader.js.map +1 -0
  39. package/lib/commonjs/components/AskBuoyIcon.js +19 -1
  40. package/lib/commonjs/components/AskBuoyIcon.js.map +1 -0
  41. package/lib/commonjs/components/AskBuoyModal.js +479 -1
  42. package/lib/commonjs/components/AskBuoyModal.js.map +1 -0
  43. package/lib/commonjs/components/AskBuoySettings.js +181 -1
  44. package/lib/commonjs/components/AskBuoySettings.js.map +1 -0
  45. package/lib/commonjs/components/ChangesBar.js +211 -1
  46. package/lib/commonjs/components/ChangesBar.js.map +1 -0
  47. package/lib/commonjs/components/Composer.js +255 -1
  48. package/lib/commonjs/components/Composer.js.map +1 -0
  49. package/lib/commonjs/components/EmptyState.js +161 -1
  50. package/lib/commonjs/components/EmptyState.js.map +1 -0
  51. package/lib/commonjs/components/KeyboardPad.js +80 -1
  52. package/lib/commonjs/components/KeyboardPad.js.map +1 -0
  53. package/lib/commonjs/components/Markdown.js +310 -1
  54. package/lib/commonjs/components/Markdown.js.map +1 -0
  55. package/lib/commonjs/components/MessageList.js +970 -1
  56. package/lib/commonjs/components/MessageList.js.map +1 -0
  57. package/lib/commonjs/components/QueuedMessages.js +145 -1
  58. package/lib/commonjs/components/QueuedMessages.js.map +1 -0
  59. package/lib/commonjs/components/ThinkingStrip.js +223 -1
  60. package/lib/commonjs/components/ThinkingStrip.js.map +1 -0
  61. package/lib/commonjs/components/TypingDots.js +63 -1
  62. package/lib/commonjs/components/TypingDots.js.map +1 -0
  63. package/lib/commonjs/components/markdownParse.js +131 -1
  64. package/lib/commonjs/components/markdownParse.js.map +1 -0
  65. package/lib/commonjs/components/markdownParse.test.js +99 -1
  66. package/lib/commonjs/components/markdownParse.test.js.map +1 -0
  67. package/lib/commonjs/components/useCopyAction.js +50 -1
  68. package/lib/commonjs/components/useCopyAction.js.map +1 -0
  69. package/lib/commonjs/index.js +252 -1
  70. package/lib/commonjs/index.js.map +1 -0
  71. package/lib/commonjs/preset.js +91 -1
  72. package/lib/commonjs/preset.js.map +1 -0
  73. package/lib/commonjs/store/activityGroups.js +110 -1
  74. package/lib/commonjs/store/activityGroups.js.map +1 -0
  75. package/lib/commonjs/store/activityGroups.test.js +78 -1
  76. package/lib/commonjs/store/activityGroups.test.js.map +1 -0
  77. package/lib/commonjs/store/askBuoySettings.js +72 -1
  78. package/lib/commonjs/store/askBuoySettings.js.map +1 -0
  79. package/lib/commonjs/store/askBuoyStore.js +589 -1
  80. package/lib/commonjs/store/askBuoyStore.js.map +1 -0
  81. package/lib/commonjs/store/blockPlacement.js +64 -1
  82. package/lib/commonjs/store/blockPlacement.js.map +1 -0
  83. package/lib/commonjs/store/blockPlacement.test.js +123 -1
  84. package/lib/commonjs/store/blockPlacement.test.js.map +1 -0
  85. package/lib/commonjs/store/queue.test.js +150 -1
  86. package/lib/commonjs/store/queue.test.js.map +1 -0
  87. package/lib/commonjs/store/resetConversation.js +77 -1
  88. package/lib/commonjs/store/resetConversation.js.map +1 -0
  89. package/lib/commonjs/store/restorePending.test.js +63 -1
  90. package/lib/commonjs/store/restorePending.test.js.map +1 -0
  91. package/lib/commonjs/store/restoredIds.test.js +47 -1
  92. package/lib/commonjs/store/restoredIds.test.js.map +1 -0
  93. package/lib/commonjs/store/suggestions.js +54 -1
  94. package/lib/commonjs/store/suggestions.js.map +1 -0
  95. package/lib/commonjs/store/suggestions.test.js +58 -1
  96. package/lib/commonjs/store/suggestions.test.js.map +1 -0
  97. package/lib/commonjs/store/systemLine.test.js +77 -1
  98. package/lib/commonjs/store/systemLine.test.js.map +1 -0
  99. package/lib/commonjs/store/ticketPrompt.js +17 -1
  100. package/lib/commonjs/store/ticketPrompt.js.map +1 -0
  101. package/lib/commonjs/store/traceText.js +81 -1
  102. package/lib/commonjs/store/traceText.js.map +1 -0
  103. package/lib/commonjs/store/traceText.test.js +112 -1
  104. package/lib/commonjs/store/traceText.test.js.map +1 -0
  105. package/lib/commonjs/store/transcriptPersistence.js +297 -1
  106. package/lib/commonjs/store/transcriptPersistence.js.map +1 -0
  107. package/lib/commonjs/store/transcriptPersistence.test.js +333 -1
  108. package/lib/commonjs/store/transcriptPersistence.test.js.map +1 -0
  109. package/lib/commonjs/store/turnRendering.test.js +151 -1
  110. package/lib/commonjs/store/turnRendering.test.js.map +1 -0
  111. package/lib/commonjs/store/useAskBuoy.js +651 -1
  112. package/lib/commonjs/store/useAskBuoy.js.map +1 -0
  113. package/lib/commonjs/store/useAskBuoySettings.js +14 -1
  114. package/lib/commonjs/store/useAskBuoySettings.js.map +1 -0
  115. package/lib/commonjs/sync/askBuoySyncAdapter.js +153 -1
  116. package/lib/commonjs/sync/askBuoySyncAdapter.js.map +1 -0
  117. package/lib/commonjs/sync/askBuoySyncAdapter.test.js +141 -1
  118. package/lib/commonjs/sync/askBuoySyncAdapter.test.js.map +1 -0
  119. package/lib/commonjs/sync/wire.js +58 -1
  120. package/lib/commonjs/sync/wire.js.map +1 -0
  121. package/lib/commonjs/types.js +6 -1
  122. package/lib/commonjs/types.js.map +1 -0
  123. package/lib/module/blocks/AskBlocks.js +331 -1
  124. package/lib/module/blocks/AskBlocks.js.map +1 -0
  125. package/lib/module/blocks/BlockRenderer.js +257 -1
  126. package/lib/module/blocks/BlockRenderer.js.map +1 -0
  127. package/lib/module/blocks/ChromePrototypes.js +503 -1
  128. package/lib/module/blocks/ChromePrototypes.js.map +1 -0
  129. package/lib/module/blocks/DataBlocks.js +767 -1
  130. package/lib/module/blocks/DataBlocks.js.map +1 -0
  131. package/lib/module/blocks/ExtraBlocks.js +1833 -1
  132. package/lib/module/blocks/ExtraBlocks.js.map +1 -0
  133. package/lib/module/blocks/MediaBlocks.js +151 -1
  134. package/lib/module/blocks/MediaBlocks.js.map +1 -0
  135. package/lib/module/blocks/ReceiptBlocks.js +574 -1
  136. package/lib/module/blocks/ReceiptBlocks.js.map +1 -0
  137. package/lib/module/blocks/blockText.js +55 -1
  138. package/lib/module/blocks/blockText.js.map +1 -0
  139. package/lib/module/blocks/blockText.test.js +53 -1
  140. package/lib/module/blocks/blockText.test.js.map +1 -0
  141. package/lib/module/blocks/context.js +35 -1
  142. package/lib/module/blocks/context.js.map +1 -0
  143. package/lib/module/blocks/icons.js +91 -1
  144. package/lib/module/blocks/icons.js.map +1 -0
  145. package/lib/module/blocks/index.js +8 -1
  146. package/lib/module/blocks/index.js.map +1 -0
  147. package/lib/module/blocks/listRow.test.js +56 -1
  148. package/lib/module/blocks/listRow.test.js.map +1 -0
  149. package/lib/module/blocks/pageState.js +30 -1
  150. package/lib/module/blocks/pageState.js.map +1 -0
  151. package/lib/module/blocks/pageState.test.js +56 -1
  152. package/lib/module/blocks/pageState.test.js.map +1 -0
  153. package/lib/module/blocks/primitives.js +445 -1
  154. package/lib/module/blocks/primitives.js.map +1 -0
  155. package/lib/module/blocks/primitivesIndex.js +5 -1
  156. package/lib/module/blocks/primitivesIndex.js.map +1 -0
  157. package/lib/module/components/ApprovalCard.js +292 -1
  158. package/lib/module/components/ApprovalCard.js.map +1 -0
  159. package/lib/module/components/AskBuoyHeader.js +193 -1
  160. package/lib/module/components/AskBuoyHeader.js.map +1 -0
  161. package/lib/module/components/AskBuoyIcon.js +8 -1
  162. package/lib/module/components/AskBuoyIcon.js.map +1 -0
  163. package/lib/module/components/AskBuoyModal.js +474 -1
  164. package/lib/module/components/AskBuoyModal.js.map +1 -0
  165. package/lib/module/components/AskBuoySettings.js +176 -1
  166. package/lib/module/components/AskBuoySettings.js.map +1 -0
  167. package/lib/module/components/ChangesBar.js +206 -1
  168. package/lib/module/components/ChangesBar.js.map +1 -0
  169. package/lib/module/components/Composer.js +250 -1
  170. package/lib/module/components/Composer.js.map +1 -0
  171. package/lib/module/components/EmptyState.js +156 -1
  172. package/lib/module/components/EmptyState.js.map +1 -0
  173. package/lib/module/components/KeyboardPad.js +75 -1
  174. package/lib/module/components/KeyboardPad.js.map +1 -0
  175. package/lib/module/components/Markdown.js +305 -1
  176. package/lib/module/components/Markdown.js.map +1 -0
  177. package/lib/module/components/MessageList.js +964 -1
  178. package/lib/module/components/MessageList.js.map +1 -0
  179. package/lib/module/components/QueuedMessages.js +140 -1
  180. package/lib/module/components/QueuedMessages.js.map +1 -0
  181. package/lib/module/components/ThinkingStrip.js +218 -1
  182. package/lib/module/components/ThinkingStrip.js.map +1 -0
  183. package/lib/module/components/TypingDots.js +58 -1
  184. package/lib/module/components/TypingDots.js.map +1 -0
  185. package/lib/module/components/markdownParse.js +125 -1
  186. package/lib/module/components/markdownParse.js.map +1 -0
  187. package/lib/module/components/markdownParse.test.js +98 -1
  188. package/lib/module/components/markdownParse.test.js.map +1 -0
  189. package/lib/module/components/useCopyAction.js +46 -1
  190. package/lib/module/components/useCopyAction.js.map +1 -0
  191. package/lib/module/index.js +34 -1
  192. package/lib/module/index.js.map +1 -0
  193. package/lib/module/preset.js +74 -1
  194. package/lib/module/preset.js.map +1 -0
  195. package/lib/module/store/activityGroups.js +103 -1
  196. package/lib/module/store/activityGroups.js.map +1 -0
  197. package/lib/module/store/activityGroups.test.js +77 -1
  198. package/lib/module/store/activityGroups.test.js.map +1 -0
  199. package/lib/module/store/askBuoySettings.js +67 -1
  200. package/lib/module/store/askBuoySettings.js.map +1 -0
  201. package/lib/module/store/askBuoyStore.js +583 -1
  202. package/lib/module/store/askBuoyStore.js.map +1 -0
  203. package/lib/module/store/blockPlacement.js +59 -1
  204. package/lib/module/store/blockPlacement.js.map +1 -0
  205. package/lib/module/store/blockPlacement.test.js +122 -1
  206. package/lib/module/store/blockPlacement.test.js.map +1 -0
  207. package/lib/module/store/queue.test.js +149 -1
  208. package/lib/module/store/queue.test.js.map +1 -0
  209. package/lib/module/store/resetConversation.js +72 -1
  210. package/lib/module/store/resetConversation.js.map +1 -0
  211. package/lib/module/store/restorePending.test.js +62 -1
  212. package/lib/module/store/restorePending.test.js.map +1 -0
  213. package/lib/module/store/restoredIds.test.js +46 -1
  214. package/lib/module/store/restoredIds.test.js.map +1 -0
  215. package/lib/module/store/suggestions.js +49 -1
  216. package/lib/module/store/suggestions.js.map +1 -0
  217. package/lib/module/store/suggestions.test.js +57 -1
  218. package/lib/module/store/suggestions.test.js.map +1 -0
  219. package/lib/module/store/systemLine.test.js +76 -1
  220. package/lib/module/store/systemLine.test.js.map +1 -0
  221. package/lib/module/store/ticketPrompt.js +13 -1
  222. package/lib/module/store/ticketPrompt.js.map +1 -0
  223. package/lib/module/store/traceText.js +75 -1
  224. package/lib/module/store/traceText.js.map +1 -0
  225. package/lib/module/store/traceText.test.js +111 -1
  226. package/lib/module/store/traceText.test.js.map +1 -0
  227. package/lib/module/store/transcriptPersistence.js +287 -1
  228. package/lib/module/store/transcriptPersistence.js.map +1 -0
  229. package/lib/module/store/transcriptPersistence.test.js +332 -1
  230. package/lib/module/store/transcriptPersistence.test.js.map +1 -0
  231. package/lib/module/store/turnRendering.test.js +150 -1
  232. package/lib/module/store/turnRendering.test.js.map +1 -0
  233. package/lib/module/store/useAskBuoy.js +646 -1
  234. package/lib/module/store/useAskBuoy.js.map +1 -0
  235. package/lib/module/store/useAskBuoySettings.js +9 -1
  236. package/lib/module/store/useAskBuoySettings.js.map +1 -0
  237. package/lib/module/sync/askBuoySyncAdapter.js +148 -1
  238. package/lib/module/sync/askBuoySyncAdapter.js.map +1 -0
  239. package/lib/module/sync/askBuoySyncAdapter.test.js +140 -1
  240. package/lib/module/sync/askBuoySyncAdapter.test.js.map +1 -0
  241. package/lib/module/sync/wire.js +47 -1
  242. package/lib/module/sync/wire.js.map +1 -0
  243. package/lib/module/types.js +4 -1
  244. package/lib/module/types.js.map +1 -0
  245. package/lib/typescript/blocks/AskBlocks.d.ts.map +1 -0
  246. package/lib/typescript/blocks/BlockRenderer.d.ts.map +1 -0
  247. package/lib/typescript/blocks/ChromePrototypes.d.ts.map +1 -0
  248. package/lib/typescript/blocks/DataBlocks.d.ts.map +1 -0
  249. package/lib/typescript/blocks/ExtraBlocks.d.ts.map +1 -0
  250. package/lib/typescript/blocks/MediaBlocks.d.ts.map +1 -0
  251. package/lib/typescript/blocks/ReceiptBlocks.d.ts.map +1 -0
  252. package/lib/typescript/blocks/blockText.d.ts.map +1 -0
  253. package/lib/typescript/blocks/blockText.test.d.ts.map +1 -0
  254. package/lib/typescript/blocks/context.d.ts.map +1 -0
  255. package/lib/typescript/blocks/icons.d.ts.map +1 -0
  256. package/lib/typescript/blocks/index.d.ts.map +1 -0
  257. package/lib/typescript/blocks/listRow.test.d.ts.map +1 -0
  258. package/lib/typescript/blocks/pageState.d.ts.map +1 -0
  259. package/lib/typescript/blocks/pageState.test.d.ts.map +1 -0
  260. package/lib/typescript/blocks/primitives.d.ts.map +1 -0
  261. package/lib/typescript/blocks/primitivesIndex.d.ts.map +1 -0
  262. package/lib/typescript/components/ApprovalCard.d.ts.map +1 -0
  263. package/lib/typescript/components/AskBuoyHeader.d.ts.map +1 -0
  264. package/lib/typescript/components/AskBuoyIcon.d.ts.map +1 -0
  265. package/lib/typescript/components/AskBuoyModal.d.ts.map +1 -0
  266. package/lib/typescript/components/AskBuoySettings.d.ts.map +1 -0
  267. package/lib/typescript/components/ChangesBar.d.ts.map +1 -0
  268. package/lib/typescript/components/Composer.d.ts.map +1 -0
  269. package/lib/typescript/components/EmptyState.d.ts.map +1 -0
  270. package/lib/typescript/components/KeyboardPad.d.ts.map +1 -0
  271. package/lib/typescript/components/Markdown.d.ts.map +1 -0
  272. package/lib/typescript/components/MessageList.d.ts.map +1 -0
  273. package/lib/typescript/components/QueuedMessages.d.ts.map +1 -0
  274. package/lib/typescript/components/ThinkingStrip.d.ts.map +1 -0
  275. package/lib/typescript/components/TypingDots.d.ts.map +1 -0
  276. package/lib/typescript/components/markdownParse.d.ts.map +1 -0
  277. package/lib/typescript/components/markdownParse.test.d.ts.map +1 -0
  278. package/lib/typescript/components/useCopyAction.d.ts.map +1 -0
  279. package/lib/typescript/index.d.ts.map +1 -0
  280. package/lib/typescript/preset.d.ts.map +1 -0
  281. package/lib/typescript/store/activityGroups.d.ts.map +1 -0
  282. package/lib/typescript/store/activityGroups.test.d.ts.map +1 -0
  283. package/lib/typescript/store/askBuoySettings.d.ts.map +1 -0
  284. package/lib/typescript/store/askBuoyStore.d.ts.map +1 -0
  285. package/lib/typescript/store/blockPlacement.d.ts.map +1 -0
  286. package/lib/typescript/store/blockPlacement.test.d.ts.map +1 -0
  287. package/lib/typescript/store/queue.test.d.ts.map +1 -0
  288. package/lib/typescript/store/resetConversation.d.ts.map +1 -0
  289. package/lib/typescript/store/restorePending.test.d.ts.map +1 -0
  290. package/lib/typescript/store/restoredIds.test.d.ts.map +1 -0
  291. package/lib/typescript/store/suggestions.d.ts.map +1 -0
  292. package/lib/typescript/store/suggestions.test.d.ts.map +1 -0
  293. package/lib/typescript/store/systemLine.test.d.ts.map +1 -0
  294. package/lib/typescript/store/ticketPrompt.d.ts.map +1 -0
  295. package/lib/typescript/store/traceText.d.ts.map +1 -0
  296. package/lib/typescript/store/traceText.test.d.ts.map +1 -0
  297. package/lib/typescript/store/transcriptPersistence.d.ts.map +1 -0
  298. package/lib/typescript/store/transcriptPersistence.test.d.ts.map +1 -0
  299. package/lib/typescript/store/turnRendering.test.d.ts.map +1 -0
  300. package/lib/typescript/store/useAskBuoy.d.ts.map +1 -0
  301. package/lib/typescript/store/useAskBuoySettings.d.ts.map +1 -0
  302. package/lib/typescript/sync/askBuoySyncAdapter.d.ts.map +1 -0
  303. package/lib/typescript/sync/askBuoySyncAdapter.test.d.ts.map +1 -0
  304. package/lib/typescript/sync/wire.d.ts.map +1 -0
  305. package/lib/typescript/types.d.ts.map +1 -0
  306. package/package.json +8 -8
@@ -1 +1,49 @@
1
- "use strict";export const SUGGESTIONS=[{text:"Why is this screen empty?"},{text:"What did the last few network calls return?",needs:"network"},{text:"Show me what's saved for this user",needs:"storage"},{text:"Make the next request to this screen fail with a 500",needs:"network",write:!0,devOnly:!0},{text:"Who am I signed in as right now?"},{text:"Did anything crash or log an error recently?",needs:"console"}];export const MAX_SUGGESTIONS=4;export function pickSuggestions(e){const t=e.availableToolIds.length>0;return SUGGESTIONS.filter(s=>(!s.write||!e.readOnly)&&(!s.devOnly||!e.isRelease)&&(!s.needs||t&&e.availableToolIds.includes(s.needs))).slice(0,4).map(e=>e.text)}
1
+ "use strict";
2
+
3
+ /**
4
+ * The empty state's "try asking" chips, filtered to what will actually work.
5
+ *
6
+ * The list was static, so a release build offered "Make the next request fail
7
+ * with a 500" directly above a line saying simulations need a dev build — and
8
+ * the agent then refused the very thing the screen had just suggested. First
9
+ * impression: broken. Each chip now says what it needs; the empty state keeps
10
+ * the ones this device, build and policy can honour.
11
+ *
12
+ * Deterministic on purpose: no model call, no navigation, no guessed route
13
+ * names or account ids. When the tool registry has not reported yet (it fills
14
+ * in a frame or two after open) only the chips that need nothing are shown —
15
+ * a short list that grows beats a long one that shrinks.
16
+ */
17
+
18
+ export const SUGGESTIONS = [{
19
+ text: "Why is this screen empty?"
20
+ }, {
21
+ text: "What did the last few network calls return?",
22
+ needs: "network"
23
+ }, {
24
+ text: "Show me what's saved for this user",
25
+ needs: "storage"
26
+ }, {
27
+ text: "Make the next request to this screen fail with a 500",
28
+ needs: "network",
29
+ write: true,
30
+ devOnly: true
31
+ }, {
32
+ text: "Who am I signed in as right now?"
33
+ }, {
34
+ text: "Did anything crash or log an error recently?",
35
+ needs: "console"
36
+ }];
37
+
38
+ /** At most this many chips — the rest of the screen is the point. */
39
+ export const MAX_SUGGESTIONS = 4;
40
+ export function pickSuggestions(input) {
41
+ const known = input.availableToolIds.length > 0;
42
+ return SUGGESTIONS.filter(s => {
43
+ if (s.write && input.readOnly) return false;
44
+ if (s.devOnly && input.isRelease) return false;
45
+ if (s.needs) return known && input.availableToolIds.includes(s.needs);
46
+ return true;
47
+ }).slice(0, MAX_SUGGESTIONS).map(s => s.text);
48
+ }
49
+ //# sourceMappingURL=suggestions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["SUGGESTIONS","text","needs","write","devOnly","MAX_SUGGESTIONS","pickSuggestions","input","known","availableToolIds","length","filter","s","readOnly","isRelease","includes","slice","map"],"sourceRoot":"../../../src","sources":["store/suggestions.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA,OAAO,MAAMA,WAAyB,GAAG,CACvC;EAAEC,IAAI,EAAE;AAA4B,CAAC,EACrC;EAAEA,IAAI,EAAE,6CAA6C;EAAEC,KAAK,EAAE;AAAU,CAAC,EACzE;EAAED,IAAI,EAAE,oCAAoC;EAAEC,KAAK,EAAE;AAAU,CAAC,EAChE;EAAED,IAAI,EAAE,sDAAsD;EAAEC,KAAK,EAAE,SAAS;EAAEC,KAAK,EAAE,IAAI;EAAEC,OAAO,EAAE;AAAK,CAAC,EAC9G;EAAEH,IAAI,EAAE;AAAmC,CAAC,EAC5C;EAAEA,IAAI,EAAE,8CAA8C;EAAEC,KAAK,EAAE;AAAU,CAAC,CAC3E;;AAED;AACA,OAAO,MAAMG,eAAe,GAAG,CAAC;AAEhC,OAAO,SAASC,eAAeA,CAACC,KAI/B,EAAY;EACX,MAAMC,KAAK,GAAGD,KAAK,CAACE,gBAAgB,CAACC,MAAM,GAAG,CAAC;EAC/C,OAAOV,WAAW,CAACW,MAAM,CAAEC,CAAC,IAAK;IAC/B,IAAIA,CAAC,CAACT,KAAK,IAAII,KAAK,CAACM,QAAQ,EAAE,OAAO,KAAK;IAC3C,IAAID,CAAC,CAACR,OAAO,IAAIG,KAAK,CAACO,SAAS,EAAE,OAAO,KAAK;IAC9C,IAAIF,CAAC,CAACV,KAAK,EAAE,OAAOM,KAAK,IAAID,KAAK,CAACE,gBAAgB,CAACM,QAAQ,CAACH,CAAC,CAACV,KAAK,CAAC;IACrE,OAAO,IAAI;EACb,CAAC,CAAC,CACCc,KAAK,CAAC,CAAC,EAAEX,eAAe,CAAC,CACzBY,GAAG,CAAEL,CAAC,IAAKA,CAAC,CAACX,IAAI,CAAC;AACvB","ignoreList":[]}
@@ -1 +1,57 @@
1
- "use strict";import{describe,expect,it}from"vitest";import{MAX_SUGGESTIONS,pickSuggestions}from"./suggestions";const all=["network","storage","console","query"];describe("pickSuggestions",()=>{it("offers the simulation only on a dev build that may write",()=>{const e=pickSuggestions({availableToolIds:all,readOnly:!1,isRelease:!1});expect(e).toContain("Make the next request to this screen fail with a 500");const t=pickSuggestions({availableToolIds:all,readOnly:!1,isRelease:!0});expect(t).not.toContain("Make the next request to this screen fail with a 500");const s=pickSuggestions({availableToolIds:all,readOnly:!0,isRelease:!1});expect(s).not.toContain("Make the next request to this screen fail with a 500")}),it("drops chips whose tool is not on this device",()=>{const e=pickSuggestions({availableToolIds:["storage"],readOnly:!1,isRelease:!1});expect(e).not.toContain("What did the last few network calls return?"),expect(e).toContain("Show me what's saved for this user")}),it("shows only tool-free chips until the registry has reported",()=>{const e=pickSuggestions({availableToolIds:[],readOnly:!1,isRelease:!1});expect(e).toEqual(["Why is this screen empty?","Who am I signed in as right now?"])}),it("never exceeds the cap and keeps the order",()=>{const e=pickSuggestions({availableToolIds:all,readOnly:!1,isRelease:!1});expect(e.length).toBeLessThanOrEqual(MAX_SUGGESTIONS),expect(e[0]).toBe("Why is this screen empty?")})});
1
+ "use strict";
2
+
3
+ /**
4
+ * Chips promise things; only promise what this device can keep.
5
+ */
6
+ import { describe, expect, it } from "vitest";
7
+ import { MAX_SUGGESTIONS, pickSuggestions } from "./suggestions";
8
+ const all = ["network", "storage", "console", "query"];
9
+ describe("pickSuggestions", () => {
10
+ it("offers the simulation only on a dev build that may write", () => {
11
+ const dev = pickSuggestions({
12
+ availableToolIds: all,
13
+ readOnly: false,
14
+ isRelease: false
15
+ });
16
+ expect(dev).toContain("Make the next request to this screen fail with a 500");
17
+ const release = pickSuggestions({
18
+ availableToolIds: all,
19
+ readOnly: false,
20
+ isRelease: true
21
+ });
22
+ expect(release).not.toContain("Make the next request to this screen fail with a 500");
23
+ const readOnly = pickSuggestions({
24
+ availableToolIds: all,
25
+ readOnly: true,
26
+ isRelease: false
27
+ });
28
+ expect(readOnly).not.toContain("Make the next request to this screen fail with a 500");
29
+ });
30
+ it("drops chips whose tool is not on this device", () => {
31
+ const noNetwork = pickSuggestions({
32
+ availableToolIds: ["storage"],
33
+ readOnly: false,
34
+ isRelease: false
35
+ });
36
+ expect(noNetwork).not.toContain("What did the last few network calls return?");
37
+ expect(noNetwork).toContain("Show me what's saved for this user");
38
+ });
39
+ it("shows only tool-free chips until the registry has reported", () => {
40
+ const early = pickSuggestions({
41
+ availableToolIds: [],
42
+ readOnly: false,
43
+ isRelease: false
44
+ });
45
+ expect(early).toEqual(["Why is this screen empty?", "Who am I signed in as right now?"]);
46
+ });
47
+ it("never exceeds the cap and keeps the order", () => {
48
+ const out = pickSuggestions({
49
+ availableToolIds: all,
50
+ readOnly: false,
51
+ isRelease: false
52
+ });
53
+ expect(out.length).toBeLessThanOrEqual(MAX_SUGGESTIONS);
54
+ expect(out[0]).toBe("Why is this screen empty?");
55
+ });
56
+ });
57
+ //# sourceMappingURL=suggestions.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["describe","expect","it","MAX_SUGGESTIONS","pickSuggestions","all","dev","availableToolIds","readOnly","isRelease","toContain","release","not","noNetwork","early","toEqual","out","length","toBeLessThanOrEqual","toBe"],"sourceRoot":"../../../src","sources":["store/suggestions.test.ts"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAE7C,SAASC,eAAe,EAAEC,eAAe,QAAQ,eAAe;AAEhE,MAAMC,GAAG,GAAG,CAAC,SAAS,EAAE,SAAS,EAA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E;IAAM,CAAC,CAAC;IAC1FR,MAAM,CAACa,KAAK,CAAC,CAACC,OAAO,CAAC,CAAC,2BAA2B,EAAE,kCAAkC,CAAC,CAAC;EAC1F,CAAC,CAAC;EAEFb,EAAE,CAAC,2CAA2C,EAAE,MAAM;IACpD,MAAMc,GAAG,GAAGZ,eAAe,CAAC;MAAEG,gBAAgB,EAAEF,GAAG;MAAEG,QAAQ,EAAE,KAAK;MAAEC,SAAS,EAAE;IAAM,CAAC,CAAC;IACzFR,MAAM,CAACe,GAAG,CAACC,MAAM,CAAC,CAACC,mBAAmB,CAACf,eAAe,CAAC;IACvDF,MAAM,CAACe,GAAG,CAAC,CAAC,CAAC,CAAC,CAACG,IAAI,CAAC,2BAA2B,CAAC;EAClD,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1 +1,76 @@
1
- "use strict";import{beforeEach,describe,expect,it}from"vitest";import{askBuoyStore}from"./askBuoyStore";import{buildPayload,parsePayload}from"./transcriptPersistence";beforeEach(()=>askBuoyStore.reset()),describe("history-trimmed",()=>{it("inserts a system line before the answer it affects",()=>{askBuoyStore.addUser("turn off that override");const t=askBuoyStore.startAssistant();askBuoyStore.applyEvent(t,{type:"history-trimmed",droppedRounds:3}),askBuoyStore.applyEvent(t,{type:"text",delta:"Turning it off."});const e=askBuoyStore.getState().messages.map(t=>t.system?"system":t.role);expect(e).toEqual(["user","system","assistant"]);const s=askBuoyStore.getState().messages[1];expect(s.text).toMatch(/3 exchanges/),expect(s.text).toMatch(/changes bar still lists/)}),it("singular for one round",()=>{const t=askBuoyStore.startAssistant();askBuoyStore.applyEvent(t,{type:"history-trimmed",droppedRounds:1}),expect(askBuoyStore.getState().messages[0].text).toMatch(/1 exchange\)/)})}),describe("restored approval freshness",()=>{it("carries the target digest to disk and back, never the target",()=>{const t=buildPayload({messages:[{id:"m1",role:"user",text:"set it",toolCalls:[],blocks:[]}],history:[],answers:{},usage:{input:0,output:0,requests:0},pending:{id:"c1",toolId:"zustand",action:"setState",label:"Update the bag store",reason:"Replaces part of the store",params:{storeName:"bag",state:{qty:14}},targetDigest:"1a2b3c:512",resolve:()=>{}}}),e=JSON.stringify(t);expect(e).toContain("1a2b3c:512");const s=parsePayload(e);expect(s?.pending?.targetDigest).toBe("1a2b3c:512")})});
1
+ "use strict";
2
+
3
+ /**
4
+ * Buoy's own lines in the transcript — today, the memory-trim notice.
5
+ */
6
+ import { beforeEach, describe, expect, it } from "vitest";
7
+ import { askBuoyStore } from "./askBuoyStore";
8
+ import { buildPayload, parsePayload } from "./transcriptPersistence";
9
+ beforeEach(() => askBuoyStore.reset());
10
+ describe("history-trimmed", () => {
11
+ it("inserts a system line before the answer it affects", () => {
12
+ askBuoyStore.addUser("turn off that override");
13
+ const id = askBuoyStore.startAssistant();
14
+ askBuoyStore.applyEvent(id, {
15
+ type: "history-trimmed",
16
+ droppedRounds: 3
17
+ });
18
+ askBuoyStore.applyEvent(id, {
19
+ type: "text",
20
+ delta: "Turning it off."
21
+ });
22
+ const roles = askBuoyStore.getState().messages.map(m => m.system ? "system" : m.role);
23
+ expect(roles).toEqual(["user", "system", "assistant"]);
24
+ const line = askBuoyStore.getState().messages[1];
25
+ expect(line.text).toMatch(/3 exchanges/);
26
+ expect(line.text).toMatch(/changes bar still lists/);
27
+ });
28
+ it("singular for one round", () => {
29
+ const id = askBuoyStore.startAssistant();
30
+ askBuoyStore.applyEvent(id, {
31
+ type: "history-trimmed",
32
+ droppedRounds: 1
33
+ });
34
+ expect(askBuoyStore.getState().messages[0].text).toMatch(/1 exchange\)/);
35
+ });
36
+ });
37
+ describe("restored approval freshness", () => {
38
+ it("carries the target digest to disk and back, never the target", () => {
39
+ const payload = buildPayload({
40
+ messages: [{
41
+ id: "m1",
42
+ role: "user",
43
+ text: "set it",
44
+ toolCalls: [],
45
+ blocks: []
46
+ }],
47
+ history: [],
48
+ answers: {},
49
+ usage: {
50
+ input: 0,
51
+ output: 0,
52
+ requests: 0
53
+ },
54
+ pending: {
55
+ id: "c1",
56
+ toolId: "zustand",
57
+ action: "setState",
58
+ label: "Update the bag store",
59
+ reason: "Replaces part of the store",
60
+ params: {
61
+ storeName: "bag",
62
+ state: {
63
+ qty: 14
64
+ }
65
+ },
66
+ targetDigest: "1a2b3c:512",
67
+ resolve: () => {}
68
+ }
69
+ });
70
+ const json = JSON.stringify(payload);
71
+ expect(json).toContain("1a2b3c:512");
72
+ const back = parsePayload(json);
73
+ expect(back?.pending?.targetDigest).toBe("1a2b3c:512");
74
+ });
75
+ });
76
+ //# sourceMappingURL=systemLine.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["beforeEach","describe","expect","it","askBuoyStore","buildPayload","parsePayload","reset","addUser","id","startAssistant","applyEvent","type","droppedRounds","delta","roles","getState","messages","map","m","system","role","toEqual","line","text","toMatch","payload","toolCalls","blocks","history","answers","usage","input","output","requests","pending","toolId","action","label","reason","params","storeName","state","qty","targetDigest","resolve","json","JSON","stringify","toContain","back","toBe"],"sourceRoot":"../../../src","sources":["store/systemLine.test.ts"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAEzD,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,YAAY,EAAEC,YAAY,QAAQ,yBAAyB;AAEpEN,UAAU,CAAC,MAAMI,YAAY,CAACG,KAAK,CAAC,CAAC,CAAC;AAEtCN,QAAQ,CAAC,iBAAiB,EAAE,MAAM;EAChCE,EAAE,CAAC,oDAAoD,EAAE,MAAM;IAC7DC,YAAY,CAACI,OAAO,CAAC,wBAAwB,CAAC;IAC9C,MAAMC,EAAE,GAAGL,YAAY,CAACM,cAAc,CAAC,CAAC;IACxCN,YAAY,CAACO,UAAU,CAACF,EAAE,EAAE;MAAEG,IAAI,EAAE,iBAAiB;MAAEC,aAAa,EAAE;IAAE,CAAC,CAAC;IAC1ET,YAAY,CAACO,UAAU,CAACF,EAAE,EAAE;MAAEG,I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AG,CAAC,CAAC;MACjFC,OAAO,EAAE,EAAE;MACXC,OAAO,EAAE,CAAC,CAAC;MACXC,KAAK,EAAE;QAAEC,KAAK,EAAE,CAAC;QAAEC,MAAM,EAAE,CAAC;QAAEC,QAAQ,EAAE;MAAE,CAAC;MAC3CC,OAAO,EAAE;QACP1B,EAAE,EAAE,IAAI;QACR2B,MAAM,EAAE,SAAS;QACjBC,MAAM,EAAE,UAAU;QAClBC,KAAK,EAAE,sBAAsB;QAC7BC,MAAM,EAAE,4BAA4B;QACpCC,MAAM,EAAE;UAAEC,SAAS,EAAE,KAAK;UAAEC,KAAK,EAAE;YAAEC,GAAG,EAAE;UAAG;QAAE,CAAC;QAChDC,YAAY,EAAE,YAAY;QAC1BC,OAAO,EAAEA,CAAA,KAAM,CAAC;MAClB;IACF,CAAC,CAAC;IACF,MAAMC,IAAI,GAAGC,IAAI,CAACC,SAAS,CAACtB,OAAO,CAAC;IACpCxB,MAAM,CAAC4C,IAAI,CAAC,CAACG,SAAS,CAAC,YAAY,CAAC;IACpC,MAAMC,IAAI,GAAG5C,YAAY,CAACwC,IAAI,CAAC;IAC/B5C,MAAM,CAACgD,IAAI,EAAEf,OAAO,EAAES,YAAY,CAAC,CAACO,IAAI,CAAC,YAAY,CAAC;EACxD,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1 +1,13 @@
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
+ "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
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TICKET_PROMPT"],"sourceRoot":"../../../src","sources":["store/ticketPrompt.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,aAAa,GACxB,iGAAiG,GACjG,gHAAgH,GAChH,gIAAgI,GAChI,8FAA8F,GAC9F,4HAA4H,GAC5H,yHAAyH","ignoreList":[]}
@@ -1 +1,75 @@
1
- "use strict";export function traceEntries(t){const s=[...t.reasoning??[]].sort((t,s)=>t.afterCalls-s.afterCalls),n=[];let o=0;const r=t=>{for(;o<s.length&&s[o].afterCalls<=t;)n.push({kind:"thought",text:s[o].text}),o+=1};return t.toolCalls.forEach((t,s)=>{r(s),n.push({kind:"step",n:s+1,call:t})}),r(t.toolCalls.length),n}export function hasTrace(t){return(t.reasoning?.length??0)>0||t.toolCalls.length>0}const statusWord=t=>"ok"===t.status?t.summary||"done":"running"===t.status?"running":`${t.status}${t.summary?` — ${t.summary}`:""}`;export function traceToText(t,s=" "){const n=[];for(const o of traceEntries(t))if("thought"===o.kind){n.push(`${s}[thinking]`);for(const t of o.text.trim().split("\n"))n.push(`${s} ${t}`)}else{const{n:t,call:r}=o;n.push(`${s}[${t}] ${r.toolId}.${r.action} — ${statusWord(r)}`),r.params&&n.push(`${s} ${r.params}`)}return n}
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
@@ -0,0 +1 @@
1
+ {"version":3,"names":["traceEntries","message","thoughts","reasoning","sort","a","b","afterCalls","out","t","drainTo","calls","length","push","kind","text","toolCalls","forEach","call","i","n","hasTrace","statusWord","status","summary","traceToText","indent","lines","entry","line","trim","split","toolId","action","params"],"sourceRoot":"../../../src","sources":["store/traceText.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA,OAAO,SAASA,YAAYA,CAACC,OAAoB,EAAgB;EAC/D,MAAMC,QAAyB,GAAG,CAAC,IAAID,OAAO,CAACE,SAAS,IAAI,EAAE,CAAC,CAAC,CAACC,IAAI,CACnE,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAACE,UAAU,GAAGD,CAAC,CAACC,UAC7B,CAAC;EACD,MAAMC,GAAiB,GAAG,EAAE;EAC5B,IAAIC,CAAC,GAAG,CAAC;EACT,MAAMC,OAAO,GAAIC,KAAa,IAAK;IACjC,OAAOF,CAAC,GAAGP,QAAQ,CAACU,MAAM,IAAIV,QAAQ,CAACO,CAAC,CAAC,CAAEF,UAAU,IAAII,KAAK,EAAE;MAC9DH,GAAG,CAACK,IAAI,CAAC;QAAEC,IAAI,EAAE,SAAS;QAAEC,IAAI,EAAEb,QAAQ,CAACO,CAAC,CAAC,CAAEM;MAAK,CAAC,CAAC;MACtDN,CAAC,IAAI,CAAC;IACR;EACF,CAA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AAC,GAAGa,MAAM,KAAKG,IAAI,EAAE,CAAC;MAClC;IACF,CAAC,MAAM;MACL,MAAM;QAAET,CAAC;QAAEF;MAAK,CAAC,GAAGU,KAAK;MACzBD,KAAK,CAACd,IAAI,CAAC,GAAGa,MAAM,IAAIN,CAAC,KAAKF,IAAI,CAACc,MAAM,IAAId,IAAI,CAACe,MAAM,MAAMX,UAAU,CAACJ,IAAI,CAAC,EAAE,CAAC;MACjF,IAAIA,IAAI,CAACgB,MAAM,EAAEP,KAAK,CAACd,IAAI,CAAC,GAAGa,MAAM,OAAOR,IAAI,CAACgB,MAAM,EAAE,CAAC;IAC5D;EACF;EACA,OAAOP,KAAK;AACd","ignoreList":[]}
@@ -1 +1,111 @@
1
- "use strict";import{describe,expect,it}from"vitest";import{hasTrace,traceEntries,traceToText}from"./traceText";const call=(t={})=>({id:"c1",toolId:"zustand",action:"getStoreState",label:"Read the bag",status:"ok",summary:"Done",...t}),msg=(t={})=>({id:"m1",role:"assistant",text:"Five items.",toolCalls:[],blocks:[],...t});describe("the order of a trace",()=>{it("interleaves thinking with the steps it led to",()=>{const t=msg({toolCalls:[call({id:"c1"}),call({id:"c2",action:"setState"})],reasoning:[{text:"I should read the bag first.",afterCalls:0},{text:"Now I can write the new quantity.",afterCalls:1}]});expect(traceEntries(t).map(t=>"thought"===t.kind?"T":`S${t.n}`)).toEqual(["T","S1","T","S2"])}),it("keeps a closing thought after the last step",()=>{const t=msg({toolCalls:[call()],reasoning:[{text:"That is everything the user asked for.",afterCalls:1}]}),e=traceEntries(t);expect(e[e.length-1]).toEqual({kind:"thought",text:"That is everything the user asked for."})}),it("handles a turn with steps and no reasoning at all",()=>{const t=msg({toolCalls:[call()]});expect(traceEntries(t)).toHaveLength(1),expect(hasTrace(t)).toBe(!0)}),it("has nothing to show for a plain answer",()=>{expect(hasTrace(msg())).toBe(!1)})}),describe("the text it produces",()=>{it("names the tool, the action, the outcome and the parameters",()=>{const t=msg({toolCalls:[call({params:'{"storeName":"Poké Mart bag"}'})]});expect(traceToText(t)).toEqual([" [1] zustand.getStoreState — Done",' {"storeName":"Poké Mart bag"}'])}),it("makes a failure and its parameters findable",()=>{const t=msg({toolCalls:[call({toolId:"storage",action:"async.setItem",status:"failed",summary:"key not found",params:'{"key":"@pokemart/bag"}'})]});expect(traceToText(t).join("\n")).toContain("failed — key not found"),expect(traceToText(t).join("\n")).toContain("@pokemart/bag")}),it("indents a multi-line thought so a pasted session still reads as one",()=>{const t=msg({reasoning:[{text:"First line.\nSecond line.",afterCalls:0}]});expect(traceToText(t)).toEqual([" [thinking]"," First line."," Second line."])})});
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
@@ -0,0 +1 @@
1
+ {"version":3,"names":["describe","expect","it","hasTrace","traceEntries","traceToText","call","over","id","toolId","action","label","status","summary","msg","role","text","toolCalls","blocks","m","reasoning","afterCalls","map","e","kind","n","toEqual","entries","length","toHaveLength","toBe","params","join","toContain"],"sourceRoot":"../../../src","sources":["store/traceText.test.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAE7C,SAASC,QAAQ,EAAEC,YAAY,EAAEC,WAAW,QAAQ,aAAa;AAGjE,MAAMC,IAAI,GAAGA,CAACC,IAA2B,GAAG,CAAC,CAAC,MAAoB;EAChEC,EAAE,EAAE,IAAI;EACRC,MAAM,EAAE,SAAS;EACjBC,MAAM,EAAE,eAAe;EACvBC,KAAK,EAAE,cAAc;EACrBC,MAAM,EAAE,IAAI;EACZC,OAAO,EAAE,MAAM;EACf,GAAGN;AACL,CAAC,CAAC;AAEF,MAAMO,GAAG,GAAGA,CAACP,IAA0B,GAAG,CAAC,CAAC,MAAmB;EAC7DC,EAAE,EAAE,IAAI;EACRO,IAAI,EAAE,WAAW;EACjBC,IAAI,EAAE,aAAa;EACnBC,SAAS,EAAE,EAAE;EACbC,MAAM,EAAE,EAAE;EACV,GAAGX;AACL,CAAC,CAAC;AAEFP,QAAQ,CAAC,sBAAsB,EAAE,MAAM;EACrCE,EAAE,CAAC,+CAA+C,EAAE,MAAM;IACxD,MAAMiB,CAAC,GAAGL,GAAG,CAAC;MACZG,SAAS,EAAE,CAACX,IAAI,CAAC;QAAEE,EAAE,EAAE;MAAK,CAAC,CAAC,EAAEF,IAAI,CAAC;QAAEE,EAAE,EAAE,IAAI;QAAEE,MAAM,EAAE;MAAW,CAAC,CAAC,CAAC;MACvEU,SAAS,EAAE,CACT;QAAEJ,IAAI,EAAE,8BAA8B;QAAEK,UAAU,EAAE;MAAE,CAAC,EACvD;QAAEL,IAAI,EAAE,mC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