@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,141 @@
1
- "use strict";var _vitest=require("vitest"),_agentCore=require("@buoy-gg/agent-core"),_askBuoySyncAdapter=require("./askBuoySyncAdapter"),_wire=require("./wire"),_askBuoyStore=require("../store/askBuoyStore");(0,_vitest.beforeEach)(()=>{_askBuoyStore.askBuoyStore.reset(),_askBuoyStore.askBuoyStore.setLedger(null)}),(0,_vitest.describe)("the wire surface",()=>{(0,_vitest.it)("exposes no action that can make the agent talk",()=>{const e=Object.keys(_askBuoySyncAdapter.askBuoySyncAdapter.actions);(0,_vitest.expect)(e).not.toContain("send"),(0,_vitest.expect)(e).not.toContain("ask"),(0,_vitest.expect)(e).not.toContain("prompt"),(0,_vitest.expect)(e.sort()).toEqual(["listChanges","reset","undoAll"])}),(0,_vitest.it)("puts the shape of the conversation on the wire, never tool payloads",()=>{_askBuoyStore.askBuoyStore.addUser("what is in storage");const e=_askBuoyStore.askBuoyStore.startAssistant();_askBuoyStore.askBuoyStore.applyEvent(e,{type:"tool-start",id:"c1",toolId:"storage",action:"async.getItem",label:"Read session",description:"Read one AsyncStorage key"}),_askBuoyStore.askBuoyStore.applyEvent(e,{type:"tool-end",id:"c1",ok:!0,summary:"eyJhbGciOiJIUzI1NiJ9.super.secret"});const t=_askBuoySyncAdapter.askBuoySyncAdapter.getSnapshot(),s=t.messages[1].toolCalls[0];(0,_vitest.expect)(s).toEqual({toolId:"storage",action:"async.getItem",status:"ok"}),(0,_vitest.expect)(JSON.stringify(t)).not.toContain("super.secret")}),(0,_vitest.it)("redacts credentials that made it into the assistant's prose",()=>{_askBuoyStore.askBuoyStore.addUser("show me the auth header");const e=_askBuoyStore.askBuoyStore.startAssistant();_askBuoyStore.askBuoyStore.applyEvent(e,{type:"text",delta:"It sends Authorization: Bearer abcdef0123456789ghijkl to the API."});const t=_askBuoySyncAdapter.askBuoySyncAdapter.getSnapshot();(0,_vitest.expect)(JSON.stringify(t)).not.toContain("abcdef0123456789ghijkl")}),(0,_vitest.it)("reports reversible and permanent changes separately",()=>{const e=new _agentCore.EffectLedger;_askBuoyStore.askBuoyStore.setLedger(e),e.record("storage","async.setItem",{kind:"storage-write",toolId:"storage",action:"async.setItem",key:"points",before:"240",label:"Set points to 1500"}),e.record("perf-monitor","clearAll",{kind:"transient",label:"Cleared samples"}),e.record("zustand","setState",{kind:"state-write",toolId:"zustand",action:"setState",label:"Update the cart store"});const t=_askBuoySyncAdapter.askBuoySyncAdapter.getSnapshot();(0,_vitest.expect)(t.changes.reversible).toBe(1),(0,_vitest.expect)(t.changes.permanent).toBe(1),(0,_vitest.expect)(t.changes.transients).toBe(1)})}),(0,_vitest.describe)("redactForWire",()=>{(0,_vitest.it)("removes bearer tokens, JWTs, api keys and license keys",()=>{const e=["Authorization: Bearer abcdefghijklmnop123456","token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9abcdefgh","key sk-abcdefghijklmnop1234","license BUOY-ABCD-1234-EFGH",'the header is "x-api-key": "supersecretvalue"'];for(const t of e)(0,_vitest.expect)((0,_wire.redactForWire)(t)).toContain("removed]")}),(0,_vitest.it)("leaves ordinary prose alone",()=>{const e="The /menu call returned 200 with 12 items and the burger was in stock.";(0,_vitest.expect)((0,_wire.redactForWire)(e)).toBe(e)})}),(0,_vitest.describe)("undo from the desktop",()=>{(0,_vitest.it)("is allowed, because putting things back is the safe direction",async()=>{const e=new _agentCore.EffectLedger;_askBuoyStore.askBuoyStore.setLedger(e);const t=new Map([["points","1500"]]);e.record("storage","async.setItem",{kind:"storage-write",toolId:"storage",action:"async.setItem",key:"points",before:"240",label:"Set points to 1500"}),await e.revertAll(async(e,s,o)=>{const a=o;"async.setItem"===s&&t.set(a.key,a.value)}),(0,_vitest.expect)(t.get("points")).toBe("240")})});
1
+ "use strict";
2
+
3
+ var _vitest = require("vitest");
4
+ var _agentCore = require("@buoy-gg/agent-core");
5
+ var _askBuoySyncAdapter = require("./askBuoySyncAdapter");
6
+ var _wire = require("./wire");
7
+ var _askBuoyStore = require("../store/askBuoyStore");
8
+ /**
9
+ * What Ask Buoy is allowed to put on the broker wire, and what it refuses to
10
+ * accept from it.
11
+ *
12
+ * Both directions matter. The broker has no authentication, accepts any client
13
+ * that calls itself "Dashboard", and forwards to every connected dashboard — it
14
+ * already broadcasts license keys that way. So: no tool results go out, and no
15
+ * remote client can make the agent say anything.
16
+ */
17
+
18
+ (0, _vitest.beforeEach)(() => {
19
+ _askBuoyStore.askBuoyStore.reset();
20
+ _askBuoyStore.askBuoyStore.setLedger(null);
21
+ });
22
+ (0, _vitest.describe)("the wire surface", () => {
23
+ (0, _vitest.it)("exposes no action that can make the agent talk", () => {
24
+ // A `send` here would let anyone on the LAN drive a mutating agent on a
25
+ // tester's phone. The conversation starts on-device, by a person.
26
+ const actions = Object.keys(_askBuoySyncAdapter.askBuoySyncAdapter.actions);
27
+ (0, _vitest.expect)(actions).not.toContain("send");
28
+ (0, _vitest.expect)(actions).not.toContain("ask");
29
+ (0, _vitest.expect)(actions).not.toContain("prompt");
30
+ (0, _vitest.expect)(actions.sort()).toEqual(["listChanges", "reset", "undoAll"]);
31
+ });
32
+ (0, _vitest.it)("puts the shape of the conversation on the wire, never tool payloads", () => {
33
+ _askBuoyStore.askBuoyStore.addUser("what is in storage");
34
+ const id = _askBuoyStore.askBuoyStore.startAssistant();
35
+ _askBuoyStore.askBuoyStore.applyEvent(id, {
36
+ type: "tool-start",
37
+ id: "c1",
38
+ toolId: "storage",
39
+ action: "async.getItem",
40
+ label: "Read session",
41
+ description: "Read one AsyncStorage key",
42
+ params: {
43
+ key: "session"
44
+ },
45
+ effect: "read"
46
+ });
47
+ _askBuoyStore.askBuoyStore.applyEvent(id, {
48
+ type: "tool-end",
49
+ id: "c1",
50
+ ok: true,
51
+ durationMs: 12,
52
+ summary: "eyJhbGciOiJIUzI1NiJ9.super.secret"
53
+ });
54
+ const snap = _askBuoySyncAdapter.askBuoySyncAdapter.getSnapshot();
55
+ const call = snap.messages[1].toolCalls[0];
56
+ (0, _vitest.expect)(call).toEqual({
57
+ toolId: "storage",
58
+ action: "async.getItem",
59
+ status: "ok"
60
+ });
61
+ // The result summary is not on the wire at all — there is no field for it.
62
+ (0, _vitest.expect)(JSON.stringify(snap)).not.toContain("super.secret");
63
+ });
64
+ (0, _vitest.it)("redacts credentials that made it into the assistant's prose", () => {
65
+ _askBuoyStore.askBuoyStore.addUser("show me the auth header");
66
+ const id = _askBuoyStore.askBuoyStore.startAssistant();
67
+ _askBuoyStore.askBuoyStore.applyEvent(id, {
68
+ type: "text",
69
+ delta: "It sends Authorization: Bearer abcdef0123456789ghijkl to the API."
70
+ });
71
+ const snap = _askBuoySyncAdapter.askBuoySyncAdapter.getSnapshot();
72
+ (0, _vitest.expect)(JSON.stringify(snap)).not.toContain("abcdef0123456789ghijkl");
73
+ });
74
+ (0, _vitest.it)("reports reversible and permanent changes separately", () => {
75
+ const ledger = new _agentCore.EffectLedger();
76
+ _askBuoyStore.askBuoyStore.setLedger(ledger);
77
+ ledger.record("storage", "async.setItem", {
78
+ kind: "storage-write",
79
+ toolId: "storage",
80
+ action: "async.setItem",
81
+ key: "points",
82
+ before: "240",
83
+ label: "Set points to 1500"
84
+ });
85
+ ledger.record("perf-monitor", "clearAll", {
86
+ kind: "transient",
87
+ label: "Cleared samples"
88
+ });
89
+ // A store write with no captured prior state: recorded, visible, and
90
+ // NOT something Undo can deliver — it must count as permanent.
91
+ ledger.record("zustand", "setState", {
92
+ kind: "state-write",
93
+ toolId: "zustand",
94
+ action: "setState",
95
+ label: "Update the cart store"
96
+ });
97
+ const snap = _askBuoySyncAdapter.askBuoySyncAdapter.getSnapshot();
98
+ (0, _vitest.expect)(snap.changes.reversible).toBe(1);
99
+ // The transient is an ACTION, not a change — it must not inflate
100
+ // "permanent" (that read "Changed this app · N permanent" after a
101
+ // read-only tour). It is still reported, in its own count.
102
+ (0, _vitest.expect)(snap.changes.permanent).toBe(1);
103
+ (0, _vitest.expect)(snap.changes.transients).toBe(1);
104
+ });
105
+ });
106
+ (0, _vitest.describe)("redactForWire", () => {
107
+ (0, _vitest.it)("removes bearer tokens, JWTs, api keys and license keys", () => {
108
+ const cases = ["Authorization: Bearer abcdefghijklmnop123456", "token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9abcdefgh", "key sk-abcdefghijklmnop1234", "license BUOY-ABCD-1234-EFGH", 'the header is "x-api-key": "supersecretvalue"'];
109
+ for (const input of cases) {
110
+ (0, _vitest.expect)((0, _wire.redactForWire)(input)).toContain("removed]");
111
+ }
112
+ });
113
+ (0, _vitest.it)("leaves ordinary prose alone", () => {
114
+ const text = "The /menu call returned 200 with 12 items and the burger was in stock.";
115
+ (0, _vitest.expect)((0, _wire.redactForWire)(text)).toBe(text);
116
+ });
117
+ });
118
+ (0, _vitest.describe)("undo from the desktop", () => {
119
+ (0, _vitest.it)("is allowed, because putting things back is the safe direction", async () => {
120
+ const ledger = new _agentCore.EffectLedger();
121
+ _askBuoyStore.askBuoyStore.setLedger(ledger);
122
+ const store = new Map([["points", "1500"]]);
123
+ ledger.record("storage", "async.setItem", {
124
+ kind: "storage-write",
125
+ toolId: "storage",
126
+ action: "async.setItem",
127
+ key: "points",
128
+ before: "240",
129
+ label: "Set points to 1500"
130
+ });
131
+
132
+ // The adapter dispatches through the real seam; stub it at the ledger.
133
+ await ledger.revertAll(async (_t, action, params) => {
134
+ const p = params;
135
+ if (action === "async.setItem") store.set(p.key, p.value);
136
+ return undefined;
137
+ });
138
+ (0, _vitest.expect)(store.get("points")).toBe("240");
139
+ });
140
+ });
141
+ //# sourceMappingURL=askBuoySyncAdapter.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_vitest","require","_agentCore","_askBuoySyncAdapter","_wire","_askBuoyStore","beforeEach","askBuoyStore","reset","setLedger","describe","it","actions","Object","keys","askBuoySyncAdapter","expect","not","toContain","sort","toEqual","addUser","id","startAssistant","applyEvent","type","toolId","action","label","description","params","key","effect","ok","durationMs","summary","snap","getSnapshot","call","messages","toolCalls","status","JSON","stringify","delta","ledger","EffectLedger","record","kind","before","changes","reversible","toBe","permanent","transients","cases","input","redactForWire","text","store","Map","revertAll","_t","p","set","value","undefined","get"],"sourceRoot":"../../../src","sources":["sync/askBuoySyncAdapter.test.ts"],"mappings":";;AASA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAEA,IAAAE,mBAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,IAAAK,kBAAU,EAAC,MAAM;EACfC,0BAAY,CAACC,KAAK,CAAC,CAAC;EACpBD,0BAAY,CAACE,SAAS,CAAC,IAAI,CAAC;AAC9B,CAAC,CAAC;AAEF,IAAAC,gBAAQ,EAAC,kBAAkB,EAAE,MAAM;EACjC,IAAAC,UAAE,EAAC,gDAAgD,EAAE,MAAM;IACzD;IACA;IACA,MAAMC,OAAO,GAAGC,MAAM,CAACC,IAAI,CAACC,sCAAkB,CAACH,OAAO,CAAC;IACvD,IAAAI,cAAM,EAACJ,OAAO,CAAC,CAACK,GAAG,CAACC,SAAS,CAAC,MAAM,CAAC;IACrC,IAAAF,cAAM,EAACJ,OAAO,CAAC,CAACK,GAAG,CAACC,SAAS,CAAC,KAAK,CAAC;IACpC,IAAAF,cAAM,EAACJ,OAAO,CAAC,CAACK,GAAG,CAACC,SAAS,CAAC,QAAQ,CAAC;IACvC,IAAAF,cAAM,EAACJ,OAAO,CAACO,IAAI,CAAC,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC,aAAa,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;EACrE,CAAC,CAAC;EAEF,IAAAT,UAAE,EAAC,qEAAqE,EAAE,MAAM;IAC9EJ,0BAAY,CAACc,OAAO,CA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AMiC,CAAC,GAAGjC,MAAyC;MACnD,IAAIH,MAAM,KAAK,eAAe,EAAEgC,KAAK,CAACK,GAAG,CAACD,CAAC,CAAChC,GAAG,EAAEgC,CAAC,CAACE,KAAM,CAAC;MAC1D,OAAOC,SAAS;IAClB,CAAC,CAAC;IAEF,IAAAlD,cAAM,EAAC2C,KAAK,CAACQ,GAAG,CAAC,QAAQ,CAAC,CAAC,CAACf,IAAI,CAAC,KAAK,CAAC;EACzC,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1 +1,58 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"dispatchToolAction",{enumerable:!0,get:function(){return _sharedUi.dispatchToolAction}}),exports.redactForWire=redactForWire;var _sharedUi=require("@buoy-gg/shared-ui");const PATTERNS=[{re:/\bBearer\s+[A-Za-z0-9._~+/-]{12,}=*/gi,label:"[bearer token removed]"},{re:/\beyJ[A-Za-z0-9._-]{20,}/g,label:"[jwt removed]"},{re:/\bsk-[A-Za-z0-9_-]{16,}/g,label:"[api key removed]"},{re:/\bBUOY-[A-Z0-9-]{8,}/g,label:"[license key removed]"},{re:/("|')?(authorization|x-api-key|api[_-]?key|password|secret|access_token|refresh_token)\1?\s*[:=]\s*("|')?[^\s"',}]{6,}/gi,label:"[credential removed]"}];function redactForWire(e){if(!e)return e;let r=e;for(const{re:e,label:o}of PATTERNS)r=r.replace(e,o);return r}
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "dispatchToolAction", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _sharedUi.dispatchToolAction;
10
+ }
11
+ });
12
+ exports.redactForWire = redactForWire;
13
+ var _sharedUi = require("@buoy-gg/shared-ui");
14
+ /**
15
+ * What the sync adapter is allowed to put on the broker wire.
16
+ *
17
+ * The broker has no authentication, `cors.origin: "*"`, binds every interface,
18
+ * and forwards to every connected dashboard — it already broadcasts each
19
+ * device's license key to every socket. A chat transcript is not a safe thing
20
+ * to add to that channel unfiltered: the agent reads storage values, network
21
+ * response bodies and user records, and any of it can end up quoted in an
22
+ * answer.
23
+ *
24
+ * So text crossing the wire is scrubbed for the shapes that are unambiguously
25
+ * credentials. This is a reduction in blast radius, not a guarantee — the real
26
+ * guarantee is that tool RESULTS never cross at all (see askBuoySyncAdapter).
27
+ */
28
+
29
+ const PATTERNS = [{
30
+ re: /\bBearer\s+[A-Za-z0-9._~+/-]{12,}=*/gi,
31
+ label: "[bearer token removed]"
32
+ }, {
33
+ re: /\beyJ[A-Za-z0-9._-]{20,}/g,
34
+ label: "[jwt removed]"
35
+ }, {
36
+ re: /\bsk-[A-Za-z0-9_-]{16,}/g,
37
+ label: "[api key removed]"
38
+ }, {
39
+ re: /\bBUOY-[A-Z0-9-]{8,}/g,
40
+ label: "[license key removed]"
41
+ },
42
+ // Common "key: value" credential shapes in a quoted payload.
43
+ {
44
+ re: /("|')?(authorization|x-api-key|api[_-]?key|password|secret|access_token|refresh_token)\1?\s*[:=]\s*("|')?[^\s"',}]{6,}/gi,
45
+ label: "[credential removed]"
46
+ }];
47
+ function redactForWire(text) {
48
+ if (!text) return text;
49
+ let out = text;
50
+ for (const {
51
+ re,
52
+ label
53
+ } of PATTERNS) {
54
+ out = out.replace(re, label);
55
+ }
56
+ return out;
57
+ }
58
+ //# sourceMappingURL=wire.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_sharedUi","require","PATTERNS","re","label","redactForWire","text","out","replace"],"sourceRoot":"../../../src","sources":["sync/wire.ts"],"mappings":";;;;;;;;;;;;AAcA,IAAAA,SAAA,GAAAC,OAAA;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,MAAMC,QAAyC,GAAG,CAChD;EAAEC,EAAE,EAAE,uCAAuC;EAAEC,KAAK,EAAE;AAAyB,CAAC,EAChF;EAAED,EAAE,EAAE,2BAA2B;EAAEC,KAAK,EAAE;AAAgB,CAAC,EAC3D;EAAED,EAAE,EAAE,0BAA0B;EAAEC,KAAK,EAAE;AAAoB,CAAC,EAC9D;EAAED,EAAE,EAAE,uBAAuB;EAAEC,KAAK,EAAE;AAAwB,CAAC;AAC/D;AACA;EACED,EAAE,EAAE,0HAA0H;EAC9HC,KAAK,EAAE;AACT,CAAC,CACF;AAEM,SAASC,aAAaA,CAACC,IAAY,EAAU;EAClD,IAAI,CAACA,IAAI,EAAE,OAAOA,IAAI;EACtB,IAAIC,GAAG,GAAGD,IAAI;EACd,KAAK,MAAM;IAAEH,EAAE;IAAEC;EAAM,CAAC,IAAIF,QAAQ,EAAE;IACpCK,GAAG,GAAGA,GAAG,CAACC,OAAO,CAACL,EAAE,EAAEC,KAAK,CAAC;EAC9B;EACA,OAAOG,GAAG;AACZ","ignoreList":[]}
@@ -1 +1,6 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
@@ -1 +1,331 @@
1
- "use strict";import{useState}from"react";import{Pressable,StyleSheet,Text,TextInput,View}from"react-native";import{Check,ChevronRight,night}from"@buoy-gg/shared-ui";import{useBlockHandlers}from"./context";import{BlockIcon}from"./icons";import{Card}from"./primitives";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";export function Choice({block:e}){const t=useBlockHandlers(),o=t.answered[e.id],n="choice"===o?.kind?o.optionId:null,i=!!o;return _jsxs(Card,{testID:`buoy-block-choice-${e.id}`,tone:i?void 0:"info",children:[_jsx(Text,{style:styles.question,children:e.question}),_jsx(View,{style:styles.options,children:e.options.slice(0,5).map((o,l)=>{const s=n===o.id;return _jsxs(Pressable,{testID:`buoy-block-option-${o.id}`,accessibilityRole:"button",accessibilityState:{selected:s,disabled:i},disabled:i,onPress:()=>t.answer({blockId:e.id,kind:"choice",optionId:o.id,label:o.label}),style:({pressed:e})=>[styles.option,l>0&&styles.optionDivider,s&&styles.optionChosen,i&&!s&&styles.optionDimmed,e&&!i&&styles.pressed],children:[o.icon?_jsx(BlockIcon,{name:o.icon}):null,_jsxs(View,{style:styles.optionText,children:[_jsx(Text,{style:[styles.optionLabel,s&&styles.optionLabelChosen],children:o.label}),o.detail?_jsx(Text,{style:styles.optionDetail,children:o.detail}):null]}),s?_jsx(Check,{size:14,color:night.color.accent}):i?null:_jsx(ChevronRight,{size:14,color:night.color.textTertiary})]},o.id)})}),i||!1===e.allowFreeText?null:_jsx(Text,{style:styles.hint,children:"Or just type your answer below."})]})}export function Confirm({block:e}){const t=useBlockHandlers(),o=t.answered[e.id],n=!!o,i="confirm"===o?.kind?o.approved:null;return _jsxs(Card,{testID:`buoy-block-confirm-${e.id}`,tone:n?void 0:"warning",children:[_jsx(Text,{style:styles.confirmTitle,children:e.title}),_jsx(Text,{style:styles.confirmChange,children:e.change}),e.consequence?_jsx(Text,{style:styles.confirmConsequence,children:e.consequence}):null,_jsx(View,{style:styles.confirmActions,children:n?_jsx(Text,{style:styles.decided,children:i?`✓ ${e.approveLabel??"Done"}`:`✕ ${e.declineLabel??"Not now"}`}):_jsxs(_Fragment,{children:[_jsx(Pressable,{testID:"buoy-block-approve",accessibilityRole:"button",onPress:()=>t.answer({blockId:e.id,kind:"confirm",approved:!0}),style:({pressed:e})=>[styles.button,styles.buttonPrimary,e&&styles.pressed],children:_jsx(Text,{style:styles.buttonTextPrimary,children:e.approveLabel??"Do it"})}),_jsx(Pressable,{testID:"buoy-block-decline",accessibilityRole:"button",onPress:()=>t.answer({blockId:e.id,kind:"confirm",approved:!1}),style:({pressed:e})=>[styles.button,styles.buttonPlate,e&&styles.pressed],children:_jsx(Text,{style:styles.buttonTextPlate,children:e.declineLabel??"Not now"})})]})})]})}export function Input({block:e}){const t=useBlockHandlers(),o=t.answered[e.id],n=!!o,[i,l]=useState(""),s="secret"===e.type,r=()=>{const o=i.trim();o&&t.answer({blockId:e.id,kind:"input",value:o})};return _jsxs(Card,{testID:`buoy-block-input-${e.id}`,tone:n?void 0:"info",children:[_jsx(Text,{style:styles.question,children:e.label}),n?_jsx(Text,{style:styles.decided,children:"input"===o.kind?s?"••••••":o.value:"(skipped)"}):_jsxs(View,{style:styles.inputRow,children:[_jsx(TextInput,{testID:"buoy-block-input-field",style:styles.input,value:i,onChangeText:l,placeholder:e.placeholder??"",placeholderTextColor:night.color.placeholder,keyboardType:"number"===e.type?"numeric":"ascii-capable",secureTextEntry:s,autoCapitalize:"none",autoCorrect:!1,returnKeyType:"send",onSubmitEditing:r}),_jsx(Pressable,{testID:"buoy-block-input-submit",accessibilityRole:"button",disabled:!i.trim(),onPress:r,style:({pressed:e})=>[styles.button,styles.buttonPrimary,!i.trim()&&styles.buttonDisabled,e&&styles.pressed],children:_jsx(Text,{style:styles.buttonTextPrimary,children:e.submitLabel??"Send"})})]})]})}const styles=StyleSheet.create({question:{color:night.color.text,fontSize:night.font.row,fontWeight:"600",lineHeight:20,paddingHorizontal:12,paddingTop:12,paddingBottom:8},options:{marginHorizontal:8,marginBottom:8,borderRadius:night.radius.row,backgroundColor:night.color.surfaceElevated,overflow:"hidden"},option:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:12,paddingVertical:11},optionDivider:{borderTopWidth:StyleSheet.hairlineWidth,borderTopColor:night.color.separator},optionChosen:{backgroundColor:night.color.accentSoft},optionDimmed:{opacity:.45},optionText:{flex:1,gap:2},optionLabel:{color:night.color.text,fontSize:night.font.body,fontWeight:"500"},optionLabelChosen:{color:night.color.accent},optionDetail:{color:night.color.textSecondary,fontSize:night.font.caption,lineHeight:17},hint:{color:night.color.textTertiary,fontSize:night.font.micro,paddingHorizontal:12,paddingBottom:10},confirmTitle:{color:night.color.text,fontSize:night.font.row,fontWeight:"600",paddingHorizontal:12,paddingTop:12},confirmChange:{color:night.color.text,fontSize:night.font.body,lineHeight:19,paddingHorizontal:12,paddingTop:6},confirmConsequence:{color:night.color.warning,fontSize:night.font.caption,lineHeight:17,paddingHorizontal:12,paddingTop:6},confirmActions:{flexDirection:"row",gap:8,paddingHorizontal:12,paddingVertical:12,alignItems:"center"},decided:{color:night.color.textSecondary,fontSize:night.font.caption,fontWeight:"600",paddingHorizontal:12,paddingVertical:10},inputRow:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:12,paddingBottom:12},input:{flex:1,height:38,paddingHorizontal:12,borderRadius:night.radius.row,backgroundColor:night.color.surfaceElevated,color:night.color.text,fontSize:night.font.body},button:{paddingHorizontal:14,paddingVertical:9,borderRadius:night.radius.row},buttonPrimary:{backgroundColor:night.color.accent},buttonPlate:{backgroundColor:night.color.button},buttonDisabled:{opacity:.5},buttonTextPrimary:{color:night.color.onAccent,fontSize:night.font.caption,fontWeight:"600"},buttonTextPlate:{color:night.color.text,fontSize:night.font.caption,fontWeight:"600"},pressed:{opacity:.7}});
1
+ "use strict";
2
+
3
+ /**
4
+ * Ask blocks — the user has to decide, and the turn is waiting.
5
+ *
6
+ * Choice, Confirm and Input all lock once answered: the chosen option stays
7
+ * highlighted, the rest dim, and nothing in history is tappable twice. The
8
+ * answer is handed to the sheet as a BlockAnswer and becomes the next user
9
+ * message, so the model reads plain words ("Business checkout"), never JSON.
10
+ */
11
+ import { useState } from "react";
12
+ import { Pressable, StyleSheet, Text, TextInput, View } from "react-native";
13
+ import { Check, ChevronRight, night } from "@buoy-gg/shared-ui";
14
+ import { useBlockHandlers } from "./context";
15
+ import { BlockIcon } from "./icons";
16
+ import { Card } from "./primitives";
17
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
18
+ export function Choice({
19
+ block
20
+ }) {
21
+ const h = useBlockHandlers();
22
+ const answer = h.answered[block.id];
23
+ const chosen = answer?.kind === "choice" ? answer.optionId : null;
24
+ const locked = !!answer;
25
+ return /*#__PURE__*/_jsxs(Card, {
26
+ testID: `buoy-block-choice-${block.id}`,
27
+ tone: locked ? undefined : "info",
28
+ children: [/*#__PURE__*/_jsx(Text, {
29
+ style: styles.question,
30
+ children: block.question
31
+ }), /*#__PURE__*/_jsx(View, {
32
+ style: styles.options,
33
+ children: block.options.slice(0, 5).map((o, i) => {
34
+ const isChosen = chosen === o.id;
35
+ return /*#__PURE__*/_jsxs(Pressable, {
36
+ testID: `buoy-block-option-${o.id}`,
37
+ accessibilityRole: "button",
38
+ accessibilityState: {
39
+ selected: isChosen,
40
+ disabled: locked
41
+ },
42
+ disabled: locked,
43
+ onPress: () => h.answer({
44
+ blockId: block.id,
45
+ kind: "choice",
46
+ optionId: o.id,
47
+ label: o.label
48
+ }),
49
+ style: ({
50
+ pressed
51
+ }) => [styles.option, i > 0 && styles.optionDivider, isChosen && styles.optionChosen, locked && !isChosen && styles.optionDimmed, pressed && !locked && styles.pressed],
52
+ children: [o.icon ? /*#__PURE__*/_jsx(BlockIcon, {
53
+ name: o.icon
54
+ }) : null, /*#__PURE__*/_jsxs(View, {
55
+ style: styles.optionText,
56
+ children: [/*#__PURE__*/_jsx(Text, {
57
+ style: [styles.optionLabel, isChosen && styles.optionLabelChosen],
58
+ children: o.label
59
+ }), o.detail ? /*#__PURE__*/_jsx(Text, {
60
+ style: styles.optionDetail,
61
+ children: o.detail
62
+ }) : null]
63
+ }), isChosen ? /*#__PURE__*/_jsx(Check, {
64
+ size: 14,
65
+ color: night.color.accent
66
+ }) : locked ? null : /*#__PURE__*/_jsx(ChevronRight, {
67
+ size: 14,
68
+ color: night.color.textTertiary
69
+ })]
70
+ }, o.id);
71
+ })
72
+ }), !locked && block.allowFreeText !== false ? /*#__PURE__*/_jsx(Text, {
73
+ style: styles.hint,
74
+ children: "Or just type your answer below."
75
+ }) : null]
76
+ });
77
+ }
78
+ export function Confirm({
79
+ block
80
+ }) {
81
+ const h = useBlockHandlers();
82
+ const answer = h.answered[block.id];
83
+ const locked = !!answer;
84
+ const approved = answer?.kind === "confirm" ? answer.approved : null;
85
+ return /*#__PURE__*/_jsxs(Card, {
86
+ testID: `buoy-block-confirm-${block.id}`,
87
+ tone: locked ? undefined : "warning",
88
+ children: [/*#__PURE__*/_jsx(Text, {
89
+ style: styles.confirmTitle,
90
+ children: block.title
91
+ }), /*#__PURE__*/_jsx(Text, {
92
+ style: styles.confirmChange,
93
+ children: block.change
94
+ }), block.consequence ? /*#__PURE__*/_jsx(Text, {
95
+ style: styles.confirmConsequence,
96
+ children: block.consequence
97
+ }) : null, /*#__PURE__*/_jsx(View, {
98
+ style: styles.confirmActions,
99
+ children: locked ? /*#__PURE__*/_jsx(Text, {
100
+ style: styles.decided,
101
+ children: approved ? `✓ ${block.approveLabel ?? "Done"}` : `✕ ${block.declineLabel ?? "Not now"}`
102
+ }) : /*#__PURE__*/_jsxs(_Fragment, {
103
+ children: [/*#__PURE__*/_jsx(Pressable, {
104
+ testID: "buoy-block-approve",
105
+ accessibilityRole: "button",
106
+ onPress: () => h.answer({
107
+ blockId: block.id,
108
+ kind: "confirm",
109
+ approved: true
110
+ }),
111
+ style: ({
112
+ pressed
113
+ }) => [styles.button, styles.buttonPrimary, pressed && styles.pressed],
114
+ children: /*#__PURE__*/_jsx(Text, {
115
+ style: styles.buttonTextPrimary,
116
+ children: block.approveLabel ?? "Do it"
117
+ })
118
+ }), /*#__PURE__*/_jsx(Pressable, {
119
+ testID: "buoy-block-decline",
120
+ accessibilityRole: "button",
121
+ onPress: () => h.answer({
122
+ blockId: block.id,
123
+ kind: "confirm",
124
+ approved: false
125
+ }),
126
+ style: ({
127
+ pressed
128
+ }) => [styles.button, styles.buttonPlate, pressed && styles.pressed],
129
+ children: /*#__PURE__*/_jsx(Text, {
130
+ style: styles.buttonTextPlate,
131
+ children: block.declineLabel ?? "Not now"
132
+ })
133
+ })]
134
+ })
135
+ })]
136
+ });
137
+ }
138
+ export function Input({
139
+ block
140
+ }) {
141
+ const h = useBlockHandlers();
142
+ const answer = h.answered[block.id];
143
+ const locked = !!answer;
144
+ const [value, setValue] = useState("");
145
+ const secret = block.type === "secret";
146
+ const submit = () => {
147
+ const v = value.trim();
148
+ if (!v) return;
149
+ h.answer({
150
+ blockId: block.id,
151
+ kind: "input",
152
+ value: v
153
+ });
154
+ };
155
+ return /*#__PURE__*/_jsxs(Card, {
156
+ testID: `buoy-block-input-${block.id}`,
157
+ tone: locked ? undefined : "info",
158
+ children: [/*#__PURE__*/_jsx(Text, {
159
+ style: styles.question,
160
+ children: block.label
161
+ }), locked ? /*#__PURE__*/_jsx(Text, {
162
+ style: styles.decided,
163
+ children: answer.kind === "input" ? secret ? "••••••" : answer.value : "(skipped)"
164
+ }) : /*#__PURE__*/_jsxs(View, {
165
+ style: styles.inputRow,
166
+ children: [/*#__PURE__*/_jsx(TextInput, {
167
+ testID: "buoy-block-input-field",
168
+ style: styles.input,
169
+ value: value,
170
+ onChangeText: setValue,
171
+ placeholder: block.placeholder ?? "",
172
+ placeholderTextColor: night.color.placeholder,
173
+ keyboardType: block.type === "number" ? "numeric" : "ascii-capable",
174
+ secureTextEntry: secret,
175
+ autoCapitalize: "none",
176
+ autoCorrect: false,
177
+ returnKeyType: "send",
178
+ onSubmitEditing: submit
179
+ }), /*#__PURE__*/_jsx(Pressable, {
180
+ testID: "buoy-block-input-submit",
181
+ accessibilityRole: "button",
182
+ disabled: !value.trim(),
183
+ onPress: submit,
184
+ style: ({
185
+ pressed
186
+ }) => [styles.button, styles.buttonPrimary, !value.trim() && styles.buttonDisabled, pressed && styles.pressed],
187
+ children: /*#__PURE__*/_jsx(Text, {
188
+ style: styles.buttonTextPrimary,
189
+ children: block.submitLabel ?? "Send"
190
+ })
191
+ })]
192
+ })]
193
+ });
194
+ }
195
+ const styles = StyleSheet.create({
196
+ question: {
197
+ color: night.color.text,
198
+ fontSize: night.font.row,
199
+ fontWeight: "600",
200
+ lineHeight: 20,
201
+ paddingHorizontal: 12,
202
+ paddingTop: 12,
203
+ paddingBottom: 8
204
+ },
205
+ options: {
206
+ marginHorizontal: 8,
207
+ marginBottom: 8,
208
+ borderRadius: night.radius.row,
209
+ backgroundColor: night.color.surfaceElevated,
210
+ overflow: "hidden"
211
+ },
212
+ option: {
213
+ flexDirection: "row",
214
+ alignItems: "center",
215
+ gap: 10,
216
+ paddingHorizontal: 12,
217
+ paddingVertical: 11
218
+ },
219
+ optionDivider: {
220
+ borderTopWidth: StyleSheet.hairlineWidth,
221
+ borderTopColor: night.color.separator
222
+ },
223
+ optionChosen: {
224
+ backgroundColor: night.color.accentSoft
225
+ },
226
+ optionDimmed: {
227
+ opacity: 0.45
228
+ },
229
+ optionText: {
230
+ flex: 1,
231
+ gap: 2
232
+ },
233
+ optionLabel: {
234
+ color: night.color.text,
235
+ fontSize: night.font.body,
236
+ fontWeight: "500"
237
+ },
238
+ optionLabelChosen: {
239
+ color: night.color.accent
240
+ },
241
+ optionDetail: {
242
+ color: night.color.textSecondary,
243
+ fontSize: night.font.caption,
244
+ lineHeight: 17
245
+ },
246
+ hint: {
247
+ color: night.color.textTertiary,
248
+ fontSize: night.font.micro,
249
+ paddingHorizontal: 12,
250
+ paddingBottom: 10
251
+ },
252
+ confirmTitle: {
253
+ color: night.color.text,
254
+ fontSize: night.font.row,
255
+ fontWeight: "600",
256
+ paddingHorizontal: 12,
257
+ paddingTop: 12
258
+ },
259
+ confirmChange: {
260
+ color: night.color.text,
261
+ fontSize: night.font.body,
262
+ lineHeight: 19,
263
+ paddingHorizontal: 12,
264
+ paddingTop: 6
265
+ },
266
+ confirmConsequence: {
267
+ color: night.color.warning,
268
+ fontSize: night.font.caption,
269
+ lineHeight: 17,
270
+ paddingHorizontal: 12,
271
+ paddingTop: 6
272
+ },
273
+ confirmActions: {
274
+ flexDirection: "row",
275
+ gap: 8,
276
+ paddingHorizontal: 12,
277
+ paddingVertical: 12,
278
+ alignItems: "center"
279
+ },
280
+ decided: {
281
+ color: night.color.textSecondary,
282
+ fontSize: night.font.caption,
283
+ fontWeight: "600",
284
+ paddingHorizontal: 12,
285
+ paddingVertical: 10
286
+ },
287
+ inputRow: {
288
+ flexDirection: "row",
289
+ alignItems: "center",
290
+ gap: 8,
291
+ paddingHorizontal: 12,
292
+ paddingBottom: 12
293
+ },
294
+ input: {
295
+ flex: 1,
296
+ height: 38,
297
+ paddingHorizontal: 12,
298
+ borderRadius: night.radius.row,
299
+ backgroundColor: night.color.surfaceElevated,
300
+ color: night.color.text,
301
+ fontSize: night.font.body
302
+ },
303
+ button: {
304
+ paddingHorizontal: 14,
305
+ paddingVertical: 9,
306
+ borderRadius: night.radius.row
307
+ },
308
+ buttonPrimary: {
309
+ backgroundColor: night.color.accent
310
+ },
311
+ buttonPlate: {
312
+ backgroundColor: night.color.button
313
+ },
314
+ buttonDisabled: {
315
+ opacity: 0.5
316
+ },
317
+ buttonTextPrimary: {
318
+ color: night.color.onAccent,
319
+ fontSize: night.font.caption,
320
+ fontWeight: "600"
321
+ },
322
+ buttonTextPlate: {
323
+ color: night.color.text,
324
+ fontSize: night.font.caption,
325
+ fontWeight: "600"
326
+ },
327
+ pressed: {
328
+ opacity: 0.7
329
+ }
330
+ });
331
+ //# sourceMappingURL=AskBlocks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useState","Pressable","StyleSheet","Text","TextInput","View","Check","ChevronRight","night","useBlockHandlers","BlockIcon","Card","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","Choice","block","h","answer","answered","id","chosen","kind","optionId","locked","testID","tone","undefined","children","style","styles","question","options","slice","map","o","i","isChosen","accessibilityRole","accessibilityState","selected","disabled","onPress","blockId","label","pressed","option","optionDivider","optionChosen","optionDimmed","icon","name","optionText","optionLabel","optionLabelChosen","detail","optionDetail","size","color","accent","textTertiary","allowFreeText","hint","Confirm","approved","confirmTitle","title","confirmChange","change","consequence","confirmConsequence","confirmActions","decided","approveLabel","declineLabel","button","buttonPrimary","buttonTextPrimary","buttonPlate","buttonTextPlate","Input","value","setValue","secret","type","submit","v","trim","inputRow","input","onChangeText","placeholder","placeholderTextColor","keyboardType","secureTextEntry","autoCapitalize","autoCorrect","returnKeyType","onSubmitEditing","buttonDisabled","submitLabel","create","text","fontSize","font","row","fontWeight","lineHeight","paddingHorizontal","paddingTop","paddingBottom","marginHorizontal","marginBottom","borderRadius","radius","backgroundColor","surfaceElevated","overflow","flexDirection","alignItems","gap","paddingVertical","borderTopWidth","hairlineWidth","borderTopColor","separator","accentSoft","opacity","flex","body","textSecondary","caption","micro","warning","height","onAccent"],"sourceRoot":"../../../src","sources":["blocks/AskBlocks.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,OAAO;AAChC,SAASC,SAAS,EAAEC,UAAU,EAAEC,IAAI,EAAEC,SAAS,EAAEC,IAAI,QAAQ,cAAc;AAC3E,SAASC,KAAK,EAAEC,YAAY,EAAEC,KAAK,QAAQ,oBAAoB;AAG/D,SAASC,gBAAgB,QAAQ,WAAW;AAC5C,SAASC,SAAS,QAAQ,SAAS;AACnC,SAASC,IAAI,QAAQ,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAEpC,OAAO,SAASC,MAAMA,CAAC;EAAEC;AAA8B,CAAC,EAAE;EACxD,MAAMC,CAAC,GAAGX,gBAAgB,CAAC,CAAC;EAC5B,MAAMY,MAAM,GAAGD,CAAC,CAACE,QAAQ,CAACH,KAAK,CAACI,EAAE,CAAC;EACnC,MAAMC,MAAM,GAAGH,MAAM,EAAEI,IAAI,KAAK,QAAQ,GAAGJ,MAAM,CAACK,QAAQ,GAAG,IAAI;EACjE,MAAMC,MAAM,GAAG,CAAC,CAACN,MAAM;EAEvB,oBACEN,KAAA,CAACJ,IAAI;IAACiB,MAAM,EAAE,qBAAqBT,KAAK,CAACI,EAAE,EAAG;IAACM,IAAI,EAAEF,MAAM,GAAGG,SAAS,GAAG,MAAO;IAAAC,QAAA,gBAC/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