@buoy-gg/ask-buoy 7.0.41 → 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 -98
- 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 -783
- package/lib/commonjs/blocks/ExtraBlocks.js +1 -1862
- package/lib/commonjs/blocks/MediaBlocks.js +1 -158
- package/lib/commonjs/blocks/ReceiptBlocks.js +2 -592
- 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 -39
- 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 -482
- package/lib/commonjs/components/AskBuoySettings.js +1 -181
- package/lib/commonjs/components/ChangesBar.js +1 -212
- 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 -769
- package/lib/module/blocks/ExtraBlocks.js +1 -1835
- package/lib/module/blocks/MediaBlocks.js +1 -153
- package/lib/module/blocks/ReceiptBlocks.js +2 -580
- 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 -35
- 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 -477
- 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/web/index.mjs +11 -12
- package/package.json +8 -8
- 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/blocks/ruleStates.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/blocks/ruleStates.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/blocks/ruleStates.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
|
@@ -1,206 +1 @@
|
|
|
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
|
-
export 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
|
|
1
|
+
"use strict";import{useSyncExternalStore as C}from"react";import{Pressable as y,ScrollView as k,StyleSheet as u,Text as l,View as a}from"react-native";import{ChevronDown as L,ChevronRight as W,night as e}from"@buoy-gg/shared-ui";import{isReversible as m}from"@buoy-gg/agent-core";import{jsx as r,jsxs as n}from"react/jsx-runtime";const w=[];export function useLedgerEntries(s){return C(d=>s?.subscribe(d)??(()=>{}),()=>s?.list()??w,()=>s?.list()??w)}export function ChangesBar({ledger:s,onUndoAll:d,expanded:h,onToggle:x}){const S=useLedgerEntries(s);const p=S.filter(t=>!t.undoneAt);const c=p.filter(t=>t.effect.kind!=="transient");if(c.length===0)return null;const i=c.filter(t=>m(t.effect));const f=c.length-i.length;const g=p.length-c.length;const T=h?L:W;const z=[i.length>0?`${i.length} undoable`:null,f>0?`${f} permanent`:null].filter(Boolean).join(" \xB7 ");return n(a,{style:o.wrap,children:[n(y,{testID:"buoy-ask-buoy-changes-bar",accessibilityRole:"button",accessibilityState:{expanded:h},onPress:x,style:o.bar,children:[r(a,{style:o.dot}),r(l,{style:o.summary,numberOfLines:1,children:"Changed this app"}),r(l,{style:o.counts,numberOfLines:1,children:z}),r(T,{size:12,color:e.color.textSecondary})]}),h&&n(a,{style:o.panel,children:[n(k,{style:o.panelScroll,testID:"buoy-ask-buoy-changes-scroll",keyboardShouldPersistTaps:"handled",children:[c.map(t=>{const b=!m(t.effect);return n(a,{style:o.row,children:[r(l,{style:o.rowLabel,children:t.effect.label}),r(l,{style:[o.rowTag,b&&o.rowTagMuted],children:b?"Permanent":"Undoable"})]},t.id)}),g>0&&r(a,{style:o.row,children:n(l,{style:[o.rowLabel,o.rowLabelMuted],children:["Also did ",g," one-shot action",g===1?"":"s"," (navigation, taps) \u2014 nothing to undo."]})})]}),n(a,{style:o.footer,children:[i.length>0&&r(y,{testID:"buoy-ask-buoy-undo-all",accessibilityRole:"button",onPress:d,style:({pressed:t})=>[o.undo,t&&o.pressed],children:n(l,{style:o.undoText,children:["Undo ",i.length," change",i.length===1?"":"s"]})}),f>0&&r(l,{style:o.footnote,children:"Permanent changes can't be undone from here."})]})]})]})}const o=u.create({wrap:{borderBottomWidth:u.hairlineWidth,borderBottomColor:e.color.border,backgroundColor:e.color.warningSoft},bar:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:e.gutter,paddingVertical:10},dot:{width:7,height:7,borderRadius:4,backgroundColor:e.color.warning},summary:{color:e.color.text,fontSize:e.font.caption,fontWeight:"600"},counts:{flex:1,color:e.color.textSecondary,fontSize:e.font.caption},panel:{paddingHorizontal:e.gutter,paddingBottom:12,gap:10},panelScroll:{maxHeight:180},row:{flexDirection:"row",alignItems:"flex-start",gap:10,paddingVertical:8,borderTopWidth:u.hairlineWidth,borderTopColor:e.color.separator},rowLabel:{flex:1,color:e.color.text,fontSize:e.font.caption,lineHeight:18},rowTag:{color:e.color.accent,fontSize:e.font.micro,fontWeight:"600",letterSpacing:.6,textTransform:"uppercase",paddingTop:2},rowTagMuted:{color:e.color.textTertiary},rowLabelMuted:{color:e.color.textTertiary},footer:{flexDirection:"row",alignItems:"center",gap:12,flexWrap:"wrap"},undo:{paddingHorizontal:14,paddingVertical:8,borderRadius:e.radius.row,backgroundColor:e.color.button},undoText:{color:e.color.accent,fontSize:e.font.caption,fontWeight:"600"},footnote:{flex:1,color:e.color.textTertiary,fontSize:e.font.micro},pressed:{opacity:.7}});
|
|
@@ -1,250 +1 @@
|
|
|
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
|
|
1
|
+
"use strict";import{useCallback as H,useEffect as x,useRef as _,useState as w}from"react";import{Platform as D,Pressable as p,StyleSheet as c,Text as C,TextInput as R,View as b}from"react-native";import{night as t}from"@buoy-gg/shared-ui";import{jsx as r,jsxs as E}from"react/jsx-runtime";const T=40;const G=120;const k=D.OS==="ios"?10:6;const W=16;export function Composer({onSend:h,onStop:I,busy:a,draft:l,onDraftTaken:y,disabled:n,placeholder:P,focusKey:g,canFocus:f=true}){const[i,u]=w("");const m=_(null);x(()=>{if(!g||!f||n)return;m.current?.focus()},[g,f,n]);x(()=>{if(!l)return;u(o=>o?`${o} ${l}`:l);y?.()},[l,y]);const d=H(()=>{const o=i.trim();if(!o)return;u("");h(o)},[i,h]);const s=i.trim().length>0&&!a&&!n;const S=i.trim().length>0&&a&&!n;return E(b,{style:e.wrap,children:[r(b,{style:[e.field,n&&e.fieldDisabled],children:r(R,{ref:m,testID:"buoy-ask-buoy-input",style:[e.input,i.length===0&&e.inputEmpty],value:i,onChangeText:u,placeholder:P??(n?"Ask Buoy isn't set up yet":"Ask, or tell it what to change\u2026"),placeholderTextColor:t.color.placeholder,multiline:true,editable:!n,keyboardType:"ascii-capable",autoCorrect:true,autoCapitalize:"sentences",blurOnSubmit:false,onSubmitEditing:d,returnKeyType:"send",maxLength:4e3})}),S&&r(p,{testID:"buoy-ask-buoy-queue",accessibilityRole:"button",accessibilityLabel:"Queue message",onPress:d,style:({pressed:o})=>[e.button,e.queue,o&&e.pressed],children:r(C,{style:[e.sendGlyph,{color:t.color.accent}],children:"\u2191"})}),a?r(p,{testID:"buoy-ask-buoy-stop",accessibilityRole:"button",accessibilityLabel:"Stop",onPress:I,style:({pressed:o})=>[e.button,e.stop,o&&e.pressed],children:r(b,{style:e.stopGlyph})}):r(p,{testID:"buoy-ask-buoy-send",accessibilityRole:"button",accessibilityLabel:"Send",disabled:!s,onPress:d,style:({pressed:o})=>[e.button,s?e.sendOn:e.sendOff,o&&s&&e.pressed],children:r(C,{style:[e.sendGlyph,{color:s?t.color.onAccent:t.color.textTertiary}],children:"\u2191"})})]})}const e=c.create({wrap:{flexDirection:"row",alignItems:"flex-end",gap:8,paddingHorizontal:t.gutter,paddingTop:10,paddingBottom:6,borderTopWidth:c.hairlineWidth,borderTopColor:t.color.border,backgroundColor:t.color.bg},field:{flex:1,minHeight:T,justifyContent:"center",borderRadius:20,borderWidth:c.hairlineWidth,borderColor:t.color.border,backgroundColor:t.color.surfaceElevated},fieldDisabled:{opacity:.6},input:{maxHeight:G,paddingHorizontal:W,paddingTop:k,paddingBottom:k,color:t.color.text,fontSize:t.font.row},inputEmpty:{height:T},button:{width:40,height:40,borderRadius:20,alignItems:"center",justifyContent:"center"},sendGlyph:{fontSize:20,fontWeight:"700",lineHeight:22},sendOn:{backgroundColor:t.color.accent},sendOff:{backgroundColor:t.color.fill},stop:{backgroundColor:t.color.fillTertiary},queue:{backgroundColor:"transparent",borderWidth:c.hairlineWidth,borderColor:t.color.accentBorderStrong},stopGlyph:{width:12,height:12,borderRadius:2,backgroundColor:t.color.text},pressed:{opacity:.7}});
|
|
@@ -1,156 +1 @@
|
|
|
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
|
|
1
|
+
"use strict";import{Pressable as p,StyleSheet as c,Text as r,View as l}from"react-native";import{ChevronRight as b,night as e,NightSectionLabel as f}from"@buoy-gg/shared-ui";import{pickSuggestions as m}from"../store/suggestions";import{jsx as t,jsxs as n}from"react/jsx-runtime";const h=typeof __DEV__!=="undefined"&&!__DEV__;export function EmptyState({configured:i,onPick:s,availableToolIds:a=[],readOnly:d=false}){const u=m({availableToolIds:a,readOnly:d,isRelease:h});if(!i){return n(l,{style:o.wrap,testID:"buoy-ask-buoy-unconfigured",children:[t(r,{style:o.title,children:"Not set up yet"}),n(r,{style:o.body,children:["Ask Buoy talks to your own company's AI endpoint \u2014 nothing goes to Buoy. A developer needs to add the ",t(r,{style:o.code,children:"askBuoy"})," prop to"," ",t(r,{style:o.code,children:"<FloatingDevTools />"})," with your team's endpoint and model."]})]})}return n(l,{style:o.wrap,testID:"buoy-ask-buoy-empty",children:[t(r,{style:o.title,children:"Ask about this app"}),t(r,{style:o.body,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."}),t(r,{style:o.buildLine,testID:"buoy-ask-buoy-build-line",children:h?"Release build \u2014 reading, impersonation and navigation work; simulations (forcing server responses, driving the screen) need a dev build.":"Dev build \u2014 full simulation available."}),n(l,{style:o.group,children:[t(f,{children:"Try asking"}),t(l,{style:o.card,children:u.map((g,y)=>t(w,{text:g,onPick:s,last:y===u.length-1},g))})]})]})}function w({text:i,onPick:s,last:a}){return n(p,{testID:`buoy-ask-buoy-suggestion-${i.slice(0,12)}`,accessibilityRole:"button",onPress:()=>s(i),style:({pressed:d})=>[o.row,!a&&o.rowDivider,d&&o.pressed],children:[t(r,{style:o.rowText,children:i}),t(b,{size:14,color:e.color.textTertiary})]})}const o=c.create({wrap:{flex:1,justifyContent:"center",paddingHorizontal:e.gutter,paddingVertical:24,gap:8},title:{color:e.color.text,fontSize:22,fontWeight:"700",letterSpacing:-.3},body:{color:e.color.textSecondary,fontSize:e.font.body,lineHeight:20},code:{color:e.color.text,fontFamily:"Menlo"},buildLine:{marginTop:8,color:e.color.textTertiary,fontSize:e.font.micro,lineHeight:15},group:{marginTop:e.groupGap-8},card:{borderRadius:e.radius.card,borderWidth:c.hairlineWidth,borderColor:e.color.border,backgroundColor:e.color.surface,overflow:"hidden"},row:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:e.rowPadH,paddingVertical:13},rowDivider:{borderBottomWidth:c.hairlineWidth,borderBottomColor:e.color.separator},rowText:{flex:1,color:e.color.text,fontSize:e.font.body,lineHeight:19},pressed:{backgroundColor:e.color.fill}});
|