@buoy-gg/ask-buoy 7.0.40 → 7.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -94
- package/lib/commonjs/blocks/AskBlocks.js +1 -338
- package/lib/commonjs/blocks/BlockRenderer.js +1 -262
- package/lib/commonjs/blocks/ChromePrototypes.js +1 -514
- package/lib/commonjs/blocks/DataBlocks.js +1 -781
- package/lib/commonjs/blocks/ExtraBlocks.js +1 -1860
- package/lib/commonjs/blocks/MediaBlocks.js +1 -156
- package/lib/commonjs/blocks/ReceiptBlocks.js +2 -586
- package/lib/commonjs/blocks/blockText.js +1 -60
- package/lib/commonjs/blocks/blockText.test.js +1 -53
- package/lib/commonjs/blocks/context.js +1 -42
- package/lib/commonjs/blocks/icons.js +1 -96
- package/lib/commonjs/blocks/index.js +1 -95
- package/lib/commonjs/blocks/listRow.test.js +1 -55
- package/lib/commonjs/blocks/pageState.js +1 -34
- package/lib/commonjs/blocks/pageState.test.js +1 -57
- package/lib/commonjs/blocks/primitives.js +1 -457
- package/lib/commonjs/blocks/primitivesIndex.js +1 -62
- package/lib/commonjs/blocks/ruleStates.js +1 -0
- package/lib/commonjs/components/ApprovalCard.js +1 -297
- package/lib/commonjs/components/AskBuoyHeader.js +1 -196
- package/lib/commonjs/components/AskBuoyIcon.js +1 -19
- package/lib/commonjs/components/AskBuoyModal.js +2 -478
- package/lib/commonjs/components/AskBuoySettings.js +1 -181
- package/lib/commonjs/components/ChangesBar.js +1 -211
- package/lib/commonjs/components/Composer.js +1 -255
- package/lib/commonjs/components/EmptyState.js +1 -161
- package/lib/commonjs/components/KeyboardPad.js +1 -80
- package/lib/commonjs/components/Markdown.js +1 -310
- package/lib/commonjs/components/MessageList.js +1 -970
- package/lib/commonjs/components/QueuedMessages.js +1 -145
- package/lib/commonjs/components/ThinkingStrip.js +1 -223
- package/lib/commonjs/components/TypingDots.js +1 -63
- package/lib/commonjs/components/markdownParse.js +1 -131
- package/lib/commonjs/components/markdownParse.test.js +1 -99
- package/lib/commonjs/components/useCopyAction.js +1 -50
- package/lib/commonjs/index.js +1 -252
- package/lib/commonjs/preset.js +1 -91
- package/lib/commonjs/store/activityGroups.js +1 -110
- package/lib/commonjs/store/activityGroups.test.js +1 -78
- package/lib/commonjs/store/askBuoySettings.js +1 -72
- package/lib/commonjs/store/askBuoyStore.js +2 -588
- package/lib/commonjs/store/blockPlacement.js +1 -64
- package/lib/commonjs/store/blockPlacement.test.js +1 -123
- package/lib/commonjs/store/queue.test.js +1 -150
- package/lib/commonjs/store/resetConversation.js +1 -77
- package/lib/commonjs/store/restorePending.test.js +1 -63
- package/lib/commonjs/store/restoredIds.test.js +1 -47
- package/lib/commonjs/store/suggestions.js +1 -54
- package/lib/commonjs/store/suggestions.test.js +1 -58
- package/lib/commonjs/store/systemLine.test.js +1 -77
- package/lib/commonjs/store/ticketPrompt.js +1 -17
- package/lib/commonjs/store/traceText.js +1 -81
- package/lib/commonjs/store/traceText.test.js +1 -112
- package/lib/commonjs/store/transcriptPersistence.js +1 -297
- package/lib/commonjs/store/transcriptPersistence.test.js +1 -333
- package/lib/commonjs/store/turnRendering.test.js +1 -151
- package/lib/commonjs/store/useAskBuoy.js +1 -651
- package/lib/commonjs/store/useAskBuoySettings.js +1 -14
- package/lib/commonjs/sync/askBuoySyncAdapter.js +1 -153
- package/lib/commonjs/sync/askBuoySyncAdapter.test.js +1 -141
- package/lib/commonjs/sync/wire.js +1 -58
- package/lib/commonjs/types.js +1 -6
- package/lib/module/blocks/AskBlocks.js +1 -331
- package/lib/module/blocks/BlockRenderer.js +1 -257
- package/lib/module/blocks/ChromePrototypes.js +1 -503
- package/lib/module/blocks/DataBlocks.js +1 -767
- package/lib/module/blocks/ExtraBlocks.js +1 -1833
- package/lib/module/blocks/MediaBlocks.js +1 -151
- package/lib/module/blocks/ReceiptBlocks.js +2 -574
- package/lib/module/blocks/blockText.js +1 -55
- package/lib/module/blocks/blockText.test.js +1 -53
- package/lib/module/blocks/context.js +1 -35
- package/lib/module/blocks/icons.js +1 -91
- package/lib/module/blocks/index.js +1 -8
- package/lib/module/blocks/listRow.test.js +1 -56
- package/lib/module/blocks/pageState.js +1 -30
- package/lib/module/blocks/pageState.test.js +1 -56
- package/lib/module/blocks/primitives.js +1 -445
- package/lib/module/blocks/primitivesIndex.js +1 -5
- package/lib/module/blocks/ruleStates.js +1 -0
- package/lib/module/components/ApprovalCard.js +1 -292
- package/lib/module/components/AskBuoyHeader.js +1 -193
- package/lib/module/components/AskBuoyIcon.js +1 -8
- package/lib/module/components/AskBuoyModal.js +2 -473
- package/lib/module/components/AskBuoySettings.js +1 -176
- package/lib/module/components/ChangesBar.js +1 -206
- package/lib/module/components/Composer.js +1 -250
- package/lib/module/components/EmptyState.js +1 -156
- package/lib/module/components/KeyboardPad.js +1 -75
- package/lib/module/components/Markdown.js +1 -305
- package/lib/module/components/MessageList.js +1 -964
- package/lib/module/components/QueuedMessages.js +1 -140
- package/lib/module/components/ThinkingStrip.js +1 -218
- package/lib/module/components/TypingDots.js +1 -58
- package/lib/module/components/markdownParse.js +1 -125
- package/lib/module/components/markdownParse.test.js +1 -98
- package/lib/module/components/useCopyAction.js +1 -46
- package/lib/module/index.js +1 -34
- package/lib/module/preset.js +1 -74
- package/lib/module/store/activityGroups.js +1 -103
- package/lib/module/store/activityGroups.test.js +1 -77
- package/lib/module/store/askBuoySettings.js +1 -67
- package/lib/module/store/askBuoyStore.js +2 -582
- package/lib/module/store/blockPlacement.js +1 -59
- package/lib/module/store/blockPlacement.test.js +1 -122
- package/lib/module/store/queue.test.js +1 -149
- package/lib/module/store/resetConversation.js +1 -72
- package/lib/module/store/restorePending.test.js +1 -62
- package/lib/module/store/restoredIds.test.js +1 -46
- package/lib/module/store/suggestions.js +1 -49
- package/lib/module/store/suggestions.test.js +1 -57
- package/lib/module/store/systemLine.test.js +1 -76
- package/lib/module/store/ticketPrompt.js +1 -13
- package/lib/module/store/traceText.js +1 -75
- package/lib/module/store/traceText.test.js +1 -111
- package/lib/module/store/transcriptPersistence.js +1 -287
- package/lib/module/store/transcriptPersistence.test.js +1 -332
- package/lib/module/store/turnRendering.test.js +1 -150
- package/lib/module/store/useAskBuoy.js +1 -646
- package/lib/module/store/useAskBuoySettings.js +1 -9
- package/lib/module/sync/askBuoySyncAdapter.js +1 -148
- package/lib/module/sync/askBuoySyncAdapter.test.js +1 -140
- package/lib/module/sync/wire.js +1 -47
- package/lib/module/types.js +1 -4
- package/lib/typescript/blocks/context.d.ts +3 -0
- package/lib/typescript/blocks/ruleStates.d.ts +15 -0
- package/lib/typescript/components/ChangesBar.d.ts +2 -1
- package/lib/typescript/sync/askBuoySyncAdapter.d.ts +2 -2
- package/lib/web/index.mjs +15 -0
- package/package.json +44 -11
- package/lib/commonjs/blocks/AskBlocks.js.map +0 -1
- package/lib/commonjs/blocks/BlockRenderer.js.map +0 -1
- package/lib/commonjs/blocks/ChromePrototypes.js.map +0 -1
- package/lib/commonjs/blocks/DataBlocks.js.map +0 -1
- package/lib/commonjs/blocks/ExtraBlocks.js.map +0 -1
- package/lib/commonjs/blocks/MediaBlocks.js.map +0 -1
- package/lib/commonjs/blocks/ReceiptBlocks.js.map +0 -1
- package/lib/commonjs/blocks/blockText.js.map +0 -1
- package/lib/commonjs/blocks/blockText.test.js.map +0 -1
- package/lib/commonjs/blocks/context.js.map +0 -1
- package/lib/commonjs/blocks/icons.js.map +0 -1
- package/lib/commonjs/blocks/index.js.map +0 -1
- package/lib/commonjs/blocks/listRow.test.js.map +0 -1
- package/lib/commonjs/blocks/pageState.js.map +0 -1
- package/lib/commonjs/blocks/pageState.test.js.map +0 -1
- package/lib/commonjs/blocks/primitives.js.map +0 -1
- package/lib/commonjs/blocks/primitivesIndex.js.map +0 -1
- package/lib/commonjs/components/ApprovalCard.js.map +0 -1
- package/lib/commonjs/components/AskBuoyHeader.js.map +0 -1
- package/lib/commonjs/components/AskBuoyIcon.js.map +0 -1
- package/lib/commonjs/components/AskBuoyModal.js.map +0 -1
- package/lib/commonjs/components/AskBuoySettings.js.map +0 -1
- package/lib/commonjs/components/ChangesBar.js.map +0 -1
- package/lib/commonjs/components/Composer.js.map +0 -1
- package/lib/commonjs/components/EmptyState.js.map +0 -1
- package/lib/commonjs/components/KeyboardPad.js.map +0 -1
- package/lib/commonjs/components/Markdown.js.map +0 -1
- package/lib/commonjs/components/MessageList.js.map +0 -1
- package/lib/commonjs/components/QueuedMessages.js.map +0 -1
- package/lib/commonjs/components/ThinkingStrip.js.map +0 -1
- package/lib/commonjs/components/TypingDots.js.map +0 -1
- package/lib/commonjs/components/markdownParse.js.map +0 -1
- package/lib/commonjs/components/markdownParse.test.js.map +0 -1
- package/lib/commonjs/components/useCopyAction.js.map +0 -1
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/preset.js.map +0 -1
- package/lib/commonjs/store/activityGroups.js.map +0 -1
- package/lib/commonjs/store/activityGroups.test.js.map +0 -1
- package/lib/commonjs/store/askBuoySettings.js.map +0 -1
- package/lib/commonjs/store/askBuoyStore.js.map +0 -1
- package/lib/commonjs/store/blockPlacement.js.map +0 -1
- package/lib/commonjs/store/blockPlacement.test.js.map +0 -1
- package/lib/commonjs/store/queue.test.js.map +0 -1
- package/lib/commonjs/store/resetConversation.js.map +0 -1
- package/lib/commonjs/store/restorePending.test.js.map +0 -1
- package/lib/commonjs/store/restoredIds.test.js.map +0 -1
- package/lib/commonjs/store/suggestions.js.map +0 -1
- package/lib/commonjs/store/suggestions.test.js.map +0 -1
- package/lib/commonjs/store/systemLine.test.js.map +0 -1
- package/lib/commonjs/store/ticketPrompt.js.map +0 -1
- package/lib/commonjs/store/traceText.js.map +0 -1
- package/lib/commonjs/store/traceText.test.js.map +0 -1
- package/lib/commonjs/store/transcriptPersistence.js.map +0 -1
- package/lib/commonjs/store/transcriptPersistence.test.js.map +0 -1
- package/lib/commonjs/store/turnRendering.test.js.map +0 -1
- package/lib/commonjs/store/useAskBuoy.js.map +0 -1
- package/lib/commonjs/store/useAskBuoySettings.js.map +0 -1
- package/lib/commonjs/sync/askBuoySyncAdapter.js.map +0 -1
- package/lib/commonjs/sync/askBuoySyncAdapter.test.js.map +0 -1
- package/lib/commonjs/sync/wire.js.map +0 -1
- package/lib/commonjs/types.js.map +0 -1
- package/lib/module/blocks/AskBlocks.js.map +0 -1
- package/lib/module/blocks/BlockRenderer.js.map +0 -1
- package/lib/module/blocks/ChromePrototypes.js.map +0 -1
- package/lib/module/blocks/DataBlocks.js.map +0 -1
- package/lib/module/blocks/ExtraBlocks.js.map +0 -1
- package/lib/module/blocks/MediaBlocks.js.map +0 -1
- package/lib/module/blocks/ReceiptBlocks.js.map +0 -1
- package/lib/module/blocks/blockText.js.map +0 -1
- package/lib/module/blocks/blockText.test.js.map +0 -1
- package/lib/module/blocks/context.js.map +0 -1
- package/lib/module/blocks/icons.js.map +0 -1
- package/lib/module/blocks/index.js.map +0 -1
- package/lib/module/blocks/listRow.test.js.map +0 -1
- package/lib/module/blocks/pageState.js.map +0 -1
- package/lib/module/blocks/pageState.test.js.map +0 -1
- package/lib/module/blocks/primitives.js.map +0 -1
- package/lib/module/blocks/primitivesIndex.js.map +0 -1
- package/lib/module/components/ApprovalCard.js.map +0 -1
- package/lib/module/components/AskBuoyHeader.js.map +0 -1
- package/lib/module/components/AskBuoyIcon.js.map +0 -1
- package/lib/module/components/AskBuoyModal.js.map +0 -1
- package/lib/module/components/AskBuoySettings.js.map +0 -1
- package/lib/module/components/ChangesBar.js.map +0 -1
- package/lib/module/components/Composer.js.map +0 -1
- package/lib/module/components/EmptyState.js.map +0 -1
- package/lib/module/components/KeyboardPad.js.map +0 -1
- package/lib/module/components/Markdown.js.map +0 -1
- package/lib/module/components/MessageList.js.map +0 -1
- package/lib/module/components/QueuedMessages.js.map +0 -1
- package/lib/module/components/ThinkingStrip.js.map +0 -1
- package/lib/module/components/TypingDots.js.map +0 -1
- package/lib/module/components/markdownParse.js.map +0 -1
- package/lib/module/components/markdownParse.test.js.map +0 -1
- package/lib/module/components/useCopyAction.js.map +0 -1
- package/lib/module/index.js.map +0 -1
- package/lib/module/preset.js.map +0 -1
- package/lib/module/store/activityGroups.js.map +0 -1
- package/lib/module/store/activityGroups.test.js.map +0 -1
- package/lib/module/store/askBuoySettings.js.map +0 -1
- package/lib/module/store/askBuoyStore.js.map +0 -1
- package/lib/module/store/blockPlacement.js.map +0 -1
- package/lib/module/store/blockPlacement.test.js.map +0 -1
- package/lib/module/store/queue.test.js.map +0 -1
- package/lib/module/store/resetConversation.js.map +0 -1
- package/lib/module/store/restorePending.test.js.map +0 -1
- package/lib/module/store/restoredIds.test.js.map +0 -1
- package/lib/module/store/suggestions.js.map +0 -1
- package/lib/module/store/suggestions.test.js.map +0 -1
- package/lib/module/store/systemLine.test.js.map +0 -1
- package/lib/module/store/ticketPrompt.js.map +0 -1
- package/lib/module/store/traceText.js.map +0 -1
- package/lib/module/store/traceText.test.js.map +0 -1
- package/lib/module/store/transcriptPersistence.js.map +0 -1
- package/lib/module/store/transcriptPersistence.test.js.map +0 -1
- package/lib/module/store/turnRendering.test.js.map +0 -1
- package/lib/module/store/useAskBuoy.js.map +0 -1
- package/lib/module/store/useAskBuoySettings.js.map +0 -1
- package/lib/module/sync/askBuoySyncAdapter.js.map +0 -1
- package/lib/module/sync/askBuoySyncAdapter.test.js.map +0 -1
- package/lib/module/sync/wire.js.map +0 -1
- package/lib/module/types.js.map +0 -1
- package/lib/typescript/blocks/AskBlocks.d.ts.map +0 -1
- package/lib/typescript/blocks/BlockRenderer.d.ts.map +0 -1
- package/lib/typescript/blocks/ChromePrototypes.d.ts.map +0 -1
- package/lib/typescript/blocks/DataBlocks.d.ts.map +0 -1
- package/lib/typescript/blocks/ExtraBlocks.d.ts.map +0 -1
- package/lib/typescript/blocks/MediaBlocks.d.ts.map +0 -1
- package/lib/typescript/blocks/ReceiptBlocks.d.ts.map +0 -1
- package/lib/typescript/blocks/blockText.d.ts.map +0 -1
- package/lib/typescript/blocks/blockText.test.d.ts.map +0 -1
- package/lib/typescript/blocks/context.d.ts.map +0 -1
- package/lib/typescript/blocks/icons.d.ts.map +0 -1
- package/lib/typescript/blocks/index.d.ts.map +0 -1
- package/lib/typescript/blocks/listRow.test.d.ts.map +0 -1
- package/lib/typescript/blocks/pageState.d.ts.map +0 -1
- package/lib/typescript/blocks/pageState.test.d.ts.map +0 -1
- package/lib/typescript/blocks/primitives.d.ts.map +0 -1
- package/lib/typescript/blocks/primitivesIndex.d.ts.map +0 -1
- package/lib/typescript/components/ApprovalCard.d.ts.map +0 -1
- package/lib/typescript/components/AskBuoyHeader.d.ts.map +0 -1
- package/lib/typescript/components/AskBuoyIcon.d.ts.map +0 -1
- package/lib/typescript/components/AskBuoyModal.d.ts.map +0 -1
- package/lib/typescript/components/AskBuoySettings.d.ts.map +0 -1
- package/lib/typescript/components/ChangesBar.d.ts.map +0 -1
- package/lib/typescript/components/Composer.d.ts.map +0 -1
- package/lib/typescript/components/EmptyState.d.ts.map +0 -1
- package/lib/typescript/components/KeyboardPad.d.ts.map +0 -1
- package/lib/typescript/components/Markdown.d.ts.map +0 -1
- package/lib/typescript/components/MessageList.d.ts.map +0 -1
- package/lib/typescript/components/QueuedMessages.d.ts.map +0 -1
- package/lib/typescript/components/ThinkingStrip.d.ts.map +0 -1
- package/lib/typescript/components/TypingDots.d.ts.map +0 -1
- package/lib/typescript/components/markdownParse.d.ts.map +0 -1
- package/lib/typescript/components/markdownParse.test.d.ts.map +0 -1
- package/lib/typescript/components/useCopyAction.d.ts.map +0 -1
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/preset.d.ts.map +0 -1
- package/lib/typescript/store/activityGroups.d.ts.map +0 -1
- package/lib/typescript/store/activityGroups.test.d.ts.map +0 -1
- package/lib/typescript/store/askBuoySettings.d.ts.map +0 -1
- package/lib/typescript/store/askBuoyStore.d.ts.map +0 -1
- package/lib/typescript/store/blockPlacement.d.ts.map +0 -1
- package/lib/typescript/store/blockPlacement.test.d.ts.map +0 -1
- package/lib/typescript/store/queue.test.d.ts.map +0 -1
- package/lib/typescript/store/resetConversation.d.ts.map +0 -1
- package/lib/typescript/store/restorePending.test.d.ts.map +0 -1
- package/lib/typescript/store/restoredIds.test.d.ts.map +0 -1
- package/lib/typescript/store/suggestions.d.ts.map +0 -1
- package/lib/typescript/store/suggestions.test.d.ts.map +0 -1
- package/lib/typescript/store/systemLine.test.d.ts.map +0 -1
- package/lib/typescript/store/ticketPrompt.d.ts.map +0 -1
- package/lib/typescript/store/traceText.d.ts.map +0 -1
- package/lib/typescript/store/traceText.test.d.ts.map +0 -1
- package/lib/typescript/store/transcriptPersistence.d.ts.map +0 -1
- package/lib/typescript/store/transcriptPersistence.test.d.ts.map +0 -1
- package/lib/typescript/store/turnRendering.test.d.ts.map +0 -1
- package/lib/typescript/store/useAskBuoy.d.ts.map +0 -1
- package/lib/typescript/store/useAskBuoySettings.d.ts.map +0 -1
- package/lib/typescript/sync/askBuoySyncAdapter.d.ts.map +0 -1
- package/lib/typescript/sync/askBuoySyncAdapter.test.d.ts.map +0 -1
- package/lib/typescript/sync/wire.d.ts.map +0 -1
- package/lib/typescript/types.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,108 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# @buoy-gg/ask-buoy
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
An AI chat inside your React Native app. It can inspect and act through your installed Buoy tools, subject to your policy and each tool's integration.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
<a href="https://buoy.gg/buoy/latest/docs/tools/ask-buoy"><b>Ask Buoy guide</b></a> · <a href="https://buoy.gg">buoy.gg</a> · <a href="https://github.com/Buoy-gg/buoy">All tools</a>
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
[](https://www.npmjs.com/package/@buoy-gg/ask-buoy) [](https://www.npmjs.com/package/@buoy-gg/ask-buoy)
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
npm install @buoy-gg/core @buoy-gg/ask-buoy
|
|
13
|
-
```
|
|
11
|
+
<a href="https://buoy.gg/buoy/latest/docs/tools/ask-buoy"><img src="https://raw.githubusercontent.com/Buoy-gg/buoy/main/.github/readme/tools/ask-buoy.png" alt="Watch the Ask Buoy film on buoy.gg" width="640" /></a>
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
</div>
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
## Install
|
|
18
16
|
|
|
19
17
|
```bash
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
For Expo, initialize Buoy before rendering the menu:
|
|
24
|
-
|
|
25
|
-
```tsx
|
|
26
|
-
import { Buoy } from "@buoy-gg/core";
|
|
27
|
-
|
|
28
|
-
Buoy.init({ licenseKey: process.env.EXPO_PUBLIC_BUOY_KEY });
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
The login command writes the Expo key to `.env.local`. For React Native CLI, pass the key from your app’s environment configuration; React Native does not load `.env.local` automatically. Mount `FloatingDevTools` inside the same providers as your screens and restart the development server after installation. The [Quick Start](https://buoy.gg/buoy/latest/docs/quick-start) shows the complete root component setup.
|
|
32
|
-
|
|
33
|
-
This configuration fragment uses your existing `auth.getToken()` implementation. Your gateway must validate that token. Replace the endpoint and model with values your gateway supports.
|
|
34
|
-
|
|
35
|
-
```tsx
|
|
36
|
-
import { FloatingDevTools } from "@buoy-gg/core";
|
|
37
|
-
|
|
38
|
-
<FloatingDevTools
|
|
39
|
-
askBuoy={{
|
|
40
|
-
endpoint: "https://ai.acme.com/v1/messages",
|
|
41
|
-
protocol: "anthropic", // or "openai" — Azure, Gemini-compat, most gateways
|
|
42
|
-
model: "YOUR_MODEL_ID",
|
|
43
|
-
|
|
44
|
-
// Called before every request, so short-lived tokens work.
|
|
45
|
-
headers: async () => ({
|
|
46
|
-
Authorization: `Bearer ${await auth.getToken()}`,
|
|
47
|
-
}),
|
|
48
|
-
}}
|
|
49
|
-
/>
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Open Ask Buoy and ask it to read a known captured request. Confirm that it reports the actual request before trying a write. Available actions depend on installed tools and policy. Start with `policy: { readOnly: true }` in the `askBuoy` configuration if you want to validate reads first.
|
|
53
|
-
|
|
54
|
-
Keep package versions compatible with their declared peer dependencies, especially `@buoy-gg/license`. Check package-manager peer warnings when upgrading.
|
|
55
|
-
|
|
56
|
-
### Teach it your data
|
|
57
|
-
|
|
58
|
-
Buoy discovers routes, query keys, store names and storage keys by watching the app run, and reads the item shape of every non-empty list it can see — what it can't know is what any of that *means*, or the shape of a collection that is currently empty.
|
|
59
|
-
|
|
60
|
-
Add `context` inside the `askBuoy` configuration. For example:
|
|
61
|
-
|
|
62
|
-
```tsx
|
|
63
|
-
const context = {
|
|
64
|
-
notes: ["Prices are integer cents everywhere. `/api/*` ids are prefixed — ord_, usr_, itm_."],
|
|
65
|
-
types: { CartLine: "{ lineId: string; itemId: string; qty: number; unitPrice: number }" },
|
|
66
|
-
};
|
|
18
|
+
npm install @buoy-gg/core @buoy-gg/ask-buoy
|
|
67
19
|
```
|
|
68
20
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
Tasks that aren't guessable from the app — *"reproduce the pricing glitch"*, *"put this account in the expired state"* — go in `context.procedures`: an `id`, a one-line `summary` (the only part in every prompt), and a `body` with the steps, loaded when a request matches. A tester types **"run the expired-subscription check"** and the agent opens the playbook first instead of asking what that means. A procedure guides; it grants nothing.
|
|
72
|
-
|
|
73
|
-
## Permissions and verification
|
|
74
|
-
|
|
75
|
-
The changes bar lists undoable and permanent changes. Supported storage and query-cache writes capture the prior value for undo. Changes without a captured prior value are marked permanent.
|
|
76
|
-
|
|
77
|
-
Destructive actions require approval by default. Configure `policy` to require more approvals, allow or deny actions, limit steps, or enable read-only access. An approval note is passed to the model. **Allow for this chat** waives approval for that action during the conversation; it does not override read-only mode, deny rules, or release restrictions. Review or revoke these waivers in Settings.
|
|
78
|
-
|
|
79
|
-
Supported writes have outcome checks. The activity row reports **Verified**, **Done · not yet visible**, or **Done · check failed**. Inspect the affected screen or state when a result is unverified. Actions requiring development hooks are refused in release builds.
|
|
80
|
-
|
|
81
|
-
Credential redaction uses field names and value patterns. SecureStore values require `policy.secureReads`. Review the data your tools expose; redaction cannot establish that arbitrary app data is safe to send to a model.
|
|
82
|
-
|
|
83
|
-
## Sessions and debugging
|
|
84
|
-
|
|
85
|
-
- Saved sessions can restore the transcript, agent memory, and pending approvals. Set `persistTranscript: false` to disable transcript persistence. Saved transcripts omit tool results.
|
|
86
|
-
- Large, redacted results remain in memory for the conversation. The agent can retrieve fields or sections omitted from the model’s initial result. This evidence store is not persisted across restarts.
|
|
87
|
-
- Eligible rate-limit and overload responses are retried when no output was generated. Oversized requests can trim history and retry. The sheet reports retry activity.
|
|
88
|
-
- Answers can include tables, choices, diffs, images, receipts, and approval cards. Messages sent during a turn queue for later processing.
|
|
89
|
-
- **Settings → Chat → Show agent thinking** exposes available reasoning and step payloads, results, timing, and token counts. Inspect the result as well as the step status when diagnosing a failed action.
|
|
90
|
-
- A ticket summary can collect steps, expected and observed behavior, build information, and available evidence without running new actions.
|
|
91
|
-
|
|
92
|
-
## Desktop and custom integrations
|
|
93
|
-
|
|
94
|
-
Desktop can mirror the conversation and expose supported remote undo. There is no remote composer. Mirroring requires external sync and account admission; your app still controls authorization.
|
|
95
|
-
|
|
96
|
-
Custom tools need a sync adapter and a `ToolDescriptor` passed through `tools`. They use the same parameter validation and policy checks as built-in actions.
|
|
97
|
-
|
|
98
|
-
Use `onEvent` to observe tool calls, outcome checks, approvals, retries, errors, and token usage. Each `done` event includes a `stopReason`.
|
|
99
|
-
|
|
100
|
-
## Docs
|
|
101
|
-
|
|
102
|
-
For gateway requirements, model configuration, data sent to the model, and policy options, see **[buoy.gg/docs/tools/ask-buoy](https://buoy.gg/buoy/latest/docs/tools/ask-buoy)**
|
|
21
|
+
Ask Buoy requires Pro and a model endpoint you configure, passed to `<FloatingDevTools />` through the `askBuoy` prop. It reports the actions it takes and offers undo where it can; some changes can't be undone.
|
|
103
22
|
|
|
104
|
-
The
|
|
23
|
+
The [Ask Buoy guide](https://buoy.gg/buoy/latest/docs/tools/ask-buoy) covers setup, what it captures and its limits. New to Buoy? Start with the [Quick start](https://buoy.gg/buoy/latest/docs/quick-start).
|
|
105
24
|
|
|
106
|
-
|
|
25
|
+
---
|
|
107
26
|
|
|
108
|
-
|
|
27
|
+
<sub>Part of <a href="https://buoy.gg">Buoy</a>, developer tools that live inside your app. Proprietary software. © Buoy LLC. <a href="https://buoy.gg/terms">Terms</a></sub>
|
|
@@ -1,338 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Choice = Choice;
|
|
7
|
-
exports.Confirm = Confirm;
|
|
8
|
-
exports.Input = Input;
|
|
9
|
-
var _react = require("react");
|
|
10
|
-
var _reactNative = require("react-native");
|
|
11
|
-
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
12
|
-
var _context = require("./context");
|
|
13
|
-
var _icons = require("./icons");
|
|
14
|
-
var _primitives = require("./primitives");
|
|
15
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
-
/**
|
|
17
|
-
* Ask blocks — the user has to decide, and the turn is waiting.
|
|
18
|
-
*
|
|
19
|
-
* Choice, Confirm and Input all lock once answered: the chosen option stays
|
|
20
|
-
* highlighted, the rest dim, and nothing in history is tappable twice. The
|
|
21
|
-
* answer is handed to the sheet as a BlockAnswer and becomes the next user
|
|
22
|
-
* message, so the model reads plain words ("Business checkout"), never JSON.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
function Choice({
|
|
26
|
-
block
|
|
27
|
-
}) {
|
|
28
|
-
const h = (0, _context.useBlockHandlers)();
|
|
29
|
-
const answer = h.answered[block.id];
|
|
30
|
-
const chosen = answer?.kind === "choice" ? answer.optionId : null;
|
|
31
|
-
const locked = !!answer;
|
|
32
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.Card, {
|
|
33
|
-
testID: `buoy-block-choice-${block.id}`,
|
|
34
|
-
tone: locked ? undefined : "info",
|
|
35
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
36
|
-
style: styles.question,
|
|
37
|
-
children: block.question
|
|
38
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
39
|
-
style: styles.options,
|
|
40
|
-
children: block.options.slice(0, 5).map((o, i) => {
|
|
41
|
-
const isChosen = chosen === o.id;
|
|
42
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
|
|
43
|
-
testID: `buoy-block-option-${o.id}`,
|
|
44
|
-
accessibilityRole: "button",
|
|
45
|
-
accessibilityState: {
|
|
46
|
-
selected: isChosen,
|
|
47
|
-
disabled: locked
|
|
48
|
-
},
|
|
49
|
-
disabled: locked,
|
|
50
|
-
onPress: () => h.answer({
|
|
51
|
-
blockId: block.id,
|
|
52
|
-
kind: "choice",
|
|
53
|
-
optionId: o.id,
|
|
54
|
-
label: o.label
|
|
55
|
-
}),
|
|
56
|
-
style: ({
|
|
57
|
-
pressed
|
|
58
|
-
}) => [styles.option, i > 0 && styles.optionDivider, isChosen && styles.optionChosen, locked && !isChosen && styles.optionDimmed, pressed && !locked && styles.pressed],
|
|
59
|
-
children: [o.icon ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.BlockIcon, {
|
|
60
|
-
name: o.icon
|
|
61
|
-
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
62
|
-
style: styles.optionText,
|
|
63
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
64
|
-
style: [styles.optionLabel, isChosen && styles.optionLabelChosen],
|
|
65
|
-
children: o.label
|
|
66
|
-
}), o.detail ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
67
|
-
style: styles.optionDetail,
|
|
68
|
-
children: o.detail
|
|
69
|
-
}) : null]
|
|
70
|
-
}), isChosen ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Check, {
|
|
71
|
-
size: 14,
|
|
72
|
-
color: _sharedUi.night.color.accent
|
|
73
|
-
}) : locked ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ChevronRight, {
|
|
74
|
-
size: 14,
|
|
75
|
-
color: _sharedUi.night.color.textTertiary
|
|
76
|
-
})]
|
|
77
|
-
}, o.id);
|
|
78
|
-
})
|
|
79
|
-
}), !locked && block.allowFreeText !== false ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
80
|
-
style: styles.hint,
|
|
81
|
-
children: "Or just type your answer below."
|
|
82
|
-
}) : null]
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
function Confirm({
|
|
86
|
-
block
|
|
87
|
-
}) {
|
|
88
|
-
const h = (0, _context.useBlockHandlers)();
|
|
89
|
-
const answer = h.answered[block.id];
|
|
90
|
-
const locked = !!answer;
|
|
91
|
-
const approved = answer?.kind === "confirm" ? answer.approved : null;
|
|
92
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.Card, {
|
|
93
|
-
testID: `buoy-block-confirm-${block.id}`,
|
|
94
|
-
tone: locked ? undefined : "warning",
|
|
95
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
96
|
-
style: styles.confirmTitle,
|
|
97
|
-
children: block.title
|
|
98
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
99
|
-
style: styles.confirmChange,
|
|
100
|
-
children: block.change
|
|
101
|
-
}), block.consequence ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
102
|
-
style: styles.confirmConsequence,
|
|
103
|
-
children: block.consequence
|
|
104
|
-
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
105
|
-
style: styles.confirmActions,
|
|
106
|
-
children: locked ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
107
|
-
style: styles.decided,
|
|
108
|
-
children: approved ? `✓ ${block.approveLabel ?? "Done"}` : `✕ ${block.declineLabel ?? "Not now"}`
|
|
109
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
110
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
111
|
-
testID: "buoy-block-approve",
|
|
112
|
-
accessibilityRole: "button",
|
|
113
|
-
onPress: () => h.answer({
|
|
114
|
-
blockId: block.id,
|
|
115
|
-
kind: "confirm",
|
|
116
|
-
approved: true
|
|
117
|
-
}),
|
|
118
|
-
style: ({
|
|
119
|
-
pressed
|
|
120
|
-
}) => [styles.button, styles.buttonPrimary, pressed && styles.pressed],
|
|
121
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
122
|
-
style: styles.buttonTextPrimary,
|
|
123
|
-
children: block.approveLabel ?? "Do it"
|
|
124
|
-
})
|
|
125
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
126
|
-
testID: "buoy-block-decline",
|
|
127
|
-
accessibilityRole: "button",
|
|
128
|
-
onPress: () => h.answer({
|
|
129
|
-
blockId: block.id,
|
|
130
|
-
kind: "confirm",
|
|
131
|
-
approved: false
|
|
132
|
-
}),
|
|
133
|
-
style: ({
|
|
134
|
-
pressed
|
|
135
|
-
}) => [styles.button, styles.buttonPlate, pressed && styles.pressed],
|
|
136
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
137
|
-
style: styles.buttonTextPlate,
|
|
138
|
-
children: block.declineLabel ?? "Not now"
|
|
139
|
-
})
|
|
140
|
-
})]
|
|
141
|
-
})
|
|
142
|
-
})]
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
function Input({
|
|
146
|
-
block
|
|
147
|
-
}) {
|
|
148
|
-
const h = (0, _context.useBlockHandlers)();
|
|
149
|
-
const answer = h.answered[block.id];
|
|
150
|
-
const locked = !!answer;
|
|
151
|
-
const [value, setValue] = (0, _react.useState)("");
|
|
152
|
-
const secret = block.type === "secret";
|
|
153
|
-
const submit = () => {
|
|
154
|
-
const v = value.trim();
|
|
155
|
-
if (!v) return;
|
|
156
|
-
h.answer({
|
|
157
|
-
blockId: block.id,
|
|
158
|
-
kind: "input",
|
|
159
|
-
value: v
|
|
160
|
-
});
|
|
161
|
-
};
|
|
162
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.Card, {
|
|
163
|
-
testID: `buoy-block-input-${block.id}`,
|
|
164
|
-
tone: locked ? undefined : "info",
|
|
165
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
166
|
-
style: styles.question,
|
|
167
|
-
children: block.label
|
|
168
|
-
}), locked ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
169
|
-
style: styles.decided,
|
|
170
|
-
children: answer.kind === "input" ? secret ? "••••••" : answer.value : "(skipped)"
|
|
171
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
172
|
-
style: styles.inputRow,
|
|
173
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
|
|
174
|
-
testID: "buoy-block-input-field",
|
|
175
|
-
style: styles.input,
|
|
176
|
-
value: value,
|
|
177
|
-
onChangeText: setValue,
|
|
178
|
-
placeholder: block.placeholder ?? "",
|
|
179
|
-
placeholderTextColor: _sharedUi.night.color.placeholder,
|
|
180
|
-
keyboardType: block.type === "number" ? "numeric" : "ascii-capable",
|
|
181
|
-
secureTextEntry: secret,
|
|
182
|
-
autoCapitalize: "none",
|
|
183
|
-
autoCorrect: false,
|
|
184
|
-
returnKeyType: "send",
|
|
185
|
-
onSubmitEditing: submit
|
|
186
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
187
|
-
testID: "buoy-block-input-submit",
|
|
188
|
-
accessibilityRole: "button",
|
|
189
|
-
disabled: !value.trim(),
|
|
190
|
-
onPress: submit,
|
|
191
|
-
style: ({
|
|
192
|
-
pressed
|
|
193
|
-
}) => [styles.button, styles.buttonPrimary, !value.trim() && styles.buttonDisabled, pressed && styles.pressed],
|
|
194
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
195
|
-
style: styles.buttonTextPrimary,
|
|
196
|
-
children: block.submitLabel ?? "Send"
|
|
197
|
-
})
|
|
198
|
-
})]
|
|
199
|
-
})]
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
const styles = _reactNative.StyleSheet.create({
|
|
203
|
-
question: {
|
|
204
|
-
color: _sharedUi.night.color.text,
|
|
205
|
-
fontSize: _sharedUi.night.font.row,
|
|
206
|
-
fontWeight: "600",
|
|
207
|
-
lineHeight: 20,
|
|
208
|
-
paddingHorizontal: 12,
|
|
209
|
-
paddingTop: 12,
|
|
210
|
-
paddingBottom: 8
|
|
211
|
-
},
|
|
212
|
-
options: {
|
|
213
|
-
marginHorizontal: 8,
|
|
214
|
-
marginBottom: 8,
|
|
215
|
-
borderRadius: _sharedUi.night.radius.row,
|
|
216
|
-
backgroundColor: _sharedUi.night.color.surfaceElevated,
|
|
217
|
-
overflow: "hidden"
|
|
218
|
-
},
|
|
219
|
-
option: {
|
|
220
|
-
flexDirection: "row",
|
|
221
|
-
alignItems: "center",
|
|
222
|
-
gap: 10,
|
|
223
|
-
paddingHorizontal: 12,
|
|
224
|
-
paddingVertical: 11
|
|
225
|
-
},
|
|
226
|
-
optionDivider: {
|
|
227
|
-
borderTopWidth: _reactNative.StyleSheet.hairlineWidth,
|
|
228
|
-
borderTopColor: _sharedUi.night.color.separator
|
|
229
|
-
},
|
|
230
|
-
optionChosen: {
|
|
231
|
-
backgroundColor: _sharedUi.night.color.accentSoft
|
|
232
|
-
},
|
|
233
|
-
optionDimmed: {
|
|
234
|
-
opacity: 0.45
|
|
235
|
-
},
|
|
236
|
-
optionText: {
|
|
237
|
-
flex: 1,
|
|
238
|
-
gap: 2
|
|
239
|
-
},
|
|
240
|
-
optionLabel: {
|
|
241
|
-
color: _sharedUi.night.color.text,
|
|
242
|
-
fontSize: _sharedUi.night.font.body,
|
|
243
|
-
fontWeight: "500"
|
|
244
|
-
},
|
|
245
|
-
optionLabelChosen: {
|
|
246
|
-
color: _sharedUi.night.color.accent
|
|
247
|
-
},
|
|
248
|
-
optionDetail: {
|
|
249
|
-
color: _sharedUi.night.color.textSecondary,
|
|
250
|
-
fontSize: _sharedUi.night.font.caption,
|
|
251
|
-
lineHeight: 17
|
|
252
|
-
},
|
|
253
|
-
hint: {
|
|
254
|
-
color: _sharedUi.night.color.textTertiary,
|
|
255
|
-
fontSize: _sharedUi.night.font.micro,
|
|
256
|
-
paddingHorizontal: 12,
|
|
257
|
-
paddingBottom: 10
|
|
258
|
-
},
|
|
259
|
-
confirmTitle: {
|
|
260
|
-
color: _sharedUi.night.color.text,
|
|
261
|
-
fontSize: _sharedUi.night.font.row,
|
|
262
|
-
fontWeight: "600",
|
|
263
|
-
paddingHorizontal: 12,
|
|
264
|
-
paddingTop: 12
|
|
265
|
-
},
|
|
266
|
-
confirmChange: {
|
|
267
|
-
color: _sharedUi.night.color.text,
|
|
268
|
-
fontSize: _sharedUi.night.font.body,
|
|
269
|
-
lineHeight: 19,
|
|
270
|
-
paddingHorizontal: 12,
|
|
271
|
-
paddingTop: 6
|
|
272
|
-
},
|
|
273
|
-
confirmConsequence: {
|
|
274
|
-
color: _sharedUi.night.color.warning,
|
|
275
|
-
fontSize: _sharedUi.night.font.caption,
|
|
276
|
-
lineHeight: 17,
|
|
277
|
-
paddingHorizontal: 12,
|
|
278
|
-
paddingTop: 6
|
|
279
|
-
},
|
|
280
|
-
confirmActions: {
|
|
281
|
-
flexDirection: "row",
|
|
282
|
-
gap: 8,
|
|
283
|
-
paddingHorizontal: 12,
|
|
284
|
-
paddingVertical: 12,
|
|
285
|
-
alignItems: "center"
|
|
286
|
-
},
|
|
287
|
-
decided: {
|
|
288
|
-
color: _sharedUi.night.color.textSecondary,
|
|
289
|
-
fontSize: _sharedUi.night.font.caption,
|
|
290
|
-
fontWeight: "600",
|
|
291
|
-
paddingHorizontal: 12,
|
|
292
|
-
paddingVertical: 10
|
|
293
|
-
},
|
|
294
|
-
inputRow: {
|
|
295
|
-
flexDirection: "row",
|
|
296
|
-
alignItems: "center",
|
|
297
|
-
gap: 8,
|
|
298
|
-
paddingHorizontal: 12,
|
|
299
|
-
paddingBottom: 12
|
|
300
|
-
},
|
|
301
|
-
input: {
|
|
302
|
-
flex: 1,
|
|
303
|
-
height: 38,
|
|
304
|
-
paddingHorizontal: 12,
|
|
305
|
-
borderRadius: _sharedUi.night.radius.row,
|
|
306
|
-
backgroundColor: _sharedUi.night.color.surfaceElevated,
|
|
307
|
-
color: _sharedUi.night.color.text,
|
|
308
|
-
fontSize: _sharedUi.night.font.body
|
|
309
|
-
},
|
|
310
|
-
button: {
|
|
311
|
-
paddingHorizontal: 14,
|
|
312
|
-
paddingVertical: 9,
|
|
313
|
-
borderRadius: _sharedUi.night.radius.row
|
|
314
|
-
},
|
|
315
|
-
buttonPrimary: {
|
|
316
|
-
backgroundColor: _sharedUi.night.color.accent
|
|
317
|
-
},
|
|
318
|
-
buttonPlate: {
|
|
319
|
-
backgroundColor: _sharedUi.night.color.button
|
|
320
|
-
},
|
|
321
|
-
buttonDisabled: {
|
|
322
|
-
opacity: 0.5
|
|
323
|
-
},
|
|
324
|
-
buttonTextPrimary: {
|
|
325
|
-
color: _sharedUi.night.color.onAccent,
|
|
326
|
-
fontSize: _sharedUi.night.font.caption,
|
|
327
|
-
fontWeight: "600"
|
|
328
|
-
},
|
|
329
|
-
buttonTextPlate: {
|
|
330
|
-
color: _sharedUi.night.color.text,
|
|
331
|
-
fontSize: _sharedUi.night.font.caption,
|
|
332
|
-
fontWeight: "600"
|
|
333
|
-
},
|
|
334
|
-
pressed: {
|
|
335
|
-
opacity: 0.7
|
|
336
|
-
}
|
|
337
|
-
});
|
|
338
|
-
//# sourceMappingURL=AskBlocks.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Choice=Choice;exports.Confirm=Confirm;exports.Input=Input;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _context=require("./context");var _icons=require("./icons");var _primitives=require("./primitives");var _jsxRuntime=require("react/jsx-runtime");function Choice({block:e}){const i=(0,_context.useBlockHandlers)();const n=i.answered[e.id];const l=n?.kind==="choice"?n.optionId:null;const o=!!n;return(0,_jsxRuntime.jsxs)(_primitives.Card,{testID:`buoy-block-choice-${e.id}`,tone:o?void 0:"info",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.question,children:e.question}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.options,children:e.options.slice(0,5).map((t,a)=>{const r=l===t.id;return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{testID:`buoy-block-option-${t.id}`,accessibilityRole:"button",accessibilityState:{selected:r,disabled:o},disabled:o,onPress:()=>i.answer({blockId:e.id,kind:"choice",optionId:t.id,label:t.label}),style:({pressed:s})=>[styles.option,a>0&&styles.optionDivider,r&&styles.optionChosen,o&&!r&&styles.optionDimmed,s&&!o&&styles.pressed],children:[t.icon?(0,_jsxRuntime.jsx)(_icons.BlockIcon,{name:t.icon}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.optionText,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.optionLabel,r&&styles.optionLabelChosen],children:t.label}),t.detail?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.optionDetail,children:t.detail}):null]}),r?(0,_jsxRuntime.jsx)(_sharedUi.Check,{size:14,color:_sharedUi.night.color.accent}):o?null:(0,_jsxRuntime.jsx)(_sharedUi.ChevronRight,{size:14,color:_sharedUi.night.color.textTertiary})]},t.id)})}),!o&&e.allowFreeText!==false?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.hint,children:"Or just type your answer below."}):null]})}function Confirm({block:e}){const i=(0,_context.useBlockHandlers)();const n=i.answered[e.id];const l=!!n;const o=n?.kind==="confirm"?n.approved:null;return(0,_jsxRuntime.jsxs)(_primitives.Card,{testID:`buoy-block-confirm-${e.id}`,tone:l?void 0:"warning",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.confirmTitle,children:e.title}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.confirmChange,children:e.change}),e.consequence?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.confirmConsequence,children:e.consequence}):null,(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.confirmActions,children:l?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.decided,children:o?`\u2713 ${e.approveLabel??"Done"}`:`\u2715 ${e.declineLabel??"Not now"}`}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNative.Pressable,{testID:"buoy-block-approve",accessibilityRole:"button",onPress:()=>i.answer({blockId:e.id,kind:"confirm",approved:true}),style:({pressed:t})=>[styles.button,styles.buttonPrimary,t&&styles.pressed],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.buttonTextPrimary,children:e.approveLabel??"Do it"})}),(0,_jsxRuntime.jsx)(_reactNative.Pressable,{testID:"buoy-block-decline",accessibilityRole:"button",onPress:()=>i.answer({blockId:e.id,kind:"confirm",approved:false}),style:({pressed:t})=>[styles.button,styles.buttonPlate,t&&styles.pressed],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.buttonTextPlate,children:e.declineLabel??"Not now"})})]})})]})}function Input({block:e}){const i=(0,_context.useBlockHandlers)();const n=i.answered[e.id];const l=!!n;const[o,t]=(0,_react.useState)("");const a=e.type==="secret";const r=()=>{const s=o.trim();if(!s)return;i.answer({blockId:e.id,kind:"input",value:s})};return(0,_jsxRuntime.jsxs)(_primitives.Card,{testID:`buoy-block-input-${e.id}`,tone:l?void 0:"info",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.question,children:e.label}),l?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.decided,children:n.kind==="input"?a?"\u2022\u2022\u2022\u2022\u2022\u2022":n.value:"(skipped)"}):(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.inputRow,children:[(0,_jsxRuntime.jsx)(_reactNative.TextInput,{testID:"buoy-block-input-field",style:styles.input,value:o,onChangeText:t,placeholder:e.placeholder??"",placeholderTextColor:_sharedUi.night.color.placeholder,keyboardType:e.type==="number"?"numeric":"ascii-capable",secureTextEntry:a,autoCapitalize:"none",autoCorrect:false,returnKeyType:"send",onSubmitEditing:r}),(0,_jsxRuntime.jsx)(_reactNative.Pressable,{testID:"buoy-block-input-submit",accessibilityRole:"button",disabled:!o.trim(),onPress:r,style:({pressed:s})=>[styles.button,styles.buttonPrimary,!o.trim()&&styles.buttonDisabled,s&&styles.pressed],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.buttonTextPrimary,children:e.submitLabel??"Send"})})]})]})}const styles=_reactNative.StyleSheet.create({question:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.row,fontWeight:"600",lineHeight:20,paddingHorizontal:12,paddingTop:12,paddingBottom:8},options:{marginHorizontal:8,marginBottom:8,borderRadius:_sharedUi.night.radius.row,backgroundColor:_sharedUi.night.color.surfaceElevated,overflow:"hidden"},option:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:12,paddingVertical:11},optionDivider:{borderTopWidth:_reactNative.StyleSheet.hairlineWidth,borderTopColor:_sharedUi.night.color.separator},optionChosen:{backgroundColor:_sharedUi.night.color.accentSoft},optionDimmed:{opacity:.45},optionText:{flex:1,gap:2},optionLabel:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.body,fontWeight:"500"},optionLabelChosen:{color:_sharedUi.night.color.accent},optionDetail:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,lineHeight:17},hint:{color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.micro,paddingHorizontal:12,paddingBottom:10},confirmTitle:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.row,fontWeight:"600",paddingHorizontal:12,paddingTop:12},confirmChange:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.body,lineHeight:19,paddingHorizontal:12,paddingTop:6},confirmConsequence:{color:_sharedUi.night.color.warning,fontSize:_sharedUi.night.font.caption,lineHeight:17,paddingHorizontal:12,paddingTop:6},confirmActions:{flexDirection:"row",gap:8,paddingHorizontal:12,paddingVertical:12,alignItems:"center"},decided:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.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:_sharedUi.night.radius.row,backgroundColor:_sharedUi.night.color.surfaceElevated,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.body},button:{paddingHorizontal:14,paddingVertical:9,borderRadius:_sharedUi.night.radius.row},buttonPrimary:{backgroundColor:_sharedUi.night.color.accent},buttonPlate:{backgroundColor:_sharedUi.night.color.button},buttonDisabled:{opacity:.5},buttonTextPrimary:{color:_sharedUi.night.color.onAccent,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},buttonTextPlate:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},pressed:{opacity:.7}});
|