@buoy-gg/ask-buoy 7.0.33

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 (184) hide show
  1. package/LICENSE +58 -0
  2. package/README.md +50 -0
  3. package/lib/commonjs/blocks/AskBlocks.js +338 -0
  4. package/lib/commonjs/blocks/AskBlocks.js.map +1 -0
  5. package/lib/commonjs/blocks/BlockRenderer.js +250 -0
  6. package/lib/commonjs/blocks/BlockRenderer.js.map +1 -0
  7. package/lib/commonjs/blocks/ChromePrototypes.js +514 -0
  8. package/lib/commonjs/blocks/ChromePrototypes.js.map +1 -0
  9. package/lib/commonjs/blocks/DataBlocks.js +545 -0
  10. package/lib/commonjs/blocks/DataBlocks.js.map +1 -0
  11. package/lib/commonjs/blocks/ExtraBlocks.js +1821 -0
  12. package/lib/commonjs/blocks/ExtraBlocks.js.map +1 -0
  13. package/lib/commonjs/blocks/MediaBlocks.js +140 -0
  14. package/lib/commonjs/blocks/MediaBlocks.js.map +1 -0
  15. package/lib/commonjs/blocks/ReceiptBlocks.js +596 -0
  16. package/lib/commonjs/blocks/ReceiptBlocks.js.map +1 -0
  17. package/lib/commonjs/blocks/context.js +42 -0
  18. package/lib/commonjs/blocks/context.js.map +1 -0
  19. package/lib/commonjs/blocks/icons.js +96 -0
  20. package/lib/commonjs/blocks/icons.js.map +1 -0
  21. package/lib/commonjs/blocks/index.js +95 -0
  22. package/lib/commonjs/blocks/index.js.map +1 -0
  23. package/lib/commonjs/blocks/primitives.js +312 -0
  24. package/lib/commonjs/blocks/primitives.js.map +1 -0
  25. package/lib/commonjs/blocks/primitivesIndex.js +56 -0
  26. package/lib/commonjs/blocks/primitivesIndex.js.map +1 -0
  27. package/lib/commonjs/components/ApprovalCard.js +140 -0
  28. package/lib/commonjs/components/ApprovalCard.js.map +1 -0
  29. package/lib/commonjs/components/AskBuoyHeader.js +127 -0
  30. package/lib/commonjs/components/AskBuoyHeader.js.map +1 -0
  31. package/lib/commonjs/components/AskBuoyIcon.js +19 -0
  32. package/lib/commonjs/components/AskBuoyIcon.js.map +1 -0
  33. package/lib/commonjs/components/AskBuoyModal.js +322 -0
  34. package/lib/commonjs/components/AskBuoyModal.js.map +1 -0
  35. package/lib/commonjs/components/ChangesBar.js +211 -0
  36. package/lib/commonjs/components/ChangesBar.js.map +1 -0
  37. package/lib/commonjs/components/Composer.js +175 -0
  38. package/lib/commonjs/components/Composer.js.map +1 -0
  39. package/lib/commonjs/components/EmptyState.js +154 -0
  40. package/lib/commonjs/components/EmptyState.js.map +1 -0
  41. package/lib/commonjs/components/Markdown.js +252 -0
  42. package/lib/commonjs/components/Markdown.js.map +1 -0
  43. package/lib/commonjs/components/MessageList.js +648 -0
  44. package/lib/commonjs/components/MessageList.js.map +1 -0
  45. package/lib/commonjs/components/TypingDots.js +63 -0
  46. package/lib/commonjs/components/TypingDots.js.map +1 -0
  47. package/lib/commonjs/index.js +205 -0
  48. package/lib/commonjs/index.js.map +1 -0
  49. package/lib/commonjs/package.json +1 -0
  50. package/lib/commonjs/preset.js +90 -0
  51. package/lib/commonjs/preset.js.map +1 -0
  52. package/lib/commonjs/store/askBuoyStore.js +279 -0
  53. package/lib/commonjs/store/askBuoyStore.js.map +1 -0
  54. package/lib/commonjs/store/useAskBuoy.js +299 -0
  55. package/lib/commonjs/store/useAskBuoy.js.map +1 -0
  56. package/lib/commonjs/sync/askBuoySyncAdapter.js +119 -0
  57. package/lib/commonjs/sync/askBuoySyncAdapter.js.map +1 -0
  58. package/lib/commonjs/sync/askBuoySyncAdapter.test.js +136 -0
  59. package/lib/commonjs/sync/askBuoySyncAdapter.test.js.map +1 -0
  60. package/lib/commonjs/sync/wire.js +58 -0
  61. package/lib/commonjs/sync/wire.js.map +1 -0
  62. package/lib/commonjs/types.js +6 -0
  63. package/lib/commonjs/types.js.map +1 -0
  64. package/lib/module/blocks/AskBlocks.js +331 -0
  65. package/lib/module/blocks/AskBlocks.js.map +1 -0
  66. package/lib/module/blocks/BlockRenderer.js +245 -0
  67. package/lib/module/blocks/BlockRenderer.js.map +1 -0
  68. package/lib/module/blocks/ChromePrototypes.js +503 -0
  69. package/lib/module/blocks/ChromePrototypes.js.map +1 -0
  70. package/lib/module/blocks/DataBlocks.js +532 -0
  71. package/lib/module/blocks/DataBlocks.js.map +1 -0
  72. package/lib/module/blocks/ExtraBlocks.js +1794 -0
  73. package/lib/module/blocks/ExtraBlocks.js.map +1 -0
  74. package/lib/module/blocks/MediaBlocks.js +135 -0
  75. package/lib/module/blocks/MediaBlocks.js.map +1 -0
  76. package/lib/module/blocks/ReceiptBlocks.js +584 -0
  77. package/lib/module/blocks/ReceiptBlocks.js.map +1 -0
  78. package/lib/module/blocks/context.js +35 -0
  79. package/lib/module/blocks/context.js.map +1 -0
  80. package/lib/module/blocks/icons.js +91 -0
  81. package/lib/module/blocks/icons.js.map +1 -0
  82. package/lib/module/blocks/index.js +8 -0
  83. package/lib/module/blocks/index.js.map +1 -0
  84. package/lib/module/blocks/primitives.js +301 -0
  85. package/lib/module/blocks/primitives.js.map +1 -0
  86. package/lib/module/blocks/primitivesIndex.js +5 -0
  87. package/lib/module/blocks/primitivesIndex.js.map +1 -0
  88. package/lib/module/components/ApprovalCard.js +135 -0
  89. package/lib/module/components/ApprovalCard.js.map +1 -0
  90. package/lib/module/components/AskBuoyHeader.js +124 -0
  91. package/lib/module/components/AskBuoyHeader.js.map +1 -0
  92. package/lib/module/components/AskBuoyIcon.js +8 -0
  93. package/lib/module/components/AskBuoyIcon.js.map +1 -0
  94. package/lib/module/components/AskBuoyModal.js +317 -0
  95. package/lib/module/components/AskBuoyModal.js.map +1 -0
  96. package/lib/module/components/ChangesBar.js +206 -0
  97. package/lib/module/components/ChangesBar.js.map +1 -0
  98. package/lib/module/components/Composer.js +170 -0
  99. package/lib/module/components/Composer.js.map +1 -0
  100. package/lib/module/components/EmptyState.js +149 -0
  101. package/lib/module/components/EmptyState.js.map +1 -0
  102. package/lib/module/components/Markdown.js +246 -0
  103. package/lib/module/components/Markdown.js.map +1 -0
  104. package/lib/module/components/MessageList.js +642 -0
  105. package/lib/module/components/MessageList.js.map +1 -0
  106. package/lib/module/components/TypingDots.js +58 -0
  107. package/lib/module/components/TypingDots.js.map +1 -0
  108. package/lib/module/index.js +29 -0
  109. package/lib/module/index.js.map +1 -0
  110. package/lib/module/preset.js +73 -0
  111. package/lib/module/preset.js.map +1 -0
  112. package/lib/module/store/askBuoyStore.js +275 -0
  113. package/lib/module/store/askBuoyStore.js.map +1 -0
  114. package/lib/module/store/useAskBuoy.js +293 -0
  115. package/lib/module/store/useAskBuoy.js.map +1 -0
  116. package/lib/module/sync/askBuoySyncAdapter.js +114 -0
  117. package/lib/module/sync/askBuoySyncAdapter.js.map +1 -0
  118. package/lib/module/sync/askBuoySyncAdapter.test.js +135 -0
  119. package/lib/module/sync/askBuoySyncAdapter.test.js.map +1 -0
  120. package/lib/module/sync/wire.js +47 -0
  121. package/lib/module/sync/wire.js.map +1 -0
  122. package/lib/module/types.js +4 -0
  123. package/lib/module/types.js.map +1 -0
  124. package/lib/typescript/blocks/AskBlocks.d.ts +11 -0
  125. package/lib/typescript/blocks/AskBlocks.d.ts.map +1 -0
  126. package/lib/typescript/blocks/BlockRenderer.d.ts +5 -0
  127. package/lib/typescript/blocks/BlockRenderer.d.ts.map +1 -0
  128. package/lib/typescript/blocks/ChromePrototypes.d.ts +27 -0
  129. package/lib/typescript/blocks/ChromePrototypes.d.ts.map +1 -0
  130. package/lib/typescript/blocks/DataBlocks.d.ts +29 -0
  131. package/lib/typescript/blocks/DataBlocks.d.ts.map +1 -0
  132. package/lib/typescript/blocks/ExtraBlocks.d.ts +69 -0
  133. package/lib/typescript/blocks/ExtraBlocks.d.ts.map +1 -0
  134. package/lib/typescript/blocks/MediaBlocks.d.ts +5 -0
  135. package/lib/typescript/blocks/MediaBlocks.d.ts.map +1 -0
  136. package/lib/typescript/blocks/ReceiptBlocks.d.ts +27 -0
  137. package/lib/typescript/blocks/ReceiptBlocks.d.ts.map +1 -0
  138. package/lib/typescript/blocks/context.d.ts +35 -0
  139. package/lib/typescript/blocks/context.d.ts.map +1 -0
  140. package/lib/typescript/blocks/icons.d.ts +6 -0
  141. package/lib/typescript/blocks/icons.d.ts.map +1 -0
  142. package/lib/typescript/blocks/index.d.ts +6 -0
  143. package/lib/typescript/blocks/index.d.ts.map +1 -0
  144. package/lib/typescript/blocks/primitives.d.ts +85 -0
  145. package/lib/typescript/blocks/primitives.d.ts.map +1 -0
  146. package/lib/typescript/blocks/primitivesIndex.d.ts +3 -0
  147. package/lib/typescript/blocks/primitivesIndex.d.ts.map +1 -0
  148. package/lib/typescript/components/ApprovalCard.d.ts +7 -0
  149. package/lib/typescript/components/ApprovalCard.d.ts.map +1 -0
  150. package/lib/typescript/components/AskBuoyHeader.d.ts +14 -0
  151. package/lib/typescript/components/AskBuoyHeader.d.ts.map +1 -0
  152. package/lib/typescript/components/AskBuoyIcon.d.ts +6 -0
  153. package/lib/typescript/components/AskBuoyIcon.d.ts.map +1 -0
  154. package/lib/typescript/components/AskBuoyModal.d.ts +13 -0
  155. package/lib/typescript/components/AskBuoyModal.d.ts.map +1 -0
  156. package/lib/typescript/components/ChangesBar.d.ts +9 -0
  157. package/lib/typescript/components/ChangesBar.d.ts.map +1 -0
  158. package/lib/typescript/components/Composer.d.ts +9 -0
  159. package/lib/typescript/components/Composer.d.ts.map +1 -0
  160. package/lib/typescript/components/EmptyState.d.ts +6 -0
  161. package/lib/typescript/components/EmptyState.d.ts.map +1 -0
  162. package/lib/typescript/components/Markdown.d.ts +23 -0
  163. package/lib/typescript/components/Markdown.d.ts.map +1 -0
  164. package/lib/typescript/components/MessageList.d.ts +18 -0
  165. package/lib/typescript/components/MessageList.d.ts.map +1 -0
  166. package/lib/typescript/components/TypingDots.d.ts +2 -0
  167. package/lib/typescript/components/TypingDots.d.ts.map +1 -0
  168. package/lib/typescript/index.d.ts +28 -0
  169. package/lib/typescript/index.d.ts.map +1 -0
  170. package/lib/typescript/preset.d.ts +61 -0
  171. package/lib/typescript/preset.d.ts.map +1 -0
  172. package/lib/typescript/store/askBuoyStore.d.ts +124 -0
  173. package/lib/typescript/store/askBuoyStore.d.ts.map +1 -0
  174. package/lib/typescript/store/useAskBuoy.d.ts +22 -0
  175. package/lib/typescript/store/useAskBuoy.d.ts.map +1 -0
  176. package/lib/typescript/sync/askBuoySyncAdapter.d.ts +73 -0
  177. package/lib/typescript/sync/askBuoySyncAdapter.d.ts.map +1 -0
  178. package/lib/typescript/sync/askBuoySyncAdapter.test.d.ts +2 -0
  179. package/lib/typescript/sync/askBuoySyncAdapter.test.d.ts.map +1 -0
  180. package/lib/typescript/sync/wire.d.ts +17 -0
  181. package/lib/typescript/sync/wire.d.ts.map +1 -0
  182. package/lib/typescript/types.d.ts +119 -0
  183. package/lib/typescript/types.d.ts.map +1 -0
  184. package/package.json +83 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preset.d.ts","sourceRoot":"","sources":["../../src/preset.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC;AAE5C,eAAO,MAAM,iBAAiB;;;;;;4BAUJ;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;;CAIzD,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB;;;uBAOpC,iBAAiB;;;;4BAlCd;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;EAsCzD"}
@@ -0,0 +1,124 @@
1
+ /**
2
+ * Conversation state for the sheet.
3
+ *
4
+ * A module-level store rather than component state for two reasons: the sheet
5
+ * is unmounted whenever the tool is closed or minimised (and a conversation
6
+ * that vanished because someone tapped away would be maddening), and the sync
7
+ * adapter needs to read the same transcript to show it on the desktop.
8
+ *
9
+ * Deliberately NOT persisted. A transcript can contain anything the agent read
10
+ * — storage values, response bodies, a customer's record — and writing that to
11
+ * disk under a Buoy key would put it in the Storage tool and, from there, on
12
+ * the unauthenticated broker wire. It lives for the session and no longer.
13
+ */
14
+ import type { Block, BlockAnswer, AskBuoySession, EffectLedger, TurnEvent } from "@buoy-gg/agent-core";
15
+ /** A block in a message, and (for receipts) the tool call that produced it. */
16
+ export interface PlacedBlock {
17
+ block: Block;
18
+ forToolCallId?: string;
19
+ }
20
+ export interface ChatToolCall {
21
+ id: string;
22
+ toolId: string;
23
+ action: string;
24
+ /** Short human title — "Open /bag". */
25
+ label: string;
26
+ /** The catalog's fuller sentence, shown when the row is expanded. */
27
+ description?: string;
28
+ status: "running" | "ok" | "failed" | "refused";
29
+ /** Trailing status word once finished — "12 items", "Not found", "Done". */
30
+ summary?: string;
31
+ }
32
+ export interface ChatMessage {
33
+ id: string;
34
+ role: "user" | "assistant";
35
+ text: string;
36
+ toolCalls: ChatToolCall[];
37
+ /** Rich blocks — receipts from tool results and model-authored blocks. */
38
+ blocks: PlacedBlock[];
39
+ /** Set while the assistant is still streaming this message. */
40
+ streaming?: boolean;
41
+ error?: string;
42
+ /**
43
+ * True once a tool call has run and no narration has arrived since.
44
+ *
45
+ * One assistant "message" in this UI spans every turn of a multi-step run,
46
+ * so each turn's narration lands in the same bubble. Without a boundary they
47
+ * run together — "Taking you to the shop.Waiting for the menu.Opening Fire
48
+ * Grill." A tool event is the only reliable marker of a turn edge, because
49
+ * the engine emits them between turns and never inside one.
50
+ */
51
+ breakBeforeNextText?: boolean;
52
+ }
53
+ export interface PendingApproval {
54
+ id: string;
55
+ toolId: string;
56
+ action: string;
57
+ label: string;
58
+ description?: string;
59
+ reason: string;
60
+ resolve: (approved: boolean) => void;
61
+ }
62
+ export interface AskBuoyState {
63
+ messages: ChatMessage[];
64
+ busy: boolean;
65
+ pending: PendingApproval | null;
66
+ /** Set when the tool is unconfigured or the endpoint keeps failing. */
67
+ notice: string | null;
68
+ /** Whether the host app wired an endpoint + model. Set by the sheet's hook. */
69
+ configured: boolean;
70
+ /** Answers given to Ask blocks, by block id. Answered blocks lock. */
71
+ answers: Record<string, BlockAnswer>;
72
+ /** The Ask block the turn stopped on, until it is answered or skipped. */
73
+ awaitingBlockId: string | null;
74
+ /** Run state of block action buttons, keyed `${blockId}:${label}`. */
75
+ actionState: Record<string, "running" | "done" | "failed">;
76
+ /** A message typed while a turn was running; sent when the turn finishes. */
77
+ queued: string | null;
78
+ /** Session token totals, accumulated from provider usage reports. */
79
+ usage: {
80
+ input: number;
81
+ output: number;
82
+ requests: number;
83
+ };
84
+ }
85
+ type Listener = () => void;
86
+ export declare const askBuoyStore: {
87
+ getState: () => AskBuoyState;
88
+ subscribe(fn: Listener): () => void;
89
+ setLedger(ledger: EffectLedger | null): void;
90
+ getLedger(): EffectLedger | null;
91
+ holdSession(session: AskBuoySession, signature: string): void;
92
+ getHeldSession(): {
93
+ session: AskBuoySession;
94
+ signature: string;
95
+ } | null;
96
+ setNotice(notice: string | null): void;
97
+ setConfigured(configured: boolean): void;
98
+ addUser(text: string): void;
99
+ /** Mark a turn as running without adding a bubble — the retry path. */
100
+ beginTurn(): void;
101
+ /** Park a message typed mid-turn instead of silently dropping it. */
102
+ setQueued(text: string | null): void;
103
+ /** Drop one message — the failed assistant bubble a retry replaces. */
104
+ removeMessage(id: string): void;
105
+ /** The user answered (or skipped) an Ask block. */
106
+ recordAnswer(answer: BlockAnswer): void;
107
+ setActionState(key: string, value: "running" | "done" | "failed" | null): void;
108
+ /** Open a new assistant bubble for the turn that is about to stream. */
109
+ startAssistant(): string;
110
+ /**
111
+ * Fold one engine event into the open assistant message.
112
+ *
113
+ * Tool calls render as rows inside the bubble rather than as raw payloads:
114
+ * the label is already domain-flavoured ("Set points to 1500"), which is the
115
+ * only form a non-developer can actually check.
116
+ */
117
+ applyEvent(messageId: string, ev: TurnEvent): void;
118
+ finishAssistant(messageId: string): void;
119
+ askApproval(input: Omit<PendingApproval, "resolve">): Promise<boolean>;
120
+ answerApproval(approved: boolean): void;
121
+ reset(): void;
122
+ };
123
+ export {};
124
+ //# sourceMappingURL=askBuoyStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"askBuoyStore.d.ts","sourceRoot":"","sources":["../../../src/store/askBuoyStore.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,22 @@
1
+ import { type BlockAction, type BlockAnswer } from "@buoy-gg/agent-core";
2
+ import { type AskBuoyState } from "./askBuoyStore";
3
+ import type { AskBuoyConfig } from "../types";
4
+ export declare function useAskBuoyState(): AskBuoyState;
5
+ export interface AskBuoyController {
6
+ state: AskBuoyState;
7
+ send: (text: string) => void;
8
+ stop: () => void;
9
+ reset: () => void;
10
+ approve: (approved: boolean) => void;
11
+ /** Re-send the last user message after a failed turn. */
12
+ retry: () => void;
13
+ /** Answer an Ask block: locks it and sends the answer as the next message. */
14
+ answer: (answer: BlockAnswer) => void;
15
+ /** Run a block button that dispatches a Buoy action or sends a message. */
16
+ runAction: (action: BlockAction, blockId: string) => Promise<void>;
17
+ configured: boolean;
18
+ /** How many Buoy tools the agent can reach on this device. */
19
+ toolCount: number;
20
+ }
21
+ export declare function useAskBuoy(config: AskBuoyConfig | undefined): AskBuoyController;
22
+ //# sourceMappingURL=useAskBuoy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAskBuoy.d.ts","sourceRoot":"","sources":["../../../src/store/useAskBuoy.ts"],"names":[],"mappings":"AAuBA,OAAO,EAML,KAAK,WAAW,EAChB,KAAK,WAAW,EAEjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAI9C,wBAAgB,eAAe,IAAI,YAAY,CAE9C;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,YAAY,CAAC;IACpB,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,OAAO,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,yDAAyD;IACzD,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,8EAA8E;IAC9E,MAAM,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IACtC,2EAA2E;IAC3E,SAAS,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACnE,UAAU,EAAE,OAAO,CAAC;IACpB,8DAA8D;IAC9D,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,aAAa,GAAG,SAAS,GAAG,iBAAiB,CAoS/E"}
@@ -0,0 +1,73 @@
1
+ export declare const ASK_BUOY_ADAPTER_VERSION = 1;
2
+ export declare const askBuoySyncAdapter: {
3
+ version: number;
4
+ getSnapshot(): {
5
+ version: number;
6
+ busy: boolean;
7
+ configured: boolean;
8
+ notice: string | null;
9
+ messageCount: number;
10
+ messages: {
11
+ id: string;
12
+ role: "user" | "assistant";
13
+ text: string;
14
+ streaming: boolean;
15
+ toolCalls: {
16
+ toolId: string;
17
+ action: string;
18
+ status: "running" | "failed" | "ok" | "refused";
19
+ }[];
20
+ }[];
21
+ usage: {
22
+ input: number;
23
+ output: number;
24
+ requests: number;
25
+ };
26
+ pendingApproval: {
27
+ toolId: string;
28
+ action: string;
29
+ label: string;
30
+ } | null;
31
+ changes: {
32
+ reversible: number;
33
+ permanent: number;
34
+ transients: number;
35
+ items: {
36
+ kind: "network-override" | "impersonation" | "storage-write" | "state-write" | "transient";
37
+ label: string;
38
+ }[];
39
+ };
40
+ };
41
+ subscribe(onChange: () => void): () => void;
42
+ actions: {
43
+ /** What the agent changed, and whether it can be put back. */
44
+ listChanges: () => {
45
+ id: string;
46
+ at: number;
47
+ toolId: string;
48
+ action: string;
49
+ kind: "network-override" | "impersonation" | "storage-write" | "state-write" | "transient";
50
+ label: string;
51
+ reversible: boolean;
52
+ }[];
53
+ /** Put back everything that can be put back. Safe direction only. */
54
+ undoAll: () => Promise<{
55
+ ok: boolean;
56
+ error: string;
57
+ } | {
58
+ reverted: number;
59
+ failed: {
60
+ label: string;
61
+ error: string;
62
+ }[];
63
+ skippedTransients: number;
64
+ ok: boolean;
65
+ error?: undefined;
66
+ }>;
67
+ /** Clear the transcript and the ledger. Does not undo anything. */
68
+ reset: () => {
69
+ ok: boolean;
70
+ };
71
+ };
72
+ };
73
+ //# sourceMappingURL=askBuoySyncAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"askBuoySyncAdapter.d.ts","sourceRoot":"","sources":["../../../src/sync/askBuoySyncAdapter.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAE1C,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAiDT,MAAM,IAAI;;QAU5B,8DAA8D;;;;;;;;;;QAgB9D,qEAAqE;;;;;;;;;;;;;;QAQrE,mEAAmE;;;;;CAMtE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=askBuoySyncAdapter.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"askBuoySyncAdapter.test.d.ts","sourceRoot":"","sources":["../../../src/sync/askBuoySyncAdapter.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * What the sync adapter is allowed to put on the broker wire.
3
+ *
4
+ * The broker has no authentication, `cors.origin: "*"`, binds every interface,
5
+ * and forwards to every connected dashboard — it already broadcasts each
6
+ * device's license key to every socket. A chat transcript is not a safe thing
7
+ * to add to that channel unfiltered: the agent reads storage values, network
8
+ * response bodies and user records, and any of it can end up quoted in an
9
+ * answer.
10
+ *
11
+ * So text crossing the wire is scrubbed for the shapes that are unambiguously
12
+ * credentials. This is a reduction in blast radius, not a guarantee — the real
13
+ * guarantee is that tool RESULTS never cross at all (see askBuoySyncAdapter).
14
+ */
15
+ export { dispatchToolAction } from "@buoy-gg/shared-ui";
16
+ export declare function redactForWire(text: string): string;
17
+ //# sourceMappingURL=wire.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../../../src/sync/wire.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAcxD,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOlD"}
@@ -0,0 +1,119 @@
1
+ /**
2
+ * The `ask-buoy` prop on <FloatingDevTools>.
3
+ *
4
+ * The shape of this config IS the security model. Buoy holds no model
5
+ * credential of its own — not in the bundle, not in storage, not on the sync
6
+ * wire — because `headers` is a callback the HOST APP owns. The QA person is
7
+ * already signed into the app; the app hands the agent its own session token;
8
+ * the company's gateway authorises and meters per user. Nothing to leak,
9
+ * nothing to rotate, nothing that shows up in a decompiled binary.
10
+ *
11
+ * That is why `endpoint` is required and `apiKey` is documented dev-only: a key
12
+ * pasted into app config is inlined into the JS bundle in plaintext, which is
13
+ * OWASP Mobile's #1 risk and not something to make convenient.
14
+ */
15
+ import type { ContextPack, AskBuoyPolicy, ToolDescriptor, TurnEvent } from "@buoy-gg/agent-core";
16
+ export interface AskBuoyConfig {
17
+ /**
18
+ * The company's own LLM gateway. Buoy POSTs the conversation here and never
19
+ * anywhere else — no request ever reaches Buoy infrastructure.
20
+ */
21
+ endpoint: string;
22
+ /** Which request/response shape the endpoint speaks. @default "anthropic" */
23
+ protocol?: "anthropic" | "openai";
24
+ /** Model id passed through to the endpoint. */
25
+ model: string;
26
+ /**
27
+ * Headers for each request, resolved fresh every time so a short-lived token
28
+ * from the app's own auth works. This is the intended way to authenticate:
29
+ * the app's credential, the company's gateway, Buoy in the middle holding
30
+ * nothing.
31
+ */
32
+ headers?: () => Record<string, string> | Promise<Record<string, string>>;
33
+ /**
34
+ * A provider key, sent straight to the provider.
35
+ *
36
+ * DEV ONLY. Anything you put here is compiled into the JS bundle in
37
+ * plaintext and ships to every install. Use `headers` + your own gateway for
38
+ * anything a tester or a customer will ever run.
39
+ */
40
+ apiKey?: string;
41
+ /** @default 4096 */
42
+ maxTokens?: number;
43
+ /** Anthropic API version header. Ignored when `protocol` is "openai". */
44
+ anthropicVersion?: string;
45
+ /**
46
+ * Extra fields merged into every request body, last — `temperature`, a
47
+ * gateway's routing hints, whatever the endpoint demands that this config
48
+ * doesn't model. Core fields win only if you don't override them.
49
+ */
50
+ requestOverrides?: Record<string, unknown>;
51
+ /**
52
+ * What the agent may do without asking. Default: reads and writes auto-run
53
+ * (a banner shows what changed, Undo reverses what can be reversed), and
54
+ * DESTRUCTIVE actions wait for a tap on an approval card. Pass
55
+ * `requireApproval: []` for full auto-run on a dev device that is yours.
56
+ */
57
+ policy?: AskBuoyPolicy;
58
+ /**
59
+ * What this app's data MEANS, and the exact shapes of what the agent may
60
+ * write — the single highest-leverage thing you can give it. Buoy derives
61
+ * the rest (routes, query keys, store names, storage keys) by observing the
62
+ * app, but only their NAMES: the digest carries no values and no shapes.
63
+ *
64
+ * `types` matters most for creating the FIRST of something. The agent reads
65
+ * a live instance and copies its fields when it can, but an empty cart has
66
+ * no shape to copy, and that is precisely when it is asked to add a line.
67
+ *
68
+ * @example
69
+ * context: {
70
+ * notes: ["user.rewards.points = loyalty points"],
71
+ * types: { CartLine: "{ lineId: string; itemId: string; qty: number }" },
72
+ * }
73
+ */
74
+ context?: ContextPack;
75
+ /** Shown in the sheet header and to the model. @default the app name */
76
+ appName?: string;
77
+ /**
78
+ * When the agent navigates or taps, the sheet drops to a short strip for a
79
+ * couple of seconds so the user SEES the app do it, then springs back.
80
+ * "Show me what a gold member sees" is meaningless if the sheet covers the
81
+ * screen it just navigated to. Default true; set false to keep the sheet
82
+ * fixed (the Peek chip in the transcript still minimizes on demand).
83
+ */
84
+ peek?: boolean;
85
+ /**
86
+ * Observability tap: every engine event — tool starts and results, blocks,
87
+ * approvals, errors, per-request token usage — as it happens, so a company
88
+ * can log agent activity to its own systems and meter cost per seat. Called
89
+ * synchronously on the JS thread; keep it cheap and never throw (throws are
90
+ * swallowed so a logging bug can't take the chat down).
91
+ */
92
+ onEvent?: (event: TurnEvent) => void;
93
+ /**
94
+ * Descriptors for YOUR custom tools, so the agent can drive them too.
95
+ *
96
+ * A custom tool registered with a sync adapter is dispatchable as
97
+ * `custom:<id>` — but the agent only offers what's in its catalog, so
98
+ * without a descriptor your tool is invisible to the chat while remaining
99
+ * fully drivable from MCP. Each descriptor's `toolId` must match the
100
+ * registered id (`custom:<id>`), and its actions get the same param
101
+ * validation, policy gates and release-truth refusals as the built-ins.
102
+ *
103
+ * @example
104
+ * tools: [{
105
+ * toolId: "custom:feature-flags",
106
+ * title: "Feature flags",
107
+ * summary: "Read and set this app's feature flags.",
108
+ * actions: [{
109
+ * action: "setFlag",
110
+ * summary: "Turn one feature flag on or off.",
111
+ * params: { type: "object", properties: { name: { type: "string" }, on: { type: "boolean" } }, required: ["name", "on"] },
112
+ * effect: "write",
113
+ * release: "works",
114
+ * }],
115
+ * }]
116
+ */
117
+ tools?: ToolDescriptor[];
118
+ }
119
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEjG,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,WAAW,GAAG,QAAQ,CAAC;IAElC,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAEzE;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,oBAAoB;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,yEAAyE;IACzE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE3C;;;;;OAKG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC;IAEvB;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IAEtB,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IAErC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,KAAK,CAAC,EAAE,cAAc,EAAE,CAAC;CAC1B"}
package/package.json ADDED
@@ -0,0 +1,83 @@
1
+ {
2
+ "name": "@buoy-gg/ask-buoy",
3
+ "version": "7.0.33",
4
+ "description": "Ask Buoy - an in-app AI chat that drives every Buoy devtool, powered by your own model endpoint",
5
+ "main": "lib/commonjs/index.js",
6
+ "module": "lib/module/index.js",
7
+ "types": "lib/typescript/index.d.ts",
8
+ "react-native": "lib/module/index.js",
9
+ "source": "src/index.tsx",
10
+ "files": [
11
+ "lib"
12
+ ],
13
+ "sideEffects": [
14
+ "./src/index.tsx",
15
+ "./lib/commonjs/index.js",
16
+ "./lib/module/index.js"
17
+ ],
18
+ "keywords": [
19
+ "react-native",
20
+ "devtools",
21
+ "ai",
22
+ "chat",
23
+ "agent",
24
+ "buoy"
25
+ ],
26
+ "dependencies": {
27
+ "@buoy-gg/floating-tools-core": "^7.0.33",
28
+ "@buoy-gg/agent-core": "^7.0.33",
29
+ "@buoy-gg/shared-ui": "^7.0.33"
30
+ },
31
+ "peerDependencies": {
32
+ "@buoy-gg/license": "7.0.33",
33
+ "react": "*",
34
+ "react-native": "*",
35
+ "@buoy-gg/core": "^7.0.33"
36
+ },
37
+ "peerDependenciesMeta": {
38
+ "@buoy-gg/core": {
39
+ "optional": true
40
+ }
41
+ },
42
+ "devDependencies": {
43
+ "@types/react": "^19.1.0",
44
+ "@types/react-native": "^0.73.0",
45
+ "typescript": "~5.8.3",
46
+ "@buoy-gg/core": "^7.0.33",
47
+ "@buoy-gg/license": "^7.0.33"
48
+ },
49
+ "react-native-builder-bob": {
50
+ "source": "src",
51
+ "output": "lib",
52
+ "targets": [
53
+ "commonjs",
54
+ "module",
55
+ [
56
+ "typescript",
57
+ {
58
+ "project": "tsconfig.build.json"
59
+ }
60
+ ]
61
+ ]
62
+ },
63
+ "repository": {
64
+ "type": "git",
65
+ "url": "https://github.com/LovesWorking/react-native-buoy.git",
66
+ "directory": "packages/ask-buoy"
67
+ },
68
+ "bugs": {
69
+ "url": "https://github.com/LovesWorking/react-native-buoy/issues"
70
+ },
71
+ "homepage": "https://github.com/LovesWorking/react-native-buoy/tree/main/packages/ask-buoy#readme",
72
+ "publishConfig": {
73
+ "access": "public",
74
+ "tag": "latest"
75
+ },
76
+ "scripts": {
77
+ "build": "bob build",
78
+ "typecheck": "tsc --noEmit",
79
+ "clean": "rimraf lib",
80
+ "test": "pnpm run typecheck",
81
+ "postinstall": "echo \"Run pnpm build to compile this package\""
82
+ }
83
+ }