@buoy-gg/ask-buoy 7.0.34 → 7.0.35

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 (239) hide show
  1. package/README.md +1 -1
  2. package/lib/commonjs/blocks/AskBlocks.js +338 -1
  3. package/lib/commonjs/blocks/AskBlocks.js.map +1 -0
  4. package/lib/commonjs/blocks/BlockRenderer.js +250 -1
  5. package/lib/commonjs/blocks/BlockRenderer.js.map +1 -0
  6. package/lib/commonjs/blocks/ChromePrototypes.js +514 -1
  7. package/lib/commonjs/blocks/ChromePrototypes.js.map +1 -0
  8. package/lib/commonjs/blocks/DataBlocks.js +688 -1
  9. package/lib/commonjs/blocks/DataBlocks.js.map +1 -0
  10. package/lib/commonjs/blocks/ExtraBlocks.js +1854 -1
  11. package/lib/commonjs/blocks/ExtraBlocks.js.map +1 -0
  12. package/lib/commonjs/blocks/MediaBlocks.js +140 -1
  13. package/lib/commonjs/blocks/MediaBlocks.js.map +1 -0
  14. package/lib/commonjs/blocks/ReceiptBlocks.js +586 -1
  15. package/lib/commonjs/blocks/ReceiptBlocks.js.map +1 -0
  16. package/lib/commonjs/blocks/context.js +42 -1
  17. package/lib/commonjs/blocks/context.js.map +1 -0
  18. package/lib/commonjs/blocks/icons.js +96 -1
  19. package/lib/commonjs/blocks/icons.js.map +1 -0
  20. package/lib/commonjs/blocks/index.js +95 -1
  21. package/lib/commonjs/blocks/index.js.map +1 -0
  22. package/lib/commonjs/blocks/listRow.test.js +55 -0
  23. package/lib/commonjs/blocks/listRow.test.js.map +1 -0
  24. package/lib/commonjs/blocks/pageState.js +34 -0
  25. package/lib/commonjs/blocks/pageState.js.map +1 -0
  26. package/lib/commonjs/blocks/pageState.test.js +57 -0
  27. package/lib/commonjs/blocks/pageState.test.js.map +1 -0
  28. package/lib/commonjs/blocks/primitives.js +401 -1
  29. package/lib/commonjs/blocks/primitives.js.map +1 -0
  30. package/lib/commonjs/blocks/primitivesIndex.js +62 -1
  31. package/lib/commonjs/blocks/primitivesIndex.js.map +1 -0
  32. package/lib/commonjs/components/ApprovalCard.js +140 -1
  33. package/lib/commonjs/components/ApprovalCard.js.map +1 -0
  34. package/lib/commonjs/components/AskBuoyHeader.js +164 -1
  35. package/lib/commonjs/components/AskBuoyHeader.js.map +1 -0
  36. package/lib/commonjs/components/AskBuoyIcon.js +19 -1
  37. package/lib/commonjs/components/AskBuoyIcon.js.map +1 -0
  38. package/lib/commonjs/components/AskBuoyModal.js +353 -1
  39. package/lib/commonjs/components/AskBuoyModal.js.map +1 -0
  40. package/lib/commonjs/components/AskBuoySettings.js +69 -0
  41. package/lib/commonjs/components/AskBuoySettings.js.map +1 -0
  42. package/lib/commonjs/components/ChangesBar.js +211 -1
  43. package/lib/commonjs/components/ChangesBar.js.map +1 -0
  44. package/lib/commonjs/components/Composer.js +175 -1
  45. package/lib/commonjs/components/Composer.js.map +1 -0
  46. package/lib/commonjs/components/EmptyState.js +154 -1
  47. package/lib/commonjs/components/EmptyState.js.map +1 -0
  48. package/lib/commonjs/components/Markdown.js +252 -1
  49. package/lib/commonjs/components/Markdown.js.map +1 -0
  50. package/lib/commonjs/components/MessageList.js +683 -1
  51. package/lib/commonjs/components/MessageList.js.map +1 -0
  52. package/lib/commonjs/components/ThinkingStrip.js +223 -0
  53. package/lib/commonjs/components/ThinkingStrip.js.map +1 -0
  54. package/lib/commonjs/components/TypingDots.js +63 -1
  55. package/lib/commonjs/components/TypingDots.js.map +1 -0
  56. package/lib/commonjs/components/useCopyAction.js +50 -0
  57. package/lib/commonjs/components/useCopyAction.js.map +1 -0
  58. package/lib/commonjs/index.js +252 -1
  59. package/lib/commonjs/index.js.map +1 -0
  60. package/lib/commonjs/preset.js +90 -1
  61. package/lib/commonjs/preset.js.map +1 -0
  62. package/lib/commonjs/store/askBuoySettings.js +67 -0
  63. package/lib/commonjs/store/askBuoySettings.js.map +1 -0
  64. package/lib/commonjs/store/askBuoyStore.js +365 -1
  65. package/lib/commonjs/store/askBuoyStore.js.map +1 -0
  66. package/lib/commonjs/store/restoredIds.test.js +47 -0
  67. package/lib/commonjs/store/restoredIds.test.js.map +1 -0
  68. package/lib/commonjs/store/traceText.js +81 -0
  69. package/lib/commonjs/store/traceText.js.map +1 -0
  70. package/lib/commonjs/store/traceText.test.js +112 -0
  71. package/lib/commonjs/store/traceText.test.js.map +1 -0
  72. package/lib/commonjs/store/transcriptPersistence.js +208 -0
  73. package/lib/commonjs/store/transcriptPersistence.js.map +1 -0
  74. package/lib/commonjs/store/transcriptPersistence.test.js +185 -0
  75. package/lib/commonjs/store/transcriptPersistence.test.js.map +1 -0
  76. package/lib/commonjs/store/useAskBuoy.js +400 -1
  77. package/lib/commonjs/store/useAskBuoy.js.map +1 -0
  78. package/lib/commonjs/store/useAskBuoySettings.js +14 -0
  79. package/lib/commonjs/store/useAskBuoySettings.js.map +1 -0
  80. package/lib/commonjs/sync/askBuoySyncAdapter.js +119 -1
  81. package/lib/commonjs/sync/askBuoySyncAdapter.js.map +1 -0
  82. package/lib/commonjs/sync/askBuoySyncAdapter.test.js +141 -1
  83. package/lib/commonjs/sync/askBuoySyncAdapter.test.js.map +1 -0
  84. package/lib/commonjs/sync/wire.js +58 -1
  85. package/lib/commonjs/sync/wire.js.map +1 -0
  86. package/lib/commonjs/types.js +6 -1
  87. package/lib/commonjs/types.js.map +1 -0
  88. package/lib/module/blocks/AskBlocks.js +331 -1
  89. package/lib/module/blocks/AskBlocks.js.map +1 -0
  90. package/lib/module/blocks/BlockRenderer.js +245 -1
  91. package/lib/module/blocks/BlockRenderer.js.map +1 -0
  92. package/lib/module/blocks/ChromePrototypes.js +503 -1
  93. package/lib/module/blocks/ChromePrototypes.js.map +1 -0
  94. package/lib/module/blocks/DataBlocks.js +674 -1
  95. package/lib/module/blocks/DataBlocks.js.map +1 -0
  96. package/lib/module/blocks/ExtraBlocks.js +1827 -1
  97. package/lib/module/blocks/ExtraBlocks.js.map +1 -0
  98. package/lib/module/blocks/MediaBlocks.js +135 -1
  99. package/lib/module/blocks/MediaBlocks.js.map +1 -0
  100. package/lib/module/blocks/ReceiptBlocks.js +574 -1
  101. package/lib/module/blocks/ReceiptBlocks.js.map +1 -0
  102. package/lib/module/blocks/context.js +35 -1
  103. package/lib/module/blocks/context.js.map +1 -0
  104. package/lib/module/blocks/icons.js +91 -1
  105. package/lib/module/blocks/icons.js.map +1 -0
  106. package/lib/module/blocks/index.js +8 -1
  107. package/lib/module/blocks/index.js.map +1 -0
  108. package/lib/module/blocks/listRow.test.js +56 -0
  109. package/lib/module/blocks/listRow.test.js.map +1 -0
  110. package/lib/module/blocks/pageState.js +30 -0
  111. package/lib/module/blocks/pageState.js.map +1 -0
  112. package/lib/module/blocks/pageState.test.js +56 -0
  113. package/lib/module/blocks/pageState.test.js.map +1 -0
  114. package/lib/module/blocks/primitives.js +389 -1
  115. package/lib/module/blocks/primitives.js.map +1 -0
  116. package/lib/module/blocks/primitivesIndex.js +5 -1
  117. package/lib/module/blocks/primitivesIndex.js.map +1 -0
  118. package/lib/module/components/ApprovalCard.js +135 -1
  119. package/lib/module/components/ApprovalCard.js.map +1 -0
  120. package/lib/module/components/AskBuoyHeader.js +161 -1
  121. package/lib/module/components/AskBuoyHeader.js.map +1 -0
  122. package/lib/module/components/AskBuoyIcon.js +8 -1
  123. package/lib/module/components/AskBuoyIcon.js.map +1 -0
  124. package/lib/module/components/AskBuoyModal.js +348 -1
  125. package/lib/module/components/AskBuoyModal.js.map +1 -0
  126. package/lib/module/components/AskBuoySettings.js +64 -0
  127. package/lib/module/components/AskBuoySettings.js.map +1 -0
  128. package/lib/module/components/ChangesBar.js +206 -1
  129. package/lib/module/components/ChangesBar.js.map +1 -0
  130. package/lib/module/components/Composer.js +170 -1
  131. package/lib/module/components/Composer.js.map +1 -0
  132. package/lib/module/components/EmptyState.js +149 -1
  133. package/lib/module/components/EmptyState.js.map +1 -0
  134. package/lib/module/components/Markdown.js +246 -1
  135. package/lib/module/components/Markdown.js.map +1 -0
  136. package/lib/module/components/MessageList.js +677 -1
  137. package/lib/module/components/MessageList.js.map +1 -0
  138. package/lib/module/components/ThinkingStrip.js +218 -0
  139. package/lib/module/components/ThinkingStrip.js.map +1 -0
  140. package/lib/module/components/TypingDots.js +58 -1
  141. package/lib/module/components/TypingDots.js.map +1 -0
  142. package/lib/module/components/useCopyAction.js +46 -0
  143. package/lib/module/components/useCopyAction.js.map +1 -0
  144. package/lib/module/index.js +34 -1
  145. package/lib/module/index.js.map +1 -0
  146. package/lib/module/preset.js +73 -1
  147. package/lib/module/preset.js.map +1 -0
  148. package/lib/module/store/askBuoySettings.js +62 -0
  149. package/lib/module/store/askBuoySettings.js.map +1 -0
  150. package/lib/module/store/askBuoyStore.js +361 -1
  151. package/lib/module/store/askBuoyStore.js.map +1 -0
  152. package/lib/module/store/restoredIds.test.js +46 -0
  153. package/lib/module/store/restoredIds.test.js.map +1 -0
  154. package/lib/module/store/traceText.js +75 -0
  155. package/lib/module/store/traceText.js.map +1 -0
  156. package/lib/module/store/traceText.test.js +111 -0
  157. package/lib/module/store/traceText.test.js.map +1 -0
  158. package/lib/module/store/transcriptPersistence.js +198 -0
  159. package/lib/module/store/transcriptPersistence.js.map +1 -0
  160. package/lib/module/store/transcriptPersistence.test.js +184 -0
  161. package/lib/module/store/transcriptPersistence.test.js.map +1 -0
  162. package/lib/module/store/useAskBuoy.js +394 -1
  163. package/lib/module/store/useAskBuoy.js.map +1 -0
  164. package/lib/module/store/useAskBuoySettings.js +9 -0
  165. package/lib/module/store/useAskBuoySettings.js.map +1 -0
  166. package/lib/module/sync/askBuoySyncAdapter.js +114 -1
  167. package/lib/module/sync/askBuoySyncAdapter.js.map +1 -0
  168. package/lib/module/sync/askBuoySyncAdapter.test.js +140 -1
  169. package/lib/module/sync/askBuoySyncAdapter.test.js.map +1 -0
  170. package/lib/module/sync/wire.js +47 -1
  171. package/lib/module/sync/wire.js.map +1 -0
  172. package/lib/module/types.js +4 -1
  173. package/lib/module/types.js.map +1 -0
  174. package/lib/typescript/blocks/AskBlocks.d.ts.map +1 -0
  175. package/lib/typescript/blocks/BlockRenderer.d.ts.map +1 -0
  176. package/lib/typescript/blocks/ChromePrototypes.d.ts.map +1 -0
  177. package/lib/typescript/blocks/DataBlocks.d.ts +31 -0
  178. package/lib/typescript/blocks/DataBlocks.d.ts.map +1 -0
  179. package/lib/typescript/blocks/ExtraBlocks.d.ts +11 -0
  180. package/lib/typescript/blocks/ExtraBlocks.d.ts.map +1 -0
  181. package/lib/typescript/blocks/MediaBlocks.d.ts.map +1 -0
  182. package/lib/typescript/blocks/ReceiptBlocks.d.ts.map +1 -0
  183. package/lib/typescript/blocks/context.d.ts.map +1 -0
  184. package/lib/typescript/blocks/icons.d.ts.map +1 -0
  185. package/lib/typescript/blocks/index.d.ts.map +1 -0
  186. package/lib/typescript/blocks/listRow.test.d.ts +2 -0
  187. package/lib/typescript/blocks/listRow.test.d.ts.map +1 -0
  188. package/lib/typescript/blocks/pageState.d.ts +23 -0
  189. package/lib/typescript/blocks/pageState.d.ts.map +1 -0
  190. package/lib/typescript/blocks/pageState.test.d.ts +2 -0
  191. package/lib/typescript/blocks/pageState.test.d.ts.map +1 -0
  192. package/lib/typescript/blocks/primitives.d.ts +39 -9
  193. package/lib/typescript/blocks/primitives.d.ts.map +1 -0
  194. package/lib/typescript/blocks/primitivesIndex.d.ts +2 -1
  195. package/lib/typescript/blocks/primitivesIndex.d.ts.map +1 -0
  196. package/lib/typescript/components/ApprovalCard.d.ts.map +1 -0
  197. package/lib/typescript/components/AskBuoyHeader.d.ts +11 -1
  198. package/lib/typescript/components/AskBuoyHeader.d.ts.map +1 -0
  199. package/lib/typescript/components/AskBuoyIcon.d.ts.map +1 -0
  200. package/lib/typescript/components/AskBuoyModal.d.ts.map +1 -0
  201. package/lib/typescript/components/AskBuoySettings.d.ts +2 -0
  202. package/lib/typescript/components/AskBuoySettings.d.ts.map +1 -0
  203. package/lib/typescript/components/ChangesBar.d.ts.map +1 -0
  204. package/lib/typescript/components/Composer.d.ts.map +1 -0
  205. package/lib/typescript/components/EmptyState.d.ts.map +1 -0
  206. package/lib/typescript/components/Markdown.d.ts.map +1 -0
  207. package/lib/typescript/components/MessageList.d.ts +12 -5
  208. package/lib/typescript/components/MessageList.d.ts.map +1 -0
  209. package/lib/typescript/components/ThinkingStrip.d.ts +5 -0
  210. package/lib/typescript/components/ThinkingStrip.d.ts.map +1 -0
  211. package/lib/typescript/components/TypingDots.d.ts.map +1 -0
  212. package/lib/typescript/components/useCopyAction.d.ts +5 -0
  213. package/lib/typescript/components/useCopyAction.d.ts.map +1 -0
  214. package/lib/typescript/index.d.ts +5 -0
  215. package/lib/typescript/index.d.ts.map +1 -0
  216. package/lib/typescript/preset.d.ts.map +1 -0
  217. package/lib/typescript/store/askBuoySettings.d.ts +22 -0
  218. package/lib/typescript/store/askBuoySettings.d.ts.map +1 -0
  219. package/lib/typescript/store/askBuoyStore.d.ts +74 -13
  220. package/lib/typescript/store/askBuoyStore.d.ts.map +1 -0
  221. package/lib/typescript/store/restoredIds.test.d.ts +2 -0
  222. package/lib/typescript/store/restoredIds.test.d.ts.map +1 -0
  223. package/lib/typescript/store/traceText.d.ts +33 -0
  224. package/lib/typescript/store/traceText.d.ts.map +1 -0
  225. package/lib/typescript/store/traceText.test.d.ts +2 -0
  226. package/lib/typescript/store/traceText.test.d.ts.map +1 -0
  227. package/lib/typescript/store/transcriptPersistence.d.ts +40 -0
  228. package/lib/typescript/store/transcriptPersistence.d.ts.map +1 -0
  229. package/lib/typescript/store/transcriptPersistence.test.d.ts +2 -0
  230. package/lib/typescript/store/transcriptPersistence.test.d.ts.map +1 -0
  231. package/lib/typescript/store/useAskBuoy.d.ts.map +1 -0
  232. package/lib/typescript/store/useAskBuoySettings.d.ts +3 -0
  233. package/lib/typescript/store/useAskBuoySettings.d.ts.map +1 -0
  234. package/lib/typescript/sync/askBuoySyncAdapter.d.ts.map +1 -0
  235. package/lib/typescript/sync/askBuoySyncAdapter.test.d.ts.map +1 -0
  236. package/lib/typescript/sync/wire.d.ts.map +1 -0
  237. package/lib/typescript/types.d.ts +24 -1
  238. package/lib/typescript/types.d.ts.map +1 -0
  239. package/package.json +8 -8
@@ -1 +1,361 @@
1
- "use strict";let seq=0;const nextId=()=>"m"+ ++seq;let state={messages:[],busy:!1,pending:null,notice:null,configured:!1,answers:{},awaitingBlockId:null,actionState:{},queued:null,usage:{input:0,output:0,requests:0}};const listeners=new Set;let ledgerRef=null,heldSession=null;function set(e){state={...state,...e};for(const e of listeners)try{e()}catch{}}export const askBuoyStore={getState:()=>state,subscribe:e=>(listeners.add(e),()=>listeners.delete(e)),setLedger(e){ledgerRef=e},getLedger:()=>ledgerRef,holdSession(e,t){heldSession={session:e,signature:t}},getHeldSession:()=>heldSession,setNotice(e){set({notice:e})},setConfigured(e){e!==state.configured&&set({configured:e})},addUser(e){set({messages:[...state.messages,{id:nextId(),role:"user",text:e,toolCalls:[],blocks:[]}],busy:!0})},beginTurn(){set({busy:!0})},setQueued(e){set({queued:e})},removeMessage(e){set({messages:state.messages.filter(t=>t.id!==e)})},recordAnswer(e){set({answers:{...state.answers,[e.blockId]:e},awaitingBlockId:state.awaitingBlockId===e.blockId?null:state.awaitingBlockId})},setActionState(e,t){const s={...state.actionState};null===t?delete s[e]:s[e]=t,set({actionState:s})},startAssistant(){const e=nextId();return set({messages:[...state.messages,{id:e,role:"assistant",text:"",toolCalls:[],blocks:[],streaming:!0}]}),e},applyEvent(e,t){set({messages:state.messages.map(s=>{if(s.id!==e)return s;switch(t.type){case"text":return{...s,text:s.breakBeforeNextText&&s.text?`${s.text.trimEnd()}\n\n${t.delta}`:s.text+t.delta,breakBeforeNextText:!1};case"tool-start":return{...s,toolCalls:[...s.toolCalls,{id:t.id,toolId:t.toolId,action:t.action,label:t.label,description:t.description,status:"running"}]};case"tool-end":return{...s,breakBeforeNextText:!0,toolCalls:s.toolCalls.map(e=>e.id===t.id?{...e,status:t.ok||"refused"!==t.summary?t.ok?"ok":"failed":"refused",summary:t.summary}:e)};case"block":return{...s,breakBeforeNextText:!0,blocks:[...s.blocks,{block:t.block,forToolCallId:t.forToolCallId}]};case"error":return{...s,error:t.message};default:return s}}),..."awaiting-user"===t.type?{awaitingBlockId:t.blockId}:{},..."usage"===t.type?{usage:{input:state.usage.input+t.input,output:state.usage.output+t.output,requests:state.usage.requests+1}}:{}})},finishAssistant(e){set({messages:state.messages.map(t=>t.id===e?{...t,streaming:!1}:t),busy:!1})},askApproval:e=>new Promise(t=>{set({pending:{...e,resolve:t}})}),answerApproval(e){const t=state.pending;set({pending:null}),t?.resolve(e)},reset(){state.pending?.resolve(!1),set({messages:[],busy:!1,pending:null,notice:null,answers:{},awaitingBlockId:null,actionState:{},queued:null,usage:{input:0,output:0,requests:0}})}};
1
+ "use strict";
2
+
3
+ /**
4
+ * Conversation state for the sheet.
5
+ *
6
+ * A module-level store rather than component state for two reasons: the sheet
7
+ * is unmounted whenever the tool is closed or minimised (and a conversation
8
+ * that vanished because someone tapped away would be maddening), and the sync
9
+ * adapter needs to read the same transcript to show it on the desktop.
10
+ *
11
+ * Persisted across restarts, on purpose, with the payloads left out — see
12
+ * `transcriptPersistence.ts` for what is written and what that costs. The
13
+ * store itself stays a plain in-memory store; saving is a subscriber, and
14
+ * `hydrate` is the one way anything comes back in.
15
+ */
16
+ import { idFactory } from "@buoy-gg/agent-core";
17
+
18
+ /** A block in a message, and (for receipts) the tool call that produced it. */
19
+
20
+ /**
21
+ * A stretch of the model's own reasoning, and where it fell.
22
+ *
23
+ * `afterCalls` is how many tool calls this message had already made when the
24
+ * thought arrived, so the thinking view can lay reasoning and steps out in the
25
+ * order they actually happened. One assistant bubble spans every turn of a
26
+ * multi-step run, so "think, act, think, act" is the normal shape and showing
27
+ * all the thoughts in a lump at the top would misreport it.
28
+ */
29
+
30
+ /**
31
+ * Message ids carry this run's token — see agent-core's `runId`. A plain `m1`
32
+ * collided head-on with the `m1` in a restored transcript, and the message
33
+ * list keys on it.
34
+ */
35
+ const nextId = idFactory("m");
36
+
37
+ /**
38
+ * Params, as one readable line. Capped because a step can carry a whole
39
+ * response body or a store's full state, and this is chrome inside a chat
40
+ * bubble — the full value is a tool read away.
41
+ */
42
+ const MAX_PARAM_CHARS = 400;
43
+ function encodeParams(params) {
44
+ if (!params || Object.keys(params).length === 0) return undefined;
45
+ try {
46
+ const json = JSON.stringify(params);
47
+ return json.length > MAX_PARAM_CHARS ? `${json.slice(0, MAX_PARAM_CHARS)}…` : json;
48
+ } catch {
49
+ return undefined;
50
+ }
51
+ }
52
+ let state = {
53
+ messages: [],
54
+ busy: false,
55
+ pending: null,
56
+ notice: null,
57
+ configured: false,
58
+ answers: {},
59
+ awaitingBlockId: null,
60
+ actionState: {},
61
+ queued: null,
62
+ usage: {
63
+ input: 0,
64
+ output: 0,
65
+ requests: 0
66
+ },
67
+ meta: {}
68
+ };
69
+ const listeners = new Set();
70
+ let ledgerRef = null;
71
+
72
+ /**
73
+ * The session outlives the sheet the same way the transcript does. Session and
74
+ * ledger used to be per-mount: closing and reopening the tool kept the visible
75
+ * conversation but silently swapped in an empty ledger and a blank model
76
+ * memory — the undo bar vanished while the agent's changes stayed live in the
77
+ * app. Held here, keyed by a config signature so a real reconfiguration
78
+ * (different endpoint/model/tool set) still rebuilds.
79
+ */
80
+ let heldSession = null;
81
+ function set(next) {
82
+ state = {
83
+ ...state,
84
+ ...next
85
+ };
86
+ for (const fn of listeners) {
87
+ try {
88
+ fn();
89
+ } catch {
90
+ // A throwing subscriber must not take the transcript down mid-answer.
91
+ }
92
+ }
93
+ }
94
+ export const askBuoyStore = {
95
+ getState: () => state,
96
+ subscribe(fn) {
97
+ listeners.add(fn);
98
+ return () => listeners.delete(fn);
99
+ },
100
+ setLedger(ledger) {
101
+ ledgerRef = ledger;
102
+ },
103
+ getLedger() {
104
+ return ledgerRef;
105
+ },
106
+ holdSession(session, signature) {
107
+ heldSession = {
108
+ session,
109
+ signature
110
+ };
111
+ },
112
+ getHeldSession() {
113
+ return heldSession;
114
+ },
115
+ setNotice(notice) {
116
+ set({
117
+ notice
118
+ });
119
+ },
120
+ setConfigured(configured) {
121
+ if (configured !== state.configured) set({
122
+ configured
123
+ });
124
+ },
125
+ setMeta(meta) {
126
+ const same = Object.keys(meta).every(k => state.meta[k] === meta[k]);
127
+ if (!same) set({
128
+ meta: {
129
+ ...state.meta,
130
+ ...meta
131
+ }
132
+ });
133
+ },
134
+ addUser(text) {
135
+ set({
136
+ messages: [...state.messages, {
137
+ id: nextId(),
138
+ role: "user",
139
+ text,
140
+ toolCalls: [],
141
+ blocks: []
142
+ }],
143
+ busy: true
144
+ });
145
+ },
146
+ /** Mark a turn as running without adding a bubble — the retry path. */
147
+ beginTurn() {
148
+ set({
149
+ busy: true
150
+ });
151
+ },
152
+ /** Park a message typed mid-turn instead of silently dropping it. */
153
+ setQueued(text) {
154
+ set({
155
+ queued: text
156
+ });
157
+ },
158
+ /** Drop one message — the failed assistant bubble a retry replaces. */
159
+ removeMessage(id) {
160
+ set({
161
+ messages: state.messages.filter(m => m.id !== id)
162
+ });
163
+ },
164
+ /** The user answered (or skipped) an Ask block. */
165
+ recordAnswer(answer) {
166
+ set({
167
+ answers: {
168
+ ...state.answers,
169
+ [answer.blockId]: answer
170
+ },
171
+ awaitingBlockId: state.awaitingBlockId === answer.blockId ? null : state.awaitingBlockId
172
+ });
173
+ },
174
+ setActionState(key, value) {
175
+ const next = {
176
+ ...state.actionState
177
+ };
178
+ if (value === null) delete next[key];else next[key] = value;
179
+ set({
180
+ actionState: next
181
+ });
182
+ },
183
+ /** Open a new assistant bubble for the turn that is about to stream. */
184
+ startAssistant() {
185
+ const id = nextId();
186
+ set({
187
+ messages: [...state.messages, {
188
+ id,
189
+ role: "assistant",
190
+ text: "",
191
+ toolCalls: [],
192
+ blocks: [],
193
+ streaming: true,
194
+ startedAt: Date.now()
195
+ }]
196
+ });
197
+ return id;
198
+ },
199
+ /**
200
+ * Fold one engine event into the open assistant message.
201
+ *
202
+ * Tool calls render as rows inside the bubble rather than as raw payloads:
203
+ * the label is already domain-flavoured ("Set points to 1500"), which is the
204
+ * only form a non-developer can actually check.
205
+ */
206
+ applyEvent(messageId, ev) {
207
+ const messages = state.messages.map(m => {
208
+ if (m.id !== messageId) return m;
209
+ switch (ev.type) {
210
+ case "text":
211
+ return {
212
+ ...m,
213
+ text: m.breakBeforeNextText && m.text ? `${m.text.trimEnd()}\n\n${ev.delta}` : m.text + ev.delta,
214
+ breakBeforeNextText: false
215
+ };
216
+ case "reasoning":
217
+ return {
218
+ ...m,
219
+ breakBeforeNextText: true,
220
+ reasoning: [...(m.reasoning ?? []), {
221
+ text: ev.text,
222
+ afterCalls: m.toolCalls.length
223
+ }]
224
+ };
225
+ case "tool-start":
226
+ return {
227
+ ...m,
228
+ toolCalls: [...m.toolCalls, {
229
+ id: ev.id,
230
+ toolId: ev.toolId,
231
+ action: ev.action,
232
+ label: ev.label,
233
+ description: ev.description,
234
+ status: "running",
235
+ params: encodeParams(ev.params),
236
+ effect: ev.effect,
237
+ startedAt: Date.now()
238
+ }]
239
+ };
240
+ case "tool-end":
241
+ return {
242
+ ...m,
243
+ breakBeforeNextText: true,
244
+ toolCalls: m.toolCalls.map(c => c.id === ev.id ? {
245
+ ...c,
246
+ status: !ev.ok && ev.summary === "refused" ? "refused" : ev.ok ? "ok" : "failed",
247
+ summary: ev.summary,
248
+ durationMs: ev.durationMs,
249
+ result: ev.result
250
+ } : c)
251
+ };
252
+ case "block":
253
+ return {
254
+ ...m,
255
+ breakBeforeNextText: true,
256
+ blocks: [...m.blocks, {
257
+ block: ev.block,
258
+ forToolCallId: ev.forToolCallId
259
+ }]
260
+ };
261
+ case "usage":
262
+ // Also folded into the session total below. Per MESSAGE as well,
263
+ // because "which answer cost 40k tokens" is the question you ask
264
+ // when a bill looks wrong, and a session total cannot answer it.
265
+ return {
266
+ ...m,
267
+ usage: {
268
+ input: (m.usage?.input ?? 0) + ev.input,
269
+ output: (m.usage?.output ?? 0) + ev.output,
270
+ requests: (m.usage?.requests ?? 0) + 1
271
+ }
272
+ };
273
+ case "error":
274
+ return {
275
+ ...m,
276
+ error: ev.message
277
+ };
278
+ default:
279
+ return m;
280
+ }
281
+ });
282
+ set({
283
+ messages,
284
+ ...(ev.type === "awaiting-user" ? {
285
+ awaitingBlockId: ev.blockId
286
+ } : {}),
287
+ ...(ev.type === "usage" ? {
288
+ usage: {
289
+ input: state.usage.input + ev.input,
290
+ output: state.usage.output + ev.output,
291
+ requests: state.usage.requests + 1
292
+ }
293
+ } : {})
294
+ });
295
+ },
296
+ finishAssistant(messageId) {
297
+ set({
298
+ messages: state.messages.map(m => m.id === messageId ? {
299
+ ...m,
300
+ streaming: false,
301
+ endedAt: Date.now()
302
+ } : m),
303
+ busy: false
304
+ });
305
+ },
306
+ askApproval(input) {
307
+ return new Promise(resolve => {
308
+ set({
309
+ pending: {
310
+ ...input,
311
+ resolve
312
+ }
313
+ });
314
+ });
315
+ },
316
+ answerApproval(approved) {
317
+ const pending = state.pending;
318
+ set({
319
+ pending: null
320
+ });
321
+ pending?.resolve(approved);
322
+ },
323
+ /**
324
+ * Put a saved conversation back, once, at open.
325
+ *
326
+ * Refuses if anything has been said already: a slow disk read landing after
327
+ * the user has started typing must not shove an old chat in front of them.
328
+ */
329
+ hydrate(input) {
330
+ if (state.messages.length > 0 || state.busy) return false;
331
+ set({
332
+ messages: input.messages,
333
+ answers: input.answers,
334
+ usage: input.usage
335
+ });
336
+ return true;
337
+ },
338
+ reset() {
339
+ // Reject anything still waiting, or the turn hangs forever on a promise
340
+ // whose only resolver just left the screen.
341
+ state.pending?.resolve(false);
342
+ set({
343
+ messages: [],
344
+ busy: false,
345
+ pending: null,
346
+ notice: null,
347
+ answers: {},
348
+ awaitingBlockId: null,
349
+ actionState: {},
350
+ queued: null,
351
+ usage: {
352
+ input: 0,
353
+ output: 0,
354
+ requests: 0
355
+ }
356
+ // `meta` survives: it describes the app and the endpoint, not the
357
+ // conversation, and re-deriving it would need another render pass.
358
+ });
359
+ }
360
+ };
361
+ //# sourceMappingURL=askBuoyStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["idFactory","nextId","MAX_PARAM_CHARS","encodeParams","params","Object","keys","length","undefined","json","JSON","stringify","slice","state","messages","busy","pending","notice","configured","answers","awaitingBlockId","actionState","queued","usage","input","output","requests","meta","listeners","Set","ledgerRef","heldSession","set","next","fn","askBuoyStore","getState","subscribe","add","delete","setLedger","ledger","getLedger","holdSession","session","signature","getHeldSession","setNotice","setConfigured","setMeta","same","every","k","addUser","text","id","role","toolCalls","blocks","beginTurn","setQueued","removeMessage","filter","m","recordAnswer","answer","blockId","setActionState","key","value","startAssistant","streaming","startedAt","Date","now","applyEvent","messageId","ev","map","type","breakBeforeNextText","trimEnd","delta","reasoning","afterCalls","toolId","action","label","description","status","effect","c","ok","summary","durationMs","result","block","forToolCallId","error","message","finishAssistant","endedAt","askApproval","Promise","resolve","answerApproval","approved","hydrate","reset"],"sourceRoot":"../../../src","sources":["store/askBuoyStore.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,qBAAqB;;AAG/C;;AAsCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAmFA;AACA;AACA;AACA;AACA;AACA,MAAMC,MAAM,GAAGD,SAAS,CAAC,GAAG,CAAC;;AAE7B;AACA;AACA;AACA;AACA;AACA,MAAME,eAAe,GAAG,GAAG;AAE3B,SAASC,YAAYA,CAACC,MAA+B,EAAsB;EACzE,IAAI,CAACA,MAAM,IAAIC,MAAM,CAACC,IAAI,CAACF,MAAM,CAAC,CAACG,MAAM,KAAK,CAAC,EAAE,OAAOC,SAAS;EACjE,IAAI;IACF,MAAMC,IAAI,GAAGC,IAAI,CAACC,SAAS,CAACP,MAAM,CAAC;IACnC,OAAOK,IAAI,CAACF,MAAM,GAAGL,eAAe,GAAG,GAAGO,IAAI,CAACG,KAAK,CAAC,CAAC,EAAEV,eAAe,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OAAO;IAC7BgB,GAAG,CAAC;MAAEhB,OAAO,EAAE;IAAK,CAAC,CAAC;IACtBA,OAAO,EAAEwF,OAAO,CAACE,QAAQ,CAAC;EAC5B,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;EACEC,OAAOA,CAACnF,KAIP,EAAW;IACV,IAAIX,KAAK,CAACC,QAAQ,CAACP,MAAM,GAAG,CAAC,IAAIM,KAAK,CAACE,IAAI,EAAE,OAAO,KAAK;IACzDiB,GAAG,CAAC;MAAElB,QAAQ,EAAEU,KAAK,CAACV,QAAQ;MAAEK,OAAO,EAAEK,KAAK,CAACL,OAAO;MAAEI,KAAK,EAAEC,KAAK,CAACD;IAAM,CAAC,CAAC;IAC7E,OAAO,IAAI;EACb,CAAC;EAEDqF,KAAKA,CAAA,EAAS;IACZ;IACA;IACA/F,KAAK,CAACG,OAAO,EAAEwF,OAAO,CAAC,KAAK,CAAC;IAC7BxE,GAAG,CAAC;MACFlB,QAAQ,EAAE,EAAE;MACZC,IAAI,EAAE,KAAK;MACXC,OAAO,EAAE,IAAI;MACbC,MAAM,EAAE,IAAI;MACZE,OAAO,EAAE,CAAC,CAAC;MACXC,eAAe,EAAE,IAAI;MACrBC,WAAW,EAAE,CAAC,CAAC;MACfC,MAAM,EAAE,IAAI;MACZC,KAAK,EAAE;QAAEC,KAAK,EAAE,CAAC;QAAEC,MAAM,EAAE,CAAC;QAAEC,QAAQ,EAAE;MAAE;MAC1C;MACA;IACF,CAAC,CAAC;EACJ;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Ids from a RESTORED transcript must never collide with a fresh run's.
5
+ *
6
+ * The bug this covers, in full: every id counter restarted at 1 with the
7
+ * process, which was harmless until the transcript started outliving a reload.
8
+ * A restored conversation came back holding `rc1`, `ui1` and `m1`; the next
9
+ * turn minted `rc1` again; React saw two children with one key and rendered
10
+ * one of them twice while dropping the other. On screen that was the same
11
+ * store card appearing twice after a reload.
12
+ *
13
+ * Simulating a restart in one process is the whole difficulty — the module
14
+ * caches its counter. `idFactory` is the seam: a second factory stands in for
15
+ * the second run, and the shared RUN_ID is what has to differ between them.
16
+ */
17
+ import { describe, expect, it } from "vitest";
18
+ import { idFactory, RUN_ID } from "@buoy-gg/agent-core";
19
+ describe("ids across a restart", () => {
20
+ it("never reissues an id a restored transcript already holds", () => {
21
+ // What a saved transcript carries, from a previous launch.
22
+ const restored = ["rcOLDRUN-1", "rcOLDRUN-2", "uiOLDRUN-1", "mOLDRUN-1"];
23
+ const rc = idFactory("rc");
24
+ const ui = idFactory("ui");
25
+ const m = idFactory("m");
26
+ const fresh = [rc(), rc(), ui(), m()];
27
+ for (const id of fresh) expect(restored).not.toContain(id);
28
+ });
29
+ it("still counts up within one run", () => {
30
+ // The counter is what keeps two blocks in the SAME turn apart.
31
+ const rc = idFactory("rc");
32
+ const ids = [rc(), rc(), rc()];
33
+ expect(new Set(ids).size).toBe(3);
34
+ });
35
+ it("keeps two prefixes apart even at the same count", () => {
36
+ const rc = idFactory("rc");
37
+ const ui = idFactory("ui");
38
+ expect(rc()).not.toBe(ui());
39
+ });
40
+ it("stamps a run token that is not a fixed string", () => {
41
+ // A constant here would put every install back where it started.
42
+ expect(RUN_ID).toMatch(/^[a-z0-9]{4,8}$/);
43
+ expect(idFactory("rc")()).toBe(`rc${RUN_ID}-1`);
44
+ });
45
+ });
46
+ //# sourceMappingURL=restoredIds.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["describe","expect","it","idFactory","RUN_ID","restored","rc","ui","m","fresh","id","not","toContain","ids","Set","size","toBe","toMatch"],"sourceRoot":"../../../src","sources":["store/restoredIds.test.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,SAAS,EAAEC,MAAM,QAAQ,qBAAqB;AAEvD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AC,CAACa,OAAO,CAAC,iBAAiB,CAAC;IACzChB,MAAM,CAACE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAACa,IAAI,CAAC,KAAKZ,MAAM,IAAI,CAAC;EACjD,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,75 @@
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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AK,MAAMG,IAAI,IAAID,KAAK,CAACb,IAAI,CAACe,IAAI,CAAC,CAAC,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;QAChDJ,KAAK,CAACd,IAAI,CAAC,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":[]}
@@ -0,0 +1,111 @@
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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