@buoy-gg/ask-buoy 7.0.34 → 7.0.36
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 +35 -8
- package/lib/commonjs/blocks/AskBlocks.js +338 -1
- package/lib/commonjs/blocks/AskBlocks.js.map +1 -0
- package/lib/commonjs/blocks/BlockRenderer.js +262 -1
- package/lib/commonjs/blocks/BlockRenderer.js.map +1 -0
- package/lib/commonjs/blocks/ChromePrototypes.js +514 -1
- package/lib/commonjs/blocks/ChromePrototypes.js.map +1 -0
- package/lib/commonjs/blocks/DataBlocks.js +781 -1
- package/lib/commonjs/blocks/DataBlocks.js.map +1 -0
- package/lib/commonjs/blocks/ExtraBlocks.js +1860 -1
- package/lib/commonjs/blocks/ExtraBlocks.js.map +1 -0
- package/lib/commonjs/blocks/MediaBlocks.js +156 -1
- package/lib/commonjs/blocks/MediaBlocks.js.map +1 -0
- package/lib/commonjs/blocks/ReceiptBlocks.js +586 -1
- package/lib/commonjs/blocks/ReceiptBlocks.js.map +1 -0
- package/lib/commonjs/blocks/blockText.js +60 -0
- package/lib/commonjs/blocks/blockText.js.map +1 -0
- package/lib/commonjs/blocks/blockText.test.js +53 -0
- package/lib/commonjs/blocks/blockText.test.js.map +1 -0
- package/lib/commonjs/blocks/context.js +42 -1
- package/lib/commonjs/blocks/context.js.map +1 -0
- package/lib/commonjs/blocks/icons.js +96 -1
- package/lib/commonjs/blocks/icons.js.map +1 -0
- package/lib/commonjs/blocks/index.js +95 -1
- package/lib/commonjs/blocks/index.js.map +1 -0
- package/lib/commonjs/blocks/listRow.test.js +55 -0
- package/lib/commonjs/blocks/listRow.test.js.map +1 -0
- package/lib/commonjs/blocks/pageState.js +34 -0
- package/lib/commonjs/blocks/pageState.js.map +1 -0
- package/lib/commonjs/blocks/pageState.test.js +57 -0
- package/lib/commonjs/blocks/pageState.test.js.map +1 -0
- package/lib/commonjs/blocks/primitives.js +457 -1
- package/lib/commonjs/blocks/primitives.js.map +1 -0
- package/lib/commonjs/blocks/primitivesIndex.js +62 -1
- package/lib/commonjs/blocks/primitivesIndex.js.map +1 -0
- package/lib/commonjs/components/ApprovalCard.js +244 -1
- package/lib/commonjs/components/ApprovalCard.js.map +1 -0
- package/lib/commonjs/components/AskBuoyHeader.js +196 -1
- package/lib/commonjs/components/AskBuoyHeader.js.map +1 -0
- package/lib/commonjs/components/AskBuoyIcon.js +19 -1
- package/lib/commonjs/components/AskBuoyIcon.js.map +1 -0
- package/lib/commonjs/components/AskBuoyModal.js +479 -1
- package/lib/commonjs/components/AskBuoyModal.js.map +1 -0
- package/lib/commonjs/components/AskBuoySettings.js +119 -0
- package/lib/commonjs/components/AskBuoySettings.js.map +1 -0
- package/lib/commonjs/components/ChangesBar.js +211 -1
- package/lib/commonjs/components/ChangesBar.js.map +1 -0
- package/lib/commonjs/components/Composer.js +255 -1
- package/lib/commonjs/components/Composer.js.map +1 -0
- package/lib/commonjs/components/EmptyState.js +161 -1
- package/lib/commonjs/components/EmptyState.js.map +1 -0
- package/lib/commonjs/components/KeyboardPad.js +80 -0
- package/lib/commonjs/components/KeyboardPad.js.map +1 -0
- package/lib/commonjs/components/Markdown.js +310 -1
- package/lib/commonjs/components/Markdown.js.map +1 -0
- package/lib/commonjs/components/MessageList.js +930 -1
- package/lib/commonjs/components/MessageList.js.map +1 -0
- package/lib/commonjs/components/QueuedMessages.js +145 -0
- package/lib/commonjs/components/QueuedMessages.js.map +1 -0
- package/lib/commonjs/components/ThinkingStrip.js +223 -0
- package/lib/commonjs/components/ThinkingStrip.js.map +1 -0
- package/lib/commonjs/components/TypingDots.js +63 -1
- package/lib/commonjs/components/TypingDots.js.map +1 -0
- package/lib/commonjs/components/markdownParse.js +131 -0
- package/lib/commonjs/components/markdownParse.js.map +1 -0
- package/lib/commonjs/components/markdownParse.test.js +99 -0
- package/lib/commonjs/components/markdownParse.test.js.map +1 -0
- package/lib/commonjs/components/useCopyAction.js +50 -0
- package/lib/commonjs/components/useCopyAction.js.map +1 -0
- package/lib/commonjs/index.js +252 -1
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/preset.js +90 -1
- package/lib/commonjs/preset.js.map +1 -0
- package/lib/commonjs/store/activityGroups.js +110 -0
- package/lib/commonjs/store/activityGroups.js.map +1 -0
- package/lib/commonjs/store/activityGroups.test.js +78 -0
- package/lib/commonjs/store/activityGroups.test.js.map +1 -0
- package/lib/commonjs/store/askBuoySettings.js +72 -0
- package/lib/commonjs/store/askBuoySettings.js.map +1 -0
- package/lib/commonjs/store/askBuoyStore.js +547 -1
- package/lib/commonjs/store/askBuoyStore.js.map +1 -0
- package/lib/commonjs/store/blockPlacement.js +64 -0
- package/lib/commonjs/store/blockPlacement.js.map +1 -0
- package/lib/commonjs/store/blockPlacement.test.js +123 -0
- package/lib/commonjs/store/blockPlacement.test.js.map +1 -0
- package/lib/commonjs/store/queue.test.js +150 -0
- package/lib/commonjs/store/queue.test.js.map +1 -0
- package/lib/commonjs/store/resetConversation.js +77 -0
- package/lib/commonjs/store/resetConversation.js.map +1 -0
- package/lib/commonjs/store/restorePending.test.js +63 -0
- package/lib/commonjs/store/restorePending.test.js.map +1 -0
- package/lib/commonjs/store/restoredIds.test.js +47 -0
- package/lib/commonjs/store/restoredIds.test.js.map +1 -0
- package/lib/commonjs/store/suggestions.js +54 -0
- package/lib/commonjs/store/suggestions.js.map +1 -0
- package/lib/commonjs/store/suggestions.test.js +58 -0
- package/lib/commonjs/store/suggestions.test.js.map +1 -0
- package/lib/commonjs/store/systemLine.test.js +77 -0
- package/lib/commonjs/store/systemLine.test.js.map +1 -0
- package/lib/commonjs/store/ticketPrompt.js +17 -0
- package/lib/commonjs/store/ticketPrompt.js.map +1 -0
- package/lib/commonjs/store/traceText.js +81 -0
- package/lib/commonjs/store/traceText.js.map +1 -0
- package/lib/commonjs/store/traceText.test.js +112 -0
- package/lib/commonjs/store/traceText.test.js.map +1 -0
- package/lib/commonjs/store/transcriptPersistence.js +297 -0
- package/lib/commonjs/store/transcriptPersistence.js.map +1 -0
- package/lib/commonjs/store/transcriptPersistence.test.js +333 -0
- package/lib/commonjs/store/transcriptPersistence.test.js.map +1 -0
- package/lib/commonjs/store/turnRendering.test.js +151 -0
- package/lib/commonjs/store/turnRendering.test.js.map +1 -0
- package/lib/commonjs/store/useAskBuoy.js +622 -1
- package/lib/commonjs/store/useAskBuoy.js.map +1 -0
- package/lib/commonjs/store/useAskBuoySettings.js +14 -0
- package/lib/commonjs/store/useAskBuoySettings.js.map +1 -0
- package/lib/commonjs/sync/askBuoySyncAdapter.js +140 -1
- package/lib/commonjs/sync/askBuoySyncAdapter.js.map +1 -0
- package/lib/commonjs/sync/askBuoySyncAdapter.test.js +141 -1
- package/lib/commonjs/sync/askBuoySyncAdapter.test.js.map +1 -0
- package/lib/commonjs/sync/wire.js +58 -1
- package/lib/commonjs/sync/wire.js.map +1 -0
- package/lib/commonjs/types.js +6 -1
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/blocks/AskBlocks.js +331 -1
- package/lib/module/blocks/AskBlocks.js.map +1 -0
- package/lib/module/blocks/BlockRenderer.js +257 -1
- package/lib/module/blocks/BlockRenderer.js.map +1 -0
- package/lib/module/blocks/ChromePrototypes.js +503 -1
- package/lib/module/blocks/ChromePrototypes.js.map +1 -0
- package/lib/module/blocks/DataBlocks.js +767 -1
- package/lib/module/blocks/DataBlocks.js.map +1 -0
- package/lib/module/blocks/ExtraBlocks.js +1833 -1
- package/lib/module/blocks/ExtraBlocks.js.map +1 -0
- package/lib/module/blocks/MediaBlocks.js +151 -1
- package/lib/module/blocks/MediaBlocks.js.map +1 -0
- package/lib/module/blocks/ReceiptBlocks.js +574 -1
- package/lib/module/blocks/ReceiptBlocks.js.map +1 -0
- package/lib/module/blocks/blockText.js +55 -0
- package/lib/module/blocks/blockText.js.map +1 -0
- package/lib/module/blocks/blockText.test.js +53 -0
- package/lib/module/blocks/blockText.test.js.map +1 -0
- package/lib/module/blocks/context.js +35 -1
- package/lib/module/blocks/context.js.map +1 -0
- package/lib/module/blocks/icons.js +91 -1
- package/lib/module/blocks/icons.js.map +1 -0
- package/lib/module/blocks/index.js +8 -1
- package/lib/module/blocks/index.js.map +1 -0
- package/lib/module/blocks/listRow.test.js +56 -0
- package/lib/module/blocks/listRow.test.js.map +1 -0
- package/lib/module/blocks/pageState.js +30 -0
- package/lib/module/blocks/pageState.js.map +1 -0
- package/lib/module/blocks/pageState.test.js +56 -0
- package/lib/module/blocks/pageState.test.js.map +1 -0
- package/lib/module/blocks/primitives.js +445 -1
- package/lib/module/blocks/primitives.js.map +1 -0
- package/lib/module/blocks/primitivesIndex.js +5 -1
- package/lib/module/blocks/primitivesIndex.js.map +1 -0
- package/lib/module/components/ApprovalCard.js +239 -1
- package/lib/module/components/ApprovalCard.js.map +1 -0
- package/lib/module/components/AskBuoyHeader.js +193 -1
- package/lib/module/components/AskBuoyHeader.js.map +1 -0
- package/lib/module/components/AskBuoyIcon.js +8 -1
- package/lib/module/components/AskBuoyIcon.js.map +1 -0
- package/lib/module/components/AskBuoyModal.js +474 -1
- package/lib/module/components/AskBuoyModal.js.map +1 -0
- package/lib/module/components/AskBuoySettings.js +114 -0
- package/lib/module/components/AskBuoySettings.js.map +1 -0
- package/lib/module/components/ChangesBar.js +206 -1
- package/lib/module/components/ChangesBar.js.map +1 -0
- package/lib/module/components/Composer.js +250 -1
- package/lib/module/components/Composer.js.map +1 -0
- package/lib/module/components/EmptyState.js +156 -1
- package/lib/module/components/EmptyState.js.map +1 -0
- package/lib/module/components/KeyboardPad.js +75 -0
- package/lib/module/components/KeyboardPad.js.map +1 -0
- package/lib/module/components/Markdown.js +305 -1
- package/lib/module/components/Markdown.js.map +1 -0
- package/lib/module/components/MessageList.js +924 -1
- package/lib/module/components/MessageList.js.map +1 -0
- package/lib/module/components/QueuedMessages.js +140 -0
- package/lib/module/components/QueuedMessages.js.map +1 -0
- package/lib/module/components/ThinkingStrip.js +218 -0
- package/lib/module/components/ThinkingStrip.js.map +1 -0
- package/lib/module/components/TypingDots.js +58 -1
- package/lib/module/components/TypingDots.js.map +1 -0
- package/lib/module/components/markdownParse.js +125 -0
- package/lib/module/components/markdownParse.js.map +1 -0
- package/lib/module/components/markdownParse.test.js +98 -0
- package/lib/module/components/markdownParse.test.js.map +1 -0
- package/lib/module/components/useCopyAction.js +46 -0
- package/lib/module/components/useCopyAction.js.map +1 -0
- package/lib/module/index.js +34 -1
- package/lib/module/index.js.map +1 -0
- package/lib/module/preset.js +73 -1
- package/lib/module/preset.js.map +1 -0
- package/lib/module/store/activityGroups.js +103 -0
- package/lib/module/store/activityGroups.js.map +1 -0
- package/lib/module/store/activityGroups.test.js +77 -0
- package/lib/module/store/activityGroups.test.js.map +1 -0
- package/lib/module/store/askBuoySettings.js +67 -0
- package/lib/module/store/askBuoySettings.js.map +1 -0
- package/lib/module/store/askBuoyStore.js +541 -1
- package/lib/module/store/askBuoyStore.js.map +1 -0
- package/lib/module/store/blockPlacement.js +59 -0
- package/lib/module/store/blockPlacement.js.map +1 -0
- package/lib/module/store/blockPlacement.test.js +122 -0
- package/lib/module/store/blockPlacement.test.js.map +1 -0
- package/lib/module/store/queue.test.js +149 -0
- package/lib/module/store/queue.test.js.map +1 -0
- package/lib/module/store/resetConversation.js +72 -0
- package/lib/module/store/resetConversation.js.map +1 -0
- package/lib/module/store/restorePending.test.js +62 -0
- package/lib/module/store/restorePending.test.js.map +1 -0
- package/lib/module/store/restoredIds.test.js +46 -0
- package/lib/module/store/restoredIds.test.js.map +1 -0
- package/lib/module/store/suggestions.js +49 -0
- package/lib/module/store/suggestions.js.map +1 -0
- package/lib/module/store/suggestions.test.js +57 -0
- package/lib/module/store/suggestions.test.js.map +1 -0
- package/lib/module/store/systemLine.test.js +76 -0
- package/lib/module/store/systemLine.test.js.map +1 -0
- package/lib/module/store/ticketPrompt.js +13 -0
- package/lib/module/store/ticketPrompt.js.map +1 -0
- package/lib/module/store/traceText.js +75 -0
- package/lib/module/store/traceText.js.map +1 -0
- package/lib/module/store/traceText.test.js +111 -0
- package/lib/module/store/traceText.test.js.map +1 -0
- package/lib/module/store/transcriptPersistence.js +287 -0
- package/lib/module/store/transcriptPersistence.js.map +1 -0
- package/lib/module/store/transcriptPersistence.test.js +332 -0
- package/lib/module/store/transcriptPersistence.test.js.map +1 -0
- package/lib/module/store/turnRendering.test.js +150 -0
- package/lib/module/store/turnRendering.test.js.map +1 -0
- package/lib/module/store/useAskBuoy.js +616 -1
- package/lib/module/store/useAskBuoy.js.map +1 -0
- package/lib/module/store/useAskBuoySettings.js +9 -0
- package/lib/module/store/useAskBuoySettings.js.map +1 -0
- package/lib/module/sync/askBuoySyncAdapter.js +135 -1
- package/lib/module/sync/askBuoySyncAdapter.js.map +1 -0
- package/lib/module/sync/askBuoySyncAdapter.test.js +140 -1
- package/lib/module/sync/askBuoySyncAdapter.test.js.map +1 -0
- package/lib/module/sync/wire.js +47 -1
- package/lib/module/sync/wire.js.map +1 -0
- package/lib/module/types.js +4 -1
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/blocks/AskBlocks.d.ts.map +1 -0
- package/lib/typescript/blocks/BlockRenderer.d.ts.map +1 -0
- package/lib/typescript/blocks/ChromePrototypes.d.ts.map +1 -0
- package/lib/typescript/blocks/DataBlocks.d.ts +42 -0
- package/lib/typescript/blocks/DataBlocks.d.ts.map +1 -0
- package/lib/typescript/blocks/ExtraBlocks.d.ts +29 -2
- package/lib/typescript/blocks/ExtraBlocks.d.ts.map +1 -0
- package/lib/typescript/blocks/MediaBlocks.d.ts.map +1 -0
- package/lib/typescript/blocks/ReceiptBlocks.d.ts.map +1 -0
- package/lib/typescript/blocks/blockText.d.ts +14 -0
- package/lib/typescript/blocks/blockText.d.ts.map +1 -0
- package/lib/typescript/blocks/blockText.test.d.ts +2 -0
- package/lib/typescript/blocks/blockText.test.d.ts.map +1 -0
- package/lib/typescript/blocks/context.d.ts.map +1 -0
- package/lib/typescript/blocks/icons.d.ts.map +1 -0
- package/lib/typescript/blocks/index.d.ts.map +1 -0
- package/lib/typescript/blocks/listRow.test.d.ts +2 -0
- package/lib/typescript/blocks/listRow.test.d.ts.map +1 -0
- package/lib/typescript/blocks/pageState.d.ts +23 -0
- package/lib/typescript/blocks/pageState.d.ts.map +1 -0
- package/lib/typescript/blocks/pageState.test.d.ts +2 -0
- package/lib/typescript/blocks/pageState.test.d.ts.map +1 -0
- package/lib/typescript/blocks/primitives.d.ts +55 -10
- package/lib/typescript/blocks/primitives.d.ts.map +1 -0
- package/lib/typescript/blocks/primitivesIndex.d.ts +2 -1
- package/lib/typescript/blocks/primitivesIndex.d.ts.map +1 -0
- package/lib/typescript/components/ApprovalCard.d.ts.map +1 -0
- package/lib/typescript/components/AskBuoyHeader.d.ts +41 -1
- package/lib/typescript/components/AskBuoyHeader.d.ts.map +1 -0
- package/lib/typescript/components/AskBuoyIcon.d.ts.map +1 -0
- package/lib/typescript/components/AskBuoyModal.d.ts.map +1 -0
- package/lib/typescript/components/AskBuoySettings.d.ts +2 -0
- package/lib/typescript/components/AskBuoySettings.d.ts.map +1 -0
- package/lib/typescript/components/ChangesBar.d.ts.map +1 -0
- package/lib/typescript/components/Composer.d.ts +16 -1
- package/lib/typescript/components/Composer.d.ts.map +1 -0
- package/lib/typescript/components/EmptyState.d.ts +5 -1
- package/lib/typescript/components/EmptyState.d.ts.map +1 -0
- package/lib/typescript/components/KeyboardPad.d.ts +33 -0
- package/lib/typescript/components/KeyboardPad.d.ts.map +1 -0
- package/lib/typescript/components/Markdown.d.ts +0 -10
- package/lib/typescript/components/Markdown.d.ts.map +1 -0
- package/lib/typescript/components/MessageList.d.ts +19 -7
- package/lib/typescript/components/MessageList.d.ts.map +1 -0
- package/lib/typescript/components/QueuedMessages.d.ts +10 -0
- package/lib/typescript/components/QueuedMessages.d.ts.map +1 -0
- package/lib/typescript/components/ThinkingStrip.d.ts +5 -0
- package/lib/typescript/components/ThinkingStrip.d.ts.map +1 -0
- package/lib/typescript/components/TypingDots.d.ts.map +1 -0
- package/lib/typescript/components/markdownParse.d.ts +49 -0
- package/lib/typescript/components/markdownParse.d.ts.map +1 -0
- package/lib/typescript/components/markdownParse.test.d.ts +2 -0
- package/lib/typescript/components/markdownParse.test.d.ts.map +1 -0
- package/lib/typescript/components/useCopyAction.d.ts +5 -0
- package/lib/typescript/components/useCopyAction.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +5 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/preset.d.ts.map +1 -0
- package/lib/typescript/store/activityGroups.d.ts +29 -0
- package/lib/typescript/store/activityGroups.d.ts.map +1 -0
- package/lib/typescript/store/activityGroups.test.d.ts +2 -0
- package/lib/typescript/store/activityGroups.test.d.ts.map +1 -0
- package/lib/typescript/store/askBuoySettings.d.ts +44 -0
- package/lib/typescript/store/askBuoySettings.d.ts.map +1 -0
- package/lib/typescript/store/askBuoyStore.d.ts +216 -18
- package/lib/typescript/store/askBuoyStore.d.ts.map +1 -0
- package/lib/typescript/store/blockPlacement.d.ts +30 -0
- package/lib/typescript/store/blockPlacement.d.ts.map +1 -0
- package/lib/typescript/store/blockPlacement.test.d.ts +2 -0
- package/lib/typescript/store/blockPlacement.test.d.ts.map +1 -0
- package/lib/typescript/store/queue.test.d.ts +2 -0
- package/lib/typescript/store/queue.test.d.ts.map +1 -0
- package/lib/typescript/store/resetConversation.d.ts +38 -0
- package/lib/typescript/store/resetConversation.d.ts.map +1 -0
- package/lib/typescript/store/restorePending.test.d.ts +2 -0
- package/lib/typescript/store/restorePending.test.d.ts.map +1 -0
- package/lib/typescript/store/restoredIds.test.d.ts +2 -0
- package/lib/typescript/store/restoredIds.test.d.ts.map +1 -0
- package/lib/typescript/store/suggestions.d.ts +32 -0
- package/lib/typescript/store/suggestions.d.ts.map +1 -0
- package/lib/typescript/store/suggestions.test.d.ts +2 -0
- package/lib/typescript/store/suggestions.test.d.ts.map +1 -0
- package/lib/typescript/store/systemLine.test.d.ts +2 -0
- package/lib/typescript/store/systemLine.test.d.ts.map +1 -0
- package/lib/typescript/store/ticketPrompt.d.ts +11 -0
- package/lib/typescript/store/ticketPrompt.d.ts.map +1 -0
- package/lib/typescript/store/traceText.d.ts +33 -0
- package/lib/typescript/store/traceText.d.ts.map +1 -0
- package/lib/typescript/store/traceText.test.d.ts +2 -0
- package/lib/typescript/store/traceText.test.d.ts.map +1 -0
- package/lib/typescript/store/transcriptPersistence.d.ts +79 -0
- package/lib/typescript/store/transcriptPersistence.d.ts.map +1 -0
- package/lib/typescript/store/transcriptPersistence.test.d.ts +2 -0
- package/lib/typescript/store/transcriptPersistence.test.d.ts.map +1 -0
- package/lib/typescript/store/turnRendering.test.d.ts +2 -0
- package/lib/typescript/store/turnRendering.test.d.ts.map +1 -0
- package/lib/typescript/store/useAskBuoy.d.ts +23 -1
- package/lib/typescript/store/useAskBuoy.d.ts.map +1 -0
- package/lib/typescript/store/useAskBuoySettings.d.ts +3 -0
- package/lib/typescript/store/useAskBuoySettings.d.ts.map +1 -0
- package/lib/typescript/sync/askBuoySyncAdapter.d.ts +26 -6
- package/lib/typescript/sync/askBuoySyncAdapter.d.ts.map +1 -0
- package/lib/typescript/sync/askBuoySyncAdapter.test.d.ts.map +1 -0
- package/lib/typescript/sync/wire.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +24 -1
- package/lib/typescript/types.d.ts.map +1 -0
- package/package.json +9 -9
|
@@ -1 +1,206 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* "The agent changed things" — the bar, and the list behind it.
|
|
5
|
+
*
|
|
6
|
+
* Ask Buoy mutates without asking, so this is what keeps the user in control:
|
|
7
|
+
* if reality has been bent, you can never not know it. Same principle as the
|
|
8
|
+
* impersonate and override banners.
|
|
9
|
+
*
|
|
10
|
+
* It counts REVERSIBLE and ONE-SHOT effects separately, which is the one place
|
|
11
|
+
* this deliberately differs from the Scenarios banner. That one folds
|
|
12
|
+
* transients into a single "N changes" total and then silently no-ops on them
|
|
13
|
+
* at revert — a user who taps Undo, sees "4 changes", and finds three of them
|
|
14
|
+
* still in place learns not to trust the bar. Better to say "1 undoable ·
|
|
15
|
+
* 1 permanent" and be believed.
|
|
16
|
+
*/
|
|
17
|
+
import { useSyncExternalStore } from "react";
|
|
18
|
+
import { Pressable, ScrollView, StyleSheet, Text, View } from "react-native";
|
|
19
|
+
import { ChevronDown, ChevronRight, night } from "@buoy-gg/shared-ui";
|
|
20
|
+
import { isReversible } from "@buoy-gg/agent-core";
|
|
21
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
+
const EMPTY = [];
|
|
23
|
+
function useLedgerEntries(ledger) {
|
|
24
|
+
return useSyncExternalStore(fn => ledger?.subscribe(fn) ?? (() => {}), () => ledger?.list() ?? EMPTY, () => ledger?.list() ?? EMPTY);
|
|
25
|
+
}
|
|
26
|
+
export function ChangesBar({
|
|
27
|
+
ledger,
|
|
28
|
+
onUndoAll,
|
|
29
|
+
expanded,
|
|
30
|
+
onToggle
|
|
31
|
+
}) {
|
|
32
|
+
const entries = useLedgerEntries(ledger);
|
|
33
|
+
const outstanding = entries.filter(e => !e.undoneAt);
|
|
34
|
+
// Transients — navigation, taps — are one-shot ACTIONS, not changes. Counting
|
|
35
|
+
// them here read "Changed this app · 9 permanent" after a read-only tour,
|
|
36
|
+
// which is the bar lying in the alarming direction. They still appear in the
|
|
37
|
+
// expanded panel's footnote, because honesty, but they raise no banner.
|
|
38
|
+
const changes = outstanding.filter(e => e.effect.kind !== "transient");
|
|
39
|
+
if (changes.length === 0) return null;
|
|
40
|
+
const reversible = changes.filter(e => isReversible(e.effect));
|
|
41
|
+
const permanent = changes.length - reversible.length;
|
|
42
|
+
const transients = outstanding.length - changes.length;
|
|
43
|
+
const Chevron = expanded ? ChevronDown : ChevronRight;
|
|
44
|
+
const counts = [reversible.length > 0 ? `${reversible.length} undoable` : null, permanent > 0 ? `${permanent} permanent` : null].filter(Boolean).join(" · ");
|
|
45
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
46
|
+
style: styles.wrap,
|
|
47
|
+
children: [/*#__PURE__*/_jsxs(Pressable, {
|
|
48
|
+
testID: "buoy-ask-buoy-changes-bar",
|
|
49
|
+
accessibilityRole: "button",
|
|
50
|
+
accessibilityState: {
|
|
51
|
+
expanded
|
|
52
|
+
},
|
|
53
|
+
onPress: onToggle,
|
|
54
|
+
style: styles.bar,
|
|
55
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
56
|
+
style: styles.dot
|
|
57
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
58
|
+
style: styles.summary,
|
|
59
|
+
numberOfLines: 1,
|
|
60
|
+
children: "Changed this app"
|
|
61
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
62
|
+
style: styles.counts,
|
|
63
|
+
numberOfLines: 1,
|
|
64
|
+
children: counts
|
|
65
|
+
}), /*#__PURE__*/_jsx(Chevron, {
|
|
66
|
+
size: 12,
|
|
67
|
+
color: night.color.textSecondary
|
|
68
|
+
})]
|
|
69
|
+
}), expanded && /*#__PURE__*/_jsxs(View, {
|
|
70
|
+
style: styles.panel,
|
|
71
|
+
children: [/*#__PURE__*/_jsxs(ScrollView, {
|
|
72
|
+
style: styles.panelScroll,
|
|
73
|
+
testID: "buoy-ask-buoy-changes-scroll",
|
|
74
|
+
keyboardShouldPersistTaps: "handled",
|
|
75
|
+
children: [changes.map(entry => {
|
|
76
|
+
const oneOff = !isReversible(entry.effect);
|
|
77
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
78
|
+
style: styles.row,
|
|
79
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
80
|
+
style: styles.rowLabel,
|
|
81
|
+
children: entry.effect.label
|
|
82
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
83
|
+
style: [styles.rowTag, oneOff && styles.rowTagMuted],
|
|
84
|
+
children: oneOff ? "Permanent" : "Undoable"
|
|
85
|
+
})]
|
|
86
|
+
}, entry.id);
|
|
87
|
+
}), transients > 0 && /*#__PURE__*/_jsx(View, {
|
|
88
|
+
style: styles.row,
|
|
89
|
+
children: /*#__PURE__*/_jsxs(Text, {
|
|
90
|
+
style: [styles.rowLabel, styles.rowLabelMuted],
|
|
91
|
+
children: ["Also did ", transients, " one-shot action", transients === 1 ? "" : "s", " (navigation, taps) \u2014 nothing to undo."]
|
|
92
|
+
})
|
|
93
|
+
})]
|
|
94
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
95
|
+
style: styles.footer,
|
|
96
|
+
children: [reversible.length > 0 && /*#__PURE__*/_jsx(Pressable, {
|
|
97
|
+
testID: "buoy-ask-buoy-undo-all",
|
|
98
|
+
accessibilityRole: "button",
|
|
99
|
+
onPress: onUndoAll,
|
|
100
|
+
style: ({
|
|
101
|
+
pressed
|
|
102
|
+
}) => [styles.undo, pressed && styles.pressed],
|
|
103
|
+
children: /*#__PURE__*/_jsxs(Text, {
|
|
104
|
+
style: styles.undoText,
|
|
105
|
+
children: ["Undo ", reversible.length, " change", reversible.length === 1 ? "" : "s"]
|
|
106
|
+
})
|
|
107
|
+
}), permanent > 0 && /*#__PURE__*/_jsx(Text, {
|
|
108
|
+
style: styles.footnote,
|
|
109
|
+
children: "Permanent changes can't be undone from here."
|
|
110
|
+
})]
|
|
111
|
+
})]
|
|
112
|
+
})]
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
const styles = StyleSheet.create({
|
|
116
|
+
wrap: {
|
|
117
|
+
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
118
|
+
borderBottomColor: night.color.border,
|
|
119
|
+
backgroundColor: night.color.warningSoft
|
|
120
|
+
},
|
|
121
|
+
bar: {
|
|
122
|
+
flexDirection: "row",
|
|
123
|
+
alignItems: "center",
|
|
124
|
+
gap: 8,
|
|
125
|
+
paddingHorizontal: night.gutter,
|
|
126
|
+
paddingVertical: 10
|
|
127
|
+
},
|
|
128
|
+
dot: {
|
|
129
|
+
width: 7,
|
|
130
|
+
height: 7,
|
|
131
|
+
borderRadius: 4,
|
|
132
|
+
backgroundColor: night.color.warning
|
|
133
|
+
},
|
|
134
|
+
summary: {
|
|
135
|
+
color: night.color.text,
|
|
136
|
+
fontSize: night.font.caption,
|
|
137
|
+
fontWeight: "600"
|
|
138
|
+
},
|
|
139
|
+
counts: {
|
|
140
|
+
flex: 1,
|
|
141
|
+
color: night.color.textSecondary,
|
|
142
|
+
fontSize: night.font.caption
|
|
143
|
+
},
|
|
144
|
+
panel: {
|
|
145
|
+
paddingHorizontal: night.gutter,
|
|
146
|
+
paddingBottom: 12,
|
|
147
|
+
gap: 10
|
|
148
|
+
},
|
|
149
|
+
panelScroll: {
|
|
150
|
+
maxHeight: 180
|
|
151
|
+
},
|
|
152
|
+
row: {
|
|
153
|
+
flexDirection: "row",
|
|
154
|
+
alignItems: "flex-start",
|
|
155
|
+
gap: 10,
|
|
156
|
+
paddingVertical: 8,
|
|
157
|
+
borderTopWidth: StyleSheet.hairlineWidth,
|
|
158
|
+
borderTopColor: night.color.separator
|
|
159
|
+
},
|
|
160
|
+
rowLabel: {
|
|
161
|
+
flex: 1,
|
|
162
|
+
color: night.color.text,
|
|
163
|
+
fontSize: night.font.caption,
|
|
164
|
+
lineHeight: 18
|
|
165
|
+
},
|
|
166
|
+
rowTag: {
|
|
167
|
+
color: night.color.accent,
|
|
168
|
+
fontSize: night.font.micro,
|
|
169
|
+
fontWeight: "600",
|
|
170
|
+
letterSpacing: 0.6,
|
|
171
|
+
textTransform: "uppercase",
|
|
172
|
+
paddingTop: 2
|
|
173
|
+
},
|
|
174
|
+
rowTagMuted: {
|
|
175
|
+
color: night.color.textTertiary
|
|
176
|
+
},
|
|
177
|
+
rowLabelMuted: {
|
|
178
|
+
color: night.color.textTertiary
|
|
179
|
+
},
|
|
180
|
+
footer: {
|
|
181
|
+
flexDirection: "row",
|
|
182
|
+
alignItems: "center",
|
|
183
|
+
gap: 12,
|
|
184
|
+
flexWrap: "wrap"
|
|
185
|
+
},
|
|
186
|
+
undo: {
|
|
187
|
+
paddingHorizontal: 14,
|
|
188
|
+
paddingVertical: 8,
|
|
189
|
+
borderRadius: night.radius.row,
|
|
190
|
+
backgroundColor: night.color.button
|
|
191
|
+
},
|
|
192
|
+
undoText: {
|
|
193
|
+
color: night.color.accent,
|
|
194
|
+
fontSize: night.font.caption,
|
|
195
|
+
fontWeight: "600"
|
|
196
|
+
},
|
|
197
|
+
footnote: {
|
|
198
|
+
flex: 1,
|
|
199
|
+
color: night.color.textTertiary,
|
|
200
|
+
fontSize: night.font.micro
|
|
201
|
+
},
|
|
202
|
+
pressed: {
|
|
203
|
+
opacity: 0.7
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
//# sourceMappingURL=ChangesBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useSyncExternalStore","Pressable","ScrollView","StyleSheet","Text","View","ChevronDown","ChevronRight","night","isReversible","jsx","_jsx","jsxs","_jsxs","EMPTY","useLedgerEntries","ledger","fn","subscribe","list","ChangesBar","onUndoAll","expanded","onToggle","entries","outstanding","filter","e","undoneAt","changes","effect","kind","length","reversible","permanent","transients","Chevron","counts","Boolean","join","style","styles","wrap","children","testID","accessibilityRole","accessibilityState","onPress","bar","dot","summary","numberOfLines","size","color","textSecondary","panel","panelScroll","keyboardShouldPersistTaps","map","entry","oneOff","row","rowLabel","label","rowTag","rowTagMuted","id","rowLabelMuted","footer","pressed","undo","undoText","footnote","create","borderBottomWidth","hairlineWidth","borderBottomColor","border","backgroundColor","warningSoft","flexDirection","alignItems","gap","paddingHorizontal","gutter","paddingVertical","width","height","borderRadius","warning","text","fontSize","font","caption","fontWeight","flex","paddingBottom","maxHeight","borderTopWidth","borderTopColor","separator","lineHeight","accent","micro","letterSpacing","textTransform","paddingTop","textTertiary","flexWrap","radius","button","opacity"],"sourceRoot":"../../../src","sources":["components/ChangesBar.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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C,KAAK,CAAC6C,KAAK,CAACsD;EAAa,CAAC;EAClDvC,MAAM,EAAE;IAAEY,aAAa,EAAE,KAAK;IAAEC,UAAU,EAAE,QAAQ;IAAEC,GAAG,EAAE,EAAE;IAAE0B,QAAQ,EAAE;EAAO,CAAC;EACjFtC,IAAI,EAAE;IACJa,iBAAiB,EAAE,EAAE;IACrBE,eAAe,EAAE,CAAC;IAClBG,YAAY,EAAEhF,KAAK,CAACqG,MAAM,CAAChD,GAAG;IAC9BiB,eAAe,EAAEtE,KAAK,CAAC6C,KAAK,CAACyD;EAC/B,CAAC;EACDvC,QAAQ,EAAE;IAAElB,KAAK,EAAE7C,KAAK,CAAC6C,KAAK,CAACiD,MAAM;IAAEX,QAAQ,EAAEnF,KAAK,CAACoF,IAAI,CAACC,OAAO;IAAEC,UAAU,EAAE;EAAM,CAAC;EACxFtB,QAAQ,EAAE;IACRuB,IAAI,EAAE,CAAC;IACP1C,KAAK,EAAE7C,KAAK,CAAC6C,KAAK,CAACsD,YAAY;IAC/BhB,QAAQ,EAAEnF,KAAK,CAACoF,IAAI,CAACW;EACvB,CAAC;EACDlC,OAAO,EAAE;IAAE0C,OAAO,EAAE;EAAI;AAC1B,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +1,250 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The message box.
|
|
5
|
+
*
|
|
6
|
+
* This is the first keyboard-safe BOTTOM input in Buoy, and the reason none
|
|
7
|
+
* existed before is that JsModal has no keyboard handling at all: the sheet is
|
|
8
|
+
* `position:absolute; bottom:0` inside the app tree, not an RN `Modal`, so on
|
|
9
|
+
* iOS the keyboard simply draws over it. Two other tools hit this and chose to
|
|
10
|
+
* dodge it — NetworkNumberPrompt and StorageValueEditModal both say so in
|
|
11
|
+
* comments and pin their inputs to the TOP of the screen. A chat cannot.
|
|
12
|
+
*
|
|
13
|
+
* What makes it work:
|
|
14
|
+
* - `KeyboardPad` (see that file), iOS only. `KeyboardAvoidingView` looked
|
|
15
|
+
* right here and did nothing: it measures its frame relative to its PARENT
|
|
16
|
+
* and compares that with the keyboard's SCREEN position, which never
|
|
17
|
+
* overlap inside a bottom-anchored sheet. On Android Expo's default
|
|
18
|
+
* `softwareKeyboardLayoutMode: "resize"` shrinks the window and a
|
|
19
|
+
* bottom-anchored view rides up for free; adding padding there would lift
|
|
20
|
+
* it twice.
|
|
21
|
+
* - The parent list carries `keyboardShouldPersistTaps="handled"`. Without it
|
|
22
|
+
* the first tap after typing only dismisses the keyboard and Send never
|
|
23
|
+
* fires — a real shipped bug in Time Machine, and invisible to Detox because
|
|
24
|
+
* `replaceText` opens no keyboard.
|
|
25
|
+
* - `keyboardType="ascii-capable"`, because iOS Smart Punctuation rewrites
|
|
26
|
+
* straight quotes as curly ones. That permanently broke the raw-JSON editor
|
|
27
|
+
* in Storage, and a tester pasting a JSON blob here would hit the same wall.
|
|
28
|
+
*
|
|
29
|
+
* While the agent is working the send button becomes a STOP button — a
|
|
30
|
+
* square, the universal glyph — rather than a spinner in a circle, which
|
|
31
|
+
* looked like a disabled control and gave no hint it was tappable.
|
|
32
|
+
*/
|
|
33
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
34
|
+
import { Platform, Pressable, StyleSheet, Text, TextInput, View } from "react-native";
|
|
35
|
+
import { night } from "@buoy-gg/shared-ui";
|
|
36
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
37
|
+
/**
|
|
38
|
+
* One line of input, and the height of the send/stop button beside it — the
|
|
39
|
+
* row only reads as level while those two agree.
|
|
40
|
+
*/
|
|
41
|
+
const MIN_INPUT_HEIGHT = 40;
|
|
42
|
+
/** ~5 lines, then it scrolls instead of eating the transcript. */
|
|
43
|
+
const MAX_INPUT_HEIGHT = 120;
|
|
44
|
+
const INPUT_PAD_V = Platform.OS === "ios" ? 10 : 6;
|
|
45
|
+
const INPUT_PAD_H = 16;
|
|
46
|
+
export function Composer({
|
|
47
|
+
onSend,
|
|
48
|
+
onStop,
|
|
49
|
+
busy,
|
|
50
|
+
draft,
|
|
51
|
+
onDraftTaken,
|
|
52
|
+
disabled,
|
|
53
|
+
placeholder,
|
|
54
|
+
focusKey,
|
|
55
|
+
canFocus = true
|
|
56
|
+
}) {
|
|
57
|
+
const [text, setText] = useState("");
|
|
58
|
+
const inputRef = useRef(null);
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (!focusKey || !canFocus || disabled) return;
|
|
61
|
+
inputRef.current?.focus();
|
|
62
|
+
}, [focusKey, canFocus, disabled]);
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (!draft) return;
|
|
65
|
+
// Appended, not assigned: they may have started typing something else in
|
|
66
|
+
// the moment between pressing Stop and this landing.
|
|
67
|
+
setText(current => current ? `${current} ${draft}` : draft);
|
|
68
|
+
onDraftTaken?.();
|
|
69
|
+
}, [draft, onDraftTaken]);
|
|
70
|
+
const submit = useCallback(() => {
|
|
71
|
+
const value = text.trim();
|
|
72
|
+
if (!value) return;
|
|
73
|
+
setText("");
|
|
74
|
+
onSend(value);
|
|
75
|
+
}, [text, onSend]);
|
|
76
|
+
const canSend = text.trim().length > 0 && !busy && !disabled;
|
|
77
|
+
/**
|
|
78
|
+
* Typed something while a turn is running.
|
|
79
|
+
*
|
|
80
|
+
* `send` parks it and flushes it when the turn ends — but the only button on
|
|
81
|
+
* screen while busy was Stop, so the sole way to reach that was the
|
|
82
|
+
* keyboard's return key, and the "Queued" placeholder that explains it only
|
|
83
|
+
* appears AFTER you have managed it. The button is the affordance.
|
|
84
|
+
*/
|
|
85
|
+
const canQueue = text.trim().length > 0 && busy && !disabled;
|
|
86
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
87
|
+
style: styles.wrap,
|
|
88
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
89
|
+
style: [styles.field, disabled && styles.fieldDisabled],
|
|
90
|
+
children: /*#__PURE__*/_jsx(TextInput, {
|
|
91
|
+
ref: inputRef,
|
|
92
|
+
testID: "buoy-ask-buoy-input"
|
|
93
|
+
/*
|
|
94
|
+
* Empty means one line, always.
|
|
95
|
+
*
|
|
96
|
+
* The box is otherwise auto-height, and an iOS multiline TextInput
|
|
97
|
+
* grows with the text but never shrinks back: sending a two-line
|
|
98
|
+
* message cleared the text and left a two-line box standing over
|
|
99
|
+
* the 40pt round button beside it. Nothing on the native side
|
|
100
|
+
* reports the shrink either — on Fabric `onContentSizeChange` is
|
|
101
|
+
* emitted from `updateLayoutMetrics` (a LAYOUT change), not from a
|
|
102
|
+
* text change — so the height it last grew to is the height it
|
|
103
|
+
* keeps. Pinning the empty case is the whole fix: it is the only
|
|
104
|
+
* state that has to line up with the button, and it is exactly the
|
|
105
|
+
* state a send or a new conversation lands in.
|
|
106
|
+
*/,
|
|
107
|
+
style: [styles.input, text.length === 0 && styles.inputEmpty],
|
|
108
|
+
value: text,
|
|
109
|
+
onChangeText: setText,
|
|
110
|
+
placeholder: placeholder ?? (disabled ? "Ask Buoy isn't set up yet" : "Ask, or tell it what to change…"),
|
|
111
|
+
placeholderTextColor: night.color.placeholder,
|
|
112
|
+
multiline: true,
|
|
113
|
+
editable: !disabled
|
|
114
|
+
// Straight quotes only — see the header note.
|
|
115
|
+
,
|
|
116
|
+
keyboardType: "ascii-capable",
|
|
117
|
+
autoCorrect: true,
|
|
118
|
+
autoCapitalize: "sentences"
|
|
119
|
+
// Enter sends; Shift-Enter is not a thing on a phone keyboard, and a
|
|
120
|
+
// multiline box with no submit affordance strands people.
|
|
121
|
+
,
|
|
122
|
+
blurOnSubmit: false,
|
|
123
|
+
onSubmitEditing: submit,
|
|
124
|
+
returnKeyType: "send",
|
|
125
|
+
maxLength: 4000
|
|
126
|
+
})
|
|
127
|
+
}), canQueue && /*#__PURE__*/_jsx(Pressable, {
|
|
128
|
+
testID: "buoy-ask-buoy-queue",
|
|
129
|
+
accessibilityRole: "button",
|
|
130
|
+
accessibilityLabel: "Queue message",
|
|
131
|
+
onPress: submit,
|
|
132
|
+
style: ({
|
|
133
|
+
pressed
|
|
134
|
+
}) => [styles.button, styles.queue, pressed && styles.pressed],
|
|
135
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
136
|
+
style: [styles.sendGlyph, {
|
|
137
|
+
color: night.color.accent
|
|
138
|
+
}],
|
|
139
|
+
children: "\u2191"
|
|
140
|
+
})
|
|
141
|
+
}), busy ? /*#__PURE__*/_jsx(Pressable, {
|
|
142
|
+
testID: "buoy-ask-buoy-stop",
|
|
143
|
+
accessibilityRole: "button",
|
|
144
|
+
accessibilityLabel: "Stop",
|
|
145
|
+
onPress: onStop,
|
|
146
|
+
style: ({
|
|
147
|
+
pressed
|
|
148
|
+
}) => [styles.button, styles.stop, pressed && styles.pressed],
|
|
149
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
150
|
+
style: styles.stopGlyph
|
|
151
|
+
})
|
|
152
|
+
}) : /*#__PURE__*/_jsx(Pressable, {
|
|
153
|
+
testID: "buoy-ask-buoy-send",
|
|
154
|
+
accessibilityRole: "button",
|
|
155
|
+
accessibilityLabel: "Send",
|
|
156
|
+
disabled: !canSend,
|
|
157
|
+
onPress: submit,
|
|
158
|
+
style: ({
|
|
159
|
+
pressed
|
|
160
|
+
}) => [styles.button, canSend ? styles.sendOn : styles.sendOff, pressed && canSend && styles.pressed],
|
|
161
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
162
|
+
style: [styles.sendGlyph, {
|
|
163
|
+
color: canSend ? night.color.onAccent : night.color.textTertiary
|
|
164
|
+
}],
|
|
165
|
+
children: "\u2191"
|
|
166
|
+
})
|
|
167
|
+
})]
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
const styles = StyleSheet.create({
|
|
171
|
+
wrap: {
|
|
172
|
+
flexDirection: "row",
|
|
173
|
+
alignItems: "flex-end",
|
|
174
|
+
gap: 8,
|
|
175
|
+
paddingHorizontal: night.gutter,
|
|
176
|
+
paddingTop: 10,
|
|
177
|
+
paddingBottom: 6,
|
|
178
|
+
borderTopWidth: StyleSheet.hairlineWidth,
|
|
179
|
+
borderTopColor: night.color.border,
|
|
180
|
+
// Opaque: messages scroll UNDER the composer, and a translucent bar over
|
|
181
|
+
// moving text is unreadable.
|
|
182
|
+
backgroundColor: night.color.bg
|
|
183
|
+
},
|
|
184
|
+
field: {
|
|
185
|
+
flex: 1,
|
|
186
|
+
minHeight: MIN_INPUT_HEIGHT,
|
|
187
|
+
justifyContent: "center",
|
|
188
|
+
borderRadius: 20,
|
|
189
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
190
|
+
borderColor: night.color.border,
|
|
191
|
+
backgroundColor: night.color.surfaceElevated
|
|
192
|
+
},
|
|
193
|
+
fieldDisabled: {
|
|
194
|
+
opacity: 0.6
|
|
195
|
+
},
|
|
196
|
+
input: {
|
|
197
|
+
maxHeight: MAX_INPUT_HEIGHT,
|
|
198
|
+
paddingHorizontal: INPUT_PAD_H,
|
|
199
|
+
paddingTop: INPUT_PAD_V,
|
|
200
|
+
paddingBottom: INPUT_PAD_V,
|
|
201
|
+
color: night.color.text,
|
|
202
|
+
fontSize: night.font.row
|
|
203
|
+
// No `lineHeight` here on purpose. A multiline TextInput on iOS lays out
|
|
204
|
+
// with the paragraph line height AND the font's own leading, so setting
|
|
205
|
+
// it made a one-line box measure ~56pt instead of 40 — the pill towered
|
|
206
|
+
// over the 40pt send/stop button beside it and the row read as crooked.
|
|
207
|
+
},
|
|
208
|
+
// Exactly the button's height, so the two read as one level row.
|
|
209
|
+
inputEmpty: {
|
|
210
|
+
height: MIN_INPUT_HEIGHT
|
|
211
|
+
},
|
|
212
|
+
button: {
|
|
213
|
+
width: 40,
|
|
214
|
+
height: 40,
|
|
215
|
+
borderRadius: 20,
|
|
216
|
+
alignItems: "center",
|
|
217
|
+
justifyContent: "center"
|
|
218
|
+
},
|
|
219
|
+
sendGlyph: {
|
|
220
|
+
fontSize: 20,
|
|
221
|
+
fontWeight: "700",
|
|
222
|
+
lineHeight: 22
|
|
223
|
+
},
|
|
224
|
+
sendOn: {
|
|
225
|
+
backgroundColor: night.color.accent
|
|
226
|
+
},
|
|
227
|
+
sendOff: {
|
|
228
|
+
backgroundColor: night.color.fill
|
|
229
|
+
},
|
|
230
|
+
stop: {
|
|
231
|
+
backgroundColor: night.color.fillTertiary
|
|
232
|
+
},
|
|
233
|
+
// Outlined rather than filled: it sits beside Stop, and two solid buttons
|
|
234
|
+
// read as one control with two halves.
|
|
235
|
+
queue: {
|
|
236
|
+
backgroundColor: "transparent",
|
|
237
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
238
|
+
borderColor: night.color.accentBorderStrong
|
|
239
|
+
},
|
|
240
|
+
stopGlyph: {
|
|
241
|
+
width: 12,
|
|
242
|
+
height: 12,
|
|
243
|
+
borderRadius: 2,
|
|
244
|
+
backgroundColor: night.color.text
|
|
245
|
+
},
|
|
246
|
+
pressed: {
|
|
247
|
+
opacity: 0.7
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
//# sourceMappingURL=Composer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useEffect","useRef","useState","Platform","Pressable","StyleSheet","Text","TextInput","View","night","jsx","_jsx","jsxs","_jsxs","MIN_INPUT_HEIGHT","MAX_INPUT_HEIGHT","INPUT_PAD_V","OS","INPUT_PAD_H","Composer","onSend","onStop","busy","draft","onDraftTaken","disabled","placeholder","focusKey","canFocus","text","setText","inputRef","current","focus","submit","value","trim","canSend","length","canQueue","style","styles","wrap","children","field","fieldDisabled","ref","testID","input","inputEmpty","onChangeText","placeholderTextColor","color","multiline","editable","keyboardType","autoCorrect","autoCapitalize","blurOnSubmit","onSubmitEditing","returnKeyType","maxLength","accessibilityRole","accessibilityLabel","onPress","pressed","button","queue","sendGlyph","accent","stop","stopGlyph","sendOn","sendOff","onAccent","textTertiary","create","flexDirection","alignItems","gap","paddingHorizontal","gutter","paddingTop","paddingBottom","borderTopWidth","hairlineWidth","borderTopColor","border","backgroundColor","bg","flex","minHeight","justifyContent","borderRadius","borderWidth","borderColor","surfaceElevated","opacity","maxHeight","fontSize","font","row","height","width","fontWeight","lineHeight","fill","fillTertiary","accentBorderStrong"],"sourceRoot":"../../../src","sources":["components/Composer.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAChE,SACEC,QAAQ,EACRC,SAAS,EACTC,UAAU,EACVC,IAAI,EACJC,SAAS,EACTC,IAAI,QACC,cAAc;AACrB,SAASC,KAAK,QAAQ,oBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAyB3C;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG,EAAE;AAC3B;AACA,MAAMC,gBAAgB,GAAG,GAAG;AAC5B,MAAMC,WAAW,GAAGb,QAAQ,CAACc,EAAE,KAAK,KAAK,GAAG,EAAE,GAAG,CAAC;AAClD,MAAMC,WAAW,GAAG,EAAE;AAEtB,OAAO,SAASC,QAAQA,CAAC;EACvBC,MAAM;EACNC,MAAM;EACNC,IAAI;EACJC,KAAK;EACLC,YAAY;EACZC,QAAQ;EACRC,WAAW;EACXC,QAAQ;EACRC,QAAQ,GAAG;AACE,CAAC,EAAE;EAChB,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAG5B,QAAQ,CAAC,EAAE,CAAC;EACpC,MAAM6B,QAAQ,GAAG9B,MAAM,CAAY,IAAI,CAAC;EAExCD,SAAS,CAAC,MAAM;IACd,IAAI,CAAC2B,QAAQ,IAAI,CAACC,QAAQ,IAAIH,QAAQ,EAAE;IACxCM,QAAQ,CAACC,OAAO,EAAEC,KAAK,CAAC,CAAC;EAC3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Ae,EAAE/E,KAAK,CAAC2C,KAAK,CAACuD;EAAa,CAAC;EACnD;EACA;EACAxC,KAAK,EAAE;IACLqB,eAAe,EAAE,aAAa;IAC9BM,WAAW,EAAEzF,UAAU,CAACgF,aAAa;IACrCU,WAAW,EAAEtF,KAAK,CAAC2C,KAAK,CAACwD;EAC3B,CAAC;EACDrC,SAAS,EAAE;IACTgC,KAAK,EAAE,EAAE;IACTD,MAAM,EAAE,EAAE;IACVT,YAAY,EAAE,CAAC;IACfL,eAAe,EAAE/E,KAAK,CAAC2C,KAAK,CAACvB;EAC/B,CAAC;EACDoC,OAAO,EAAE;IAAEgC,OAAO,EAAE;EAAI;AAC1B,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +1,156 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The first screen.
|
|
5
|
+
*
|
|
6
|
+
* Written for someone who has never used a devtool. The suggestions are not
|
|
7
|
+
* decoration — they are the fastest way to teach a tester what kind of sentence
|
|
8
|
+
* works here, and they are phrased as outcomes ("why is this screen empty?")
|
|
9
|
+
* rather than as tool names, because the tools are the thing this feature
|
|
10
|
+
* exists to hide.
|
|
11
|
+
*/
|
|
12
|
+
import { Pressable, StyleSheet, Text, View } from "react-native";
|
|
13
|
+
import { ChevronRight, night, NightSectionLabel } from "@buoy-gg/shared-ui";
|
|
14
|
+
import { pickSuggestions } from "../store/suggestions";
|
|
15
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
const isRelease = typeof __DEV__ !== "undefined" && !__DEV__;
|
|
17
|
+
export function EmptyState({
|
|
18
|
+
configured,
|
|
19
|
+
onPick,
|
|
20
|
+
availableToolIds = [],
|
|
21
|
+
readOnly = false
|
|
22
|
+
}) {
|
|
23
|
+
const suggestions = pickSuggestions({
|
|
24
|
+
availableToolIds,
|
|
25
|
+
readOnly,
|
|
26
|
+
isRelease
|
|
27
|
+
});
|
|
28
|
+
if (!configured) {
|
|
29
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
30
|
+
style: styles.wrap,
|
|
31
|
+
testID: "buoy-ask-buoy-unconfigured",
|
|
32
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
33
|
+
style: styles.title,
|
|
34
|
+
children: "Not set up yet"
|
|
35
|
+
}), /*#__PURE__*/_jsxs(Text, {
|
|
36
|
+
style: styles.body,
|
|
37
|
+
children: ["Ask Buoy talks to your own company's AI endpoint \u2014 nothing goes to Buoy. A developer needs to add the ", /*#__PURE__*/_jsx(Text, {
|
|
38
|
+
style: styles.code,
|
|
39
|
+
children: "askBuoy"
|
|
40
|
+
}), " prop to", " ", /*#__PURE__*/_jsx(Text, {
|
|
41
|
+
style: styles.code,
|
|
42
|
+
children: "<FloatingDevTools />"
|
|
43
|
+
}), " with your team's endpoint and model."]
|
|
44
|
+
})]
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
48
|
+
style: styles.wrap,
|
|
49
|
+
testID: "buoy-ask-buoy-empty",
|
|
50
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
51
|
+
style: styles.title,
|
|
52
|
+
children: "Ask about this app"
|
|
53
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
54
|
+
style: styles.body,
|
|
55
|
+
children: "Ask what the app is doing right now, or tell it to change something. Anything it changes shows up in a bar at the top, with what can be undone."
|
|
56
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
57
|
+
style: styles.buildLine,
|
|
58
|
+
testID: "buoy-ask-buoy-build-line",
|
|
59
|
+
children: isRelease ? "Release build — reading, impersonation and navigation work; simulations (forcing server responses, driving the screen) need a dev build." : "Dev build — full simulation available."
|
|
60
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
61
|
+
style: styles.group,
|
|
62
|
+
children: [/*#__PURE__*/_jsx(NightSectionLabel, {
|
|
63
|
+
children: "Try asking"
|
|
64
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
65
|
+
style: styles.card,
|
|
66
|
+
children: suggestions.map((s, i) => /*#__PURE__*/_jsx(Suggestion, {
|
|
67
|
+
text: s,
|
|
68
|
+
onPick: onPick,
|
|
69
|
+
last: i === suggestions.length - 1
|
|
70
|
+
}, s))
|
|
71
|
+
})]
|
|
72
|
+
})]
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
function Suggestion({
|
|
76
|
+
text,
|
|
77
|
+
onPick,
|
|
78
|
+
last
|
|
79
|
+
}) {
|
|
80
|
+
return /*#__PURE__*/_jsxs(Pressable, {
|
|
81
|
+
testID: `buoy-ask-buoy-suggestion-${text.slice(0, 12)}`,
|
|
82
|
+
accessibilityRole: "button",
|
|
83
|
+
onPress: () => onPick(text),
|
|
84
|
+
style: ({
|
|
85
|
+
pressed
|
|
86
|
+
}) => [styles.row, !last && styles.rowDivider, pressed && styles.pressed],
|
|
87
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
88
|
+
style: styles.rowText,
|
|
89
|
+
children: text
|
|
90
|
+
}), /*#__PURE__*/_jsx(ChevronRight, {
|
|
91
|
+
size: 14,
|
|
92
|
+
color: night.color.textTertiary
|
|
93
|
+
})]
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
const styles = StyleSheet.create({
|
|
97
|
+
wrap: {
|
|
98
|
+
flex: 1,
|
|
99
|
+
justifyContent: "center",
|
|
100
|
+
paddingHorizontal: night.gutter,
|
|
101
|
+
paddingVertical: 24,
|
|
102
|
+
gap: 8
|
|
103
|
+
},
|
|
104
|
+
title: {
|
|
105
|
+
color: night.color.text,
|
|
106
|
+
fontSize: 22,
|
|
107
|
+
fontWeight: "700",
|
|
108
|
+
letterSpacing: -0.3
|
|
109
|
+
},
|
|
110
|
+
body: {
|
|
111
|
+
color: night.color.textSecondary,
|
|
112
|
+
fontSize: night.font.body,
|
|
113
|
+
lineHeight: 20
|
|
114
|
+
},
|
|
115
|
+
code: {
|
|
116
|
+
color: night.color.text,
|
|
117
|
+
fontFamily: "Menlo"
|
|
118
|
+
},
|
|
119
|
+
buildLine: {
|
|
120
|
+
marginTop: 8,
|
|
121
|
+
color: night.color.textTertiary,
|
|
122
|
+
fontSize: night.font.micro,
|
|
123
|
+
lineHeight: 15
|
|
124
|
+
},
|
|
125
|
+
group: {
|
|
126
|
+
marginTop: night.groupGap - 8
|
|
127
|
+
},
|
|
128
|
+
card: {
|
|
129
|
+
borderRadius: night.radius.card,
|
|
130
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
131
|
+
borderColor: night.color.border,
|
|
132
|
+
backgroundColor: night.color.surface,
|
|
133
|
+
overflow: "hidden"
|
|
134
|
+
},
|
|
135
|
+
row: {
|
|
136
|
+
flexDirection: "row",
|
|
137
|
+
alignItems: "center",
|
|
138
|
+
gap: 10,
|
|
139
|
+
paddingHorizontal: night.rowPadH,
|
|
140
|
+
paddingVertical: 13
|
|
141
|
+
},
|
|
142
|
+
rowDivider: {
|
|
143
|
+
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
144
|
+
borderBottomColor: night.color.separator
|
|
145
|
+
},
|
|
146
|
+
rowText: {
|
|
147
|
+
flex: 1,
|
|
148
|
+
color: night.color.text,
|
|
149
|
+
fontSize: night.font.body,
|
|
150
|
+
lineHeight: 19
|
|
151
|
+
},
|
|
152
|
+
pressed: {
|
|
153
|
+
backgroundColor: night.color.fill
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
//# sourceMappingURL=EmptyState.js.map
|