@buoy-gg/ask-buoy 7.0.41 → 7.0.43
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 -12
- 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,181 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.AskBuoySettings = AskBuoySettings;
|
|
7
|
-
var _reactNative = require("react-native");
|
|
8
|
-
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
9
|
-
var _useAskBuoySettings = require("../store/useAskBuoySettings");
|
|
10
|
-
var _askBuoySettings = require("../store/askBuoySettings");
|
|
11
|
-
var _askBuoyStore = require("../store/askBuoyStore");
|
|
12
|
-
var _useAskBuoy = require("../store/useAskBuoy");
|
|
13
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
-
/**
|
|
15
|
-
* The sheet's settings, reached from the header.
|
|
16
|
-
*
|
|
17
|
-
* A view inside the sheet rather than a second modal: a settings panel that
|
|
18
|
-
* covers the conversation you are configuring makes the effect of a toggle
|
|
19
|
-
* invisible until you dismiss it. Back returns to the chat with the
|
|
20
|
-
* transcript exactly where it was.
|
|
21
|
-
*
|
|
22
|
-
* Sections are by subject, not by implementation. "Chat" is what a tester
|
|
23
|
-
* calls the thing they are looking at.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
function AskBuoySettings() {
|
|
27
|
-
const settings = (0, _useAskBuoySettings.useAskBuoySettings)();
|
|
28
|
-
const trusted = (0, _useAskBuoy.useAskBuoyState)().trusted;
|
|
29
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.ScrollView, {
|
|
30
|
-
style: styles.scroll,
|
|
31
|
-
contentContainerStyle: styles.content,
|
|
32
|
-
testID: "buoy-ask-buoy-settings",
|
|
33
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
34
|
-
style: styles.section,
|
|
35
|
-
children: "CHAT"
|
|
36
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ToggleRow, {
|
|
37
|
-
testID: "buoy-ask-buoy-setting-thinking",
|
|
38
|
-
label: "Show agent thinking",
|
|
39
|
-
description: "Adds a collapsed strip under each answer: the model's reasoning, and every step it ran with its parameters, result, duration and token cost. Copy includes the steps and reasoning while this is on, so you can read the run outside the app.",
|
|
40
|
-
value: settings.showThinking,
|
|
41
|
-
onValueChange: next => _askBuoySettings.askBuoySettings.set("showThinking", next)
|
|
42
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
43
|
-
style: styles.note,
|
|
44
|
-
children: "Not every model reports reasoning. Claude thinks by default; most OpenAI models return none, and the strip then shows the steps alone."
|
|
45
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
46
|
-
style: styles.section,
|
|
47
|
-
children: "PERMISSIONS"
|
|
48
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ToggleRow, {
|
|
49
|
-
testID: "buoy-ask-buoy-setting-readonly",
|
|
50
|
-
label: "Read only",
|
|
51
|
-
description: "Inspect the app, change nothing. Every write and simulation is refused until this is off. Undo still works \u2014 putting things back is the safe direction.",
|
|
52
|
-
value: settings.readOnly,
|
|
53
|
-
onValueChange: next => _askBuoySettings.askBuoySettings.set("readOnly", next)
|
|
54
|
-
}), settings.readOnly ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
55
|
-
style: styles.note,
|
|
56
|
-
testID: "buoy-ask-buoy-readonly-note",
|
|
57
|
-
children: "On across reloads until you turn it off here. The header says \u201CRead only\u201D while it is on. It adds to whatever this app already restricts \u2014 it never loosens anything."
|
|
58
|
-
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ToggleRow, {
|
|
59
|
-
testID: "buoy-ask-buoy-setting-bypass",
|
|
60
|
-
tone: "warning",
|
|
61
|
-
emphasizeLabel: settings.bypassApprovals,
|
|
62
|
-
disabled: settings.readOnly,
|
|
63
|
-
label: "Skip approval prompts",
|
|
64
|
-
description: settings.readOnly ? "Unavailable while Read only is on — nothing can be approved." : "Runs every action the moment the agent calls it, with no Allow card — including the destructive ones that wipe or reset data.",
|
|
65
|
-
value: settings.bypassApprovals,
|
|
66
|
-
onValueChange: next => _askBuoySettings.askBuoySettings.set("bypassApprovals", next)
|
|
67
|
-
}), settings.bypassApprovals && !settings.readOnly ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
68
|
-
style: styles.warning,
|
|
69
|
-
testID: "buoy-ask-buoy-bypass-warning",
|
|
70
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.AlertTriangle, {
|
|
71
|
-
size: 14,
|
|
72
|
-
color: _sharedUi.night.color.warning
|
|
73
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
74
|
-
style: styles.warningText,
|
|
75
|
-
children: "Nothing will ask before a change lands. A wipe or a reset runs on the model's word alone, and Undo only reverses the changes that can be reversed \u2014 the bar tells you which. This stays on across reloads and app restarts until you turn it off here, so leave it off on any device holding data you care about. It does not widen what the agent may reach: read-only mode, this app's deny list and the release-build refusals still apply."
|
|
76
|
-
})]
|
|
77
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
78
|
-
style: styles.note,
|
|
79
|
-
children: "On by default for destructive actions only \u2014 reads and ordinary writes already run without asking, and the changes bar records them."
|
|
80
|
-
}), trusted.length > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
81
|
-
style: styles.trustedBox,
|
|
82
|
-
testID: "buoy-ask-buoy-trusted",
|
|
83
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
84
|
-
style: styles.section,
|
|
85
|
-
children: "ALLOWED WITHOUT ASKING \u2014 THIS CHAT"
|
|
86
|
-
}), trusted.map(t => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
87
|
-
style: styles.trustedRow,
|
|
88
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
89
|
-
style: styles.trustedLabel,
|
|
90
|
-
numberOfLines: 2,
|
|
91
|
-
children: t.label
|
|
92
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
93
|
-
testID: `buoy-ask-buoy-untrust-${t.key}`,
|
|
94
|
-
accessibilityRole: "button",
|
|
95
|
-
onPress: () => _askBuoyStore.askBuoyStore.untrust(t.key),
|
|
96
|
-
style: ({
|
|
97
|
-
pressed
|
|
98
|
-
}) => [styles.forget, pressed && {
|
|
99
|
-
opacity: 0.7
|
|
100
|
-
}],
|
|
101
|
-
hitSlop: 6,
|
|
102
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
103
|
-
style: styles.forgetText,
|
|
104
|
-
children: "Ask again"
|
|
105
|
-
})
|
|
106
|
-
})]
|
|
107
|
-
}, t.key))]
|
|
108
|
-
}) : null]
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
const styles = _reactNative.StyleSheet.create({
|
|
112
|
-
scroll: {
|
|
113
|
-
flex: 1
|
|
114
|
-
},
|
|
115
|
-
content: {
|
|
116
|
-
padding: _sharedUi.night.gutter,
|
|
117
|
-
gap: 10,
|
|
118
|
-
paddingBottom: 32
|
|
119
|
-
},
|
|
120
|
-
section: {
|
|
121
|
-
color: _sharedUi.night.color.textTertiary,
|
|
122
|
-
fontSize: 10,
|
|
123
|
-
fontWeight: "700",
|
|
124
|
-
letterSpacing: 0.6,
|
|
125
|
-
paddingHorizontal: 4,
|
|
126
|
-
paddingTop: 4
|
|
127
|
-
},
|
|
128
|
-
warning: {
|
|
129
|
-
flexDirection: "row",
|
|
130
|
-
gap: 8,
|
|
131
|
-
padding: _sharedUi.night.cardPad,
|
|
132
|
-
borderRadius: _sharedUi.night.radius.card,
|
|
133
|
-
borderWidth: _reactNative.StyleSheet.hairlineWidth,
|
|
134
|
-
borderColor: _sharedUi.night.color.warning,
|
|
135
|
-
backgroundColor: _sharedUi.night.color.surface
|
|
136
|
-
},
|
|
137
|
-
warningText: {
|
|
138
|
-
flex: 1,
|
|
139
|
-
color: _sharedUi.night.color.warning,
|
|
140
|
-
fontSize: _sharedUi.night.font.micro,
|
|
141
|
-
lineHeight: 16
|
|
142
|
-
},
|
|
143
|
-
trustedBox: {
|
|
144
|
-
gap: 6,
|
|
145
|
-
paddingTop: 6
|
|
146
|
-
},
|
|
147
|
-
trustedRow: {
|
|
148
|
-
flexDirection: "row",
|
|
149
|
-
alignItems: "center",
|
|
150
|
-
gap: 10,
|
|
151
|
-
padding: _sharedUi.night.cardPad,
|
|
152
|
-
borderRadius: _sharedUi.night.radius.card,
|
|
153
|
-
borderWidth: _reactNative.StyleSheet.hairlineWidth,
|
|
154
|
-
borderColor: _sharedUi.night.color.border,
|
|
155
|
-
backgroundColor: _sharedUi.night.color.surface
|
|
156
|
-
},
|
|
157
|
-
trustedLabel: {
|
|
158
|
-
flex: 1,
|
|
159
|
-
color: _sharedUi.night.color.text,
|
|
160
|
-
fontSize: _sharedUi.night.font.caption,
|
|
161
|
-
lineHeight: 18
|
|
162
|
-
},
|
|
163
|
-
forget: {
|
|
164
|
-
paddingHorizontal: 10,
|
|
165
|
-
paddingVertical: 6,
|
|
166
|
-
borderRadius: _sharedUi.night.radius.row,
|
|
167
|
-
backgroundColor: _sharedUi.night.color.button
|
|
168
|
-
},
|
|
169
|
-
forgetText: {
|
|
170
|
-
color: _sharedUi.night.color.text,
|
|
171
|
-
fontSize: _sharedUi.night.font.micro,
|
|
172
|
-
fontWeight: "600"
|
|
173
|
-
},
|
|
174
|
-
note: {
|
|
175
|
-
color: _sharedUi.night.color.textTertiary,
|
|
176
|
-
fontSize: _sharedUi.night.font.micro,
|
|
177
|
-
lineHeight: 16,
|
|
178
|
-
paddingHorizontal: 4
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
//# sourceMappingURL=AskBuoySettings.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.AskBuoySettings=AskBuoySettings;var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _useAskBuoySettings=require("../store/useAskBuoySettings");var _askBuoySettings=require("../store/askBuoySettings");var _askBuoyStore=require("../store/askBuoyStore");var _useAskBuoy=require("../store/useAskBuoy");var _jsxRuntime=require("react/jsx-runtime");function AskBuoySettings(){const t=(0,_useAskBuoySettings.useAskBuoySettings)();const n=(0,_useAskBuoy.useAskBuoyState)().trusted;return(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{style:styles.scroll,contentContainerStyle:styles.content,testID:"buoy-ask-buoy-settings",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.section,children:"CHAT"}),(0,_jsxRuntime.jsx)(_sharedUi.ToggleRow,{testID:"buoy-ask-buoy-setting-thinking",label:"Show agent thinking",description:"Adds a collapsed strip under each answer: the model's reasoning, and every step it ran with its parameters, result, duration and token cost. Copy includes the steps and reasoning while this is on, so you can read the run outside the app.",value:t.showThinking,onValueChange:e=>_askBuoySettings.askBuoySettings.set("showThinking",e)}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.note,children:"Not every model reports reasoning. Claude thinks by default; most OpenAI models return none, and the strip then shows the steps alone."}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.section,children:"PERMISSIONS"}),(0,_jsxRuntime.jsx)(_sharedUi.ToggleRow,{testID:"buoy-ask-buoy-setting-readonly",label:"Read only",description:"Inspect the app, change nothing. Every write and simulation is refused until this is off. Undo still works \u2014 putting things back is the safe direction.",value:t.readOnly,onValueChange:e=>_askBuoySettings.askBuoySettings.set("readOnly",e)}),t.readOnly?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.note,testID:"buoy-ask-buoy-readonly-note",children:"On across reloads until you turn it off here. The header says \u201CRead only\u201D while it is on. It adds to whatever this app already restricts \u2014 it never loosens anything."}):null,(0,_jsxRuntime.jsx)(_sharedUi.ToggleRow,{testID:"buoy-ask-buoy-setting-bypass",tone:"warning",emphasizeLabel:t.bypassApprovals,disabled:t.readOnly,label:"Skip approval prompts",description:t.readOnly?"Unavailable while Read only is on \u2014 nothing can be approved.":"Runs every action the moment the agent calls it, with no Allow card \u2014 including the destructive ones that wipe or reset data.",value:t.bypassApprovals,onValueChange:e=>_askBuoySettings.askBuoySettings.set("bypassApprovals",e)}),t.bypassApprovals&&!t.readOnly?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.warning,testID:"buoy-ask-buoy-bypass-warning",children:[(0,_jsxRuntime.jsx)(_sharedUi.AlertTriangle,{size:14,color:_sharedUi.night.color.warning}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.warningText,children:"Nothing will ask before a change lands. A wipe or a reset runs on the model's word alone, and Undo only reverses the changes that can be reversed \u2014 the bar tells you which. This stays on across reloads and app restarts until you turn it off here, so leave it off on any device holding data you care about. It does not widen what the agent may reach: read-only mode, this app's deny list and the release-build refusals still apply."})]}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.note,children:"On by default for destructive actions only \u2014 reads and ordinary writes already run without asking, and the changes bar records them."}),n.length>0?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.trustedBox,testID:"buoy-ask-buoy-trusted",children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.section,children:"ALLOWED WITHOUT ASKING \u2014 THIS CHAT"}),n.map(e=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.trustedRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.trustedLabel,numberOfLines:2,children:e.label}),(0,_jsxRuntime.jsx)(_reactNative.Pressable,{testID:`buoy-ask-buoy-untrust-${e.key}`,accessibilityRole:"button",onPress:()=>_askBuoyStore.askBuoyStore.untrust(e.key),style:({pressed:o})=>[styles.forget,o&&{opacity:.7}],hitSlop:6,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.forgetText,children:"Ask again"})})]},e.key))]}):null]})}const styles=_reactNative.StyleSheet.create({scroll:{flex:1},content:{padding:_sharedUi.night.gutter,gap:10,paddingBottom:32},section:{color:_sharedUi.night.color.textTertiary,fontSize:10,fontWeight:"700",letterSpacing:.6,paddingHorizontal:4,paddingTop:4},warning:{flexDirection:"row",gap:8,padding:_sharedUi.night.cardPad,borderRadius:_sharedUi.night.radius.card,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.warning,backgroundColor:_sharedUi.night.color.surface},warningText:{flex:1,color:_sharedUi.night.color.warning,fontSize:_sharedUi.night.font.micro,lineHeight:16},trustedBox:{gap:6,paddingTop:6},trustedRow:{flexDirection:"row",alignItems:"center",gap:10,padding:_sharedUi.night.cardPad,borderRadius:_sharedUi.night.radius.card,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surface},trustedLabel:{flex:1,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,lineHeight:18},forget:{paddingHorizontal:10,paddingVertical:6,borderRadius:_sharedUi.night.radius.row,backgroundColor:_sharedUi.night.color.button},forgetText:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.micro,fontWeight:"600"},note:{color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.micro,lineHeight:16,paddingHorizontal:4}});
|
|
@@ -1,212 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ChangesBar = ChangesBar;
|
|
7
|
-
exports.useLedgerEntries = useLedgerEntries;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _reactNative = require("react-native");
|
|
10
|
-
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
11
|
-
var _agentCore = require("@buoy-gg/agent-core");
|
|
12
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
/**
|
|
14
|
-
* "The agent changed things" — the bar, and the list behind it.
|
|
15
|
-
*
|
|
16
|
-
* Ask Buoy mutates without asking, so this is what keeps the user in control:
|
|
17
|
-
* if reality has been bent, you can never not know it. Same principle as the
|
|
18
|
-
* impersonate and override banners.
|
|
19
|
-
*
|
|
20
|
-
* It counts REVERSIBLE and ONE-SHOT effects separately, which is the one place
|
|
21
|
-
* this deliberately differs from the Scenarios banner. That one folds
|
|
22
|
-
* transients into a single "N changes" total and then silently no-ops on them
|
|
23
|
-
* at revert — a user who taps Undo, sees "4 changes", and finds three of them
|
|
24
|
-
* still in place learns not to trust the bar. Better to say "1 undoable ·
|
|
25
|
-
* 1 permanent" and be believed.
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
const EMPTY = [];
|
|
29
|
-
function useLedgerEntries(ledger) {
|
|
30
|
-
return (0, _react.useSyncExternalStore)(fn => ledger?.subscribe(fn) ?? (() => {}), () => ledger?.list() ?? EMPTY, () => ledger?.list() ?? EMPTY);
|
|
31
|
-
}
|
|
32
|
-
function ChangesBar({
|
|
33
|
-
ledger,
|
|
34
|
-
onUndoAll,
|
|
35
|
-
expanded,
|
|
36
|
-
onToggle
|
|
37
|
-
}) {
|
|
38
|
-
const entries = useLedgerEntries(ledger);
|
|
39
|
-
const outstanding = entries.filter(e => !e.undoneAt);
|
|
40
|
-
// Transients — navigation, taps — are one-shot ACTIONS, not changes. Counting
|
|
41
|
-
// them here read "Changed this app · 9 permanent" after a read-only tour,
|
|
42
|
-
// which is the bar lying in the alarming direction. They still appear in the
|
|
43
|
-
// expanded panel's footnote, because honesty, but they raise no banner.
|
|
44
|
-
const changes = outstanding.filter(e => e.effect.kind !== "transient");
|
|
45
|
-
if (changes.length === 0) return null;
|
|
46
|
-
const reversible = changes.filter(e => (0, _agentCore.isReversible)(e.effect));
|
|
47
|
-
const permanent = changes.length - reversible.length;
|
|
48
|
-
const transients = outstanding.length - changes.length;
|
|
49
|
-
const Chevron = expanded ? _sharedUi.ChevronDown : _sharedUi.ChevronRight;
|
|
50
|
-
const counts = [reversible.length > 0 ? `${reversible.length} undoable` : null, permanent > 0 ? `${permanent} permanent` : null].filter(Boolean).join(" · ");
|
|
51
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
52
|
-
style: styles.wrap,
|
|
53
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
|
|
54
|
-
testID: "buoy-ask-buoy-changes-bar",
|
|
55
|
-
accessibilityRole: "button",
|
|
56
|
-
accessibilityState: {
|
|
57
|
-
expanded
|
|
58
|
-
},
|
|
59
|
-
onPress: onToggle,
|
|
60
|
-
style: styles.bar,
|
|
61
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
62
|
-
style: styles.dot
|
|
63
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
64
|
-
style: styles.summary,
|
|
65
|
-
numberOfLines: 1,
|
|
66
|
-
children: "Changed this app"
|
|
67
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
68
|
-
style: styles.counts,
|
|
69
|
-
numberOfLines: 1,
|
|
70
|
-
children: counts
|
|
71
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Chevron, {
|
|
72
|
-
size: 12,
|
|
73
|
-
color: _sharedUi.night.color.textSecondary
|
|
74
|
-
})]
|
|
75
|
-
}), expanded && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
76
|
-
style: styles.panel,
|
|
77
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.ScrollView, {
|
|
78
|
-
style: styles.panelScroll,
|
|
79
|
-
testID: "buoy-ask-buoy-changes-scroll",
|
|
80
|
-
keyboardShouldPersistTaps: "handled",
|
|
81
|
-
children: [changes.map(entry => {
|
|
82
|
-
const oneOff = !(0, _agentCore.isReversible)(entry.effect);
|
|
83
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
84
|
-
style: styles.row,
|
|
85
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
86
|
-
style: styles.rowLabel,
|
|
87
|
-
children: entry.effect.label
|
|
88
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
89
|
-
style: [styles.rowTag, oneOff && styles.rowTagMuted],
|
|
90
|
-
children: oneOff ? "Permanent" : "Undoable"
|
|
91
|
-
})]
|
|
92
|
-
}, entry.id);
|
|
93
|
-
}), transients > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
94
|
-
style: styles.row,
|
|
95
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
|
|
96
|
-
style: [styles.rowLabel, styles.rowLabelMuted],
|
|
97
|
-
children: ["Also did ", transients, " one-shot action", transients === 1 ? "" : "s", " (navigation, taps) \u2014 nothing to undo."]
|
|
98
|
-
})
|
|
99
|
-
})]
|
|
100
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
101
|
-
style: styles.footer,
|
|
102
|
-
children: [reversible.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
103
|
-
testID: "buoy-ask-buoy-undo-all",
|
|
104
|
-
accessibilityRole: "button",
|
|
105
|
-
onPress: onUndoAll,
|
|
106
|
-
style: ({
|
|
107
|
-
pressed
|
|
108
|
-
}) => [styles.undo, pressed && styles.pressed],
|
|
109
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
|
|
110
|
-
style: styles.undoText,
|
|
111
|
-
children: ["Undo ", reversible.length, " change", reversible.length === 1 ? "" : "s"]
|
|
112
|
-
})
|
|
113
|
-
}), permanent > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
114
|
-
style: styles.footnote,
|
|
115
|
-
children: "Permanent changes can't be undone from here."
|
|
116
|
-
})]
|
|
117
|
-
})]
|
|
118
|
-
})]
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
const styles = _reactNative.StyleSheet.create({
|
|
122
|
-
wrap: {
|
|
123
|
-
borderBottomWidth: _reactNative.StyleSheet.hairlineWidth,
|
|
124
|
-
borderBottomColor: _sharedUi.night.color.border,
|
|
125
|
-
backgroundColor: _sharedUi.night.color.warningSoft
|
|
126
|
-
},
|
|
127
|
-
bar: {
|
|
128
|
-
flexDirection: "row",
|
|
129
|
-
alignItems: "center",
|
|
130
|
-
gap: 8,
|
|
131
|
-
paddingHorizontal: _sharedUi.night.gutter,
|
|
132
|
-
paddingVertical: 10
|
|
133
|
-
},
|
|
134
|
-
dot: {
|
|
135
|
-
width: 7,
|
|
136
|
-
height: 7,
|
|
137
|
-
borderRadius: 4,
|
|
138
|
-
backgroundColor: _sharedUi.night.color.warning
|
|
139
|
-
},
|
|
140
|
-
summary: {
|
|
141
|
-
color: _sharedUi.night.color.text,
|
|
142
|
-
fontSize: _sharedUi.night.font.caption,
|
|
143
|
-
fontWeight: "600"
|
|
144
|
-
},
|
|
145
|
-
counts: {
|
|
146
|
-
flex: 1,
|
|
147
|
-
color: _sharedUi.night.color.textSecondary,
|
|
148
|
-
fontSize: _sharedUi.night.font.caption
|
|
149
|
-
},
|
|
150
|
-
panel: {
|
|
151
|
-
paddingHorizontal: _sharedUi.night.gutter,
|
|
152
|
-
paddingBottom: 12,
|
|
153
|
-
gap: 10
|
|
154
|
-
},
|
|
155
|
-
panelScroll: {
|
|
156
|
-
maxHeight: 180
|
|
157
|
-
},
|
|
158
|
-
row: {
|
|
159
|
-
flexDirection: "row",
|
|
160
|
-
alignItems: "flex-start",
|
|
161
|
-
gap: 10,
|
|
162
|
-
paddingVertical: 8,
|
|
163
|
-
borderTopWidth: _reactNative.StyleSheet.hairlineWidth,
|
|
164
|
-
borderTopColor: _sharedUi.night.color.separator
|
|
165
|
-
},
|
|
166
|
-
rowLabel: {
|
|
167
|
-
flex: 1,
|
|
168
|
-
color: _sharedUi.night.color.text,
|
|
169
|
-
fontSize: _sharedUi.night.font.caption,
|
|
170
|
-
lineHeight: 18
|
|
171
|
-
},
|
|
172
|
-
rowTag: {
|
|
173
|
-
color: _sharedUi.night.color.accent,
|
|
174
|
-
fontSize: _sharedUi.night.font.micro,
|
|
175
|
-
fontWeight: "600",
|
|
176
|
-
letterSpacing: 0.6,
|
|
177
|
-
textTransform: "uppercase",
|
|
178
|
-
paddingTop: 2
|
|
179
|
-
},
|
|
180
|
-
rowTagMuted: {
|
|
181
|
-
color: _sharedUi.night.color.textTertiary
|
|
182
|
-
},
|
|
183
|
-
rowLabelMuted: {
|
|
184
|
-
color: _sharedUi.night.color.textTertiary
|
|
185
|
-
},
|
|
186
|
-
footer: {
|
|
187
|
-
flexDirection: "row",
|
|
188
|
-
alignItems: "center",
|
|
189
|
-
gap: 12,
|
|
190
|
-
flexWrap: "wrap"
|
|
191
|
-
},
|
|
192
|
-
undo: {
|
|
193
|
-
paddingHorizontal: 14,
|
|
194
|
-
paddingVertical: 8,
|
|
195
|
-
borderRadius: _sharedUi.night.radius.row,
|
|
196
|
-
backgroundColor: _sharedUi.night.color.button
|
|
197
|
-
},
|
|
198
|
-
undoText: {
|
|
199
|
-
color: _sharedUi.night.color.accent,
|
|
200
|
-
fontSize: _sharedUi.night.font.caption,
|
|
201
|
-
fontWeight: "600"
|
|
202
|
-
},
|
|
203
|
-
footnote: {
|
|
204
|
-
flex: 1,
|
|
205
|
-
color: _sharedUi.night.color.textTertiary,
|
|
206
|
-
fontSize: _sharedUi.night.font.micro
|
|
207
|
-
},
|
|
208
|
-
pressed: {
|
|
209
|
-
opacity: 0.7
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
//# sourceMappingURL=ChangesBar.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ChangesBar=ChangesBar;exports.useLedgerEntries=useLedgerEntries;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _agentCore=require("@buoy-gg/agent-core");var _jsxRuntime=require("react/jsx-runtime");const EMPTY=[];function useLedgerEntries(o){return(0,_react.useSyncExternalStore)(n=>o?.subscribe(n)??(()=>{}),()=>o?.list()??EMPTY,()=>o?.list()??EMPTY)}function ChangesBar({ledger:o,onUndoAll:n,expanded:i,onToggle:h}){const g=useLedgerEntries(o);const a=g.filter(e=>!e.undoneAt);const r=a.filter(e=>e.effect.kind!=="transient");if(r.length===0)return null;const t=r.filter(e=>(0,_agentCore.isReversible)(e.effect));const l=r.length-t.length;const s=a.length-r.length;const d=i?_sharedUi.ChevronDown:_sharedUi.ChevronRight;const u=[t.length>0?`${t.length} undoable`:null,l>0?`${l} permanent`:null].filter(Boolean).join(" \xB7 ");return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.wrap,children:[(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{testID:"buoy-ask-buoy-changes-bar",accessibilityRole:"button",accessibilityState:{expanded:i},onPress:h,style:styles.bar,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.dot}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.summary,numberOfLines:1,children:"Changed this app"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.counts,numberOfLines:1,children:u}),(0,_jsxRuntime.jsx)(d,{size:12,color:_sharedUi.night.color.textSecondary})]}),i&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.panel,children:[(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{style:styles.panelScroll,testID:"buoy-ask-buoy-changes-scroll",keyboardShouldPersistTaps:"handled",children:[r.map(e=>{const c=!(0,_agentCore.isReversible)(e.effect);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.row,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowLabel,children:e.effect.label}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.rowTag,c&&styles.rowTagMuted],children:c?"Permanent":"Undoable"})]},e.id)}),s>0&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.row,children:(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:[styles.rowLabel,styles.rowLabelMuted],children:["Also did ",s," one-shot action",s===1?"":"s"," (navigation, taps) \u2014 nothing to undo."]})})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.footer,children:[t.length>0&&(0,_jsxRuntime.jsx)(_reactNative.Pressable,{testID:"buoy-ask-buoy-undo-all",accessibilityRole:"button",onPress:n,style:({pressed:e})=>[styles.undo,e&&styles.pressed],children:(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.undoText,children:["Undo ",t.length," change",t.length===1?"":"s"]})}),l>0&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.footnote,children:"Permanent changes can't be undone from here."})]})]})]})}const styles=_reactNative.StyleSheet.create({wrap:{borderBottomWidth:_reactNative.StyleSheet.hairlineWidth,borderBottomColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.warningSoft},bar:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:_sharedUi.night.gutter,paddingVertical:10},dot:{width:7,height:7,borderRadius:4,backgroundColor:_sharedUi.night.color.warning},summary:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},counts:{flex:1,color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption},panel:{paddingHorizontal:_sharedUi.night.gutter,paddingBottom:12,gap:10},panelScroll:{maxHeight:180},row:{flexDirection:"row",alignItems:"flex-start",gap:10,paddingVertical:8,borderTopWidth:_reactNative.StyleSheet.hairlineWidth,borderTopColor:_sharedUi.night.color.separator},rowLabel:{flex:1,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,lineHeight:18},rowTag:{color:_sharedUi.night.color.accent,fontSize:_sharedUi.night.font.micro,fontWeight:"600",letterSpacing:.6,textTransform:"uppercase",paddingTop:2},rowTagMuted:{color:_sharedUi.night.color.textTertiary},rowLabelMuted:{color:_sharedUi.night.color.textTertiary},footer:{flexDirection:"row",alignItems:"center",gap:12,flexWrap:"wrap"},undo:{paddingHorizontal:14,paddingVertical:8,borderRadius:_sharedUi.night.radius.row,backgroundColor:_sharedUi.night.color.button},undoText:{color:_sharedUi.night.color.accent,fontSize:_sharedUi.night.font.caption,fontWeight:"600"},footnote:{flex:1,color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.micro},pressed:{opacity:.7}});
|
|
@@ -1,255 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Composer = Composer;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
10
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
/**
|
|
12
|
-
* The message box.
|
|
13
|
-
*
|
|
14
|
-
* This is the first keyboard-safe BOTTOM input in Buoy, and the reason none
|
|
15
|
-
* existed before is that JsModal has no keyboard handling at all: the sheet is
|
|
16
|
-
* `position:absolute; bottom:0` inside the app tree, not an RN `Modal`, so on
|
|
17
|
-
* iOS the keyboard simply draws over it. Two other tools hit this and chose to
|
|
18
|
-
* dodge it — NetworkNumberPrompt and StorageValueEditModal both say so in
|
|
19
|
-
* comments and pin their inputs to the TOP of the screen. A chat cannot.
|
|
20
|
-
*
|
|
21
|
-
* What makes it work:
|
|
22
|
-
* - `KeyboardPad` (see that file), iOS only. `KeyboardAvoidingView` looked
|
|
23
|
-
* right here and did nothing: it measures its frame relative to its PARENT
|
|
24
|
-
* and compares that with the keyboard's SCREEN position, which never
|
|
25
|
-
* overlap inside a bottom-anchored sheet. On Android Expo's default
|
|
26
|
-
* `softwareKeyboardLayoutMode: "resize"` shrinks the window and a
|
|
27
|
-
* bottom-anchored view rides up for free; adding padding there would lift
|
|
28
|
-
* it twice.
|
|
29
|
-
* - The parent list carries `keyboardShouldPersistTaps="handled"`. Without it
|
|
30
|
-
* the first tap after typing only dismisses the keyboard and Send never
|
|
31
|
-
* fires — a real shipped bug in Time Machine, and invisible to Detox because
|
|
32
|
-
* `replaceText` opens no keyboard.
|
|
33
|
-
* - `keyboardType="ascii-capable"`, because iOS Smart Punctuation rewrites
|
|
34
|
-
* straight quotes as curly ones. That permanently broke the raw-JSON editor
|
|
35
|
-
* in Storage, and a tester pasting a JSON blob here would hit the same wall.
|
|
36
|
-
*
|
|
37
|
-
* While the agent is working the send button becomes a STOP button — a
|
|
38
|
-
* square, the universal glyph — rather than a spinner in a circle, which
|
|
39
|
-
* looked like a disabled control and gave no hint it was tappable.
|
|
40
|
-
*/
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* One line of input, and the height of the send/stop button beside it — the
|
|
44
|
-
* row only reads as level while those two agree.
|
|
45
|
-
*/
|
|
46
|
-
const MIN_INPUT_HEIGHT = 40;
|
|
47
|
-
/** ~5 lines, then it scrolls instead of eating the transcript. */
|
|
48
|
-
const MAX_INPUT_HEIGHT = 120;
|
|
49
|
-
const INPUT_PAD_V = _reactNative.Platform.OS === "ios" ? 10 : 6;
|
|
50
|
-
const INPUT_PAD_H = 16;
|
|
51
|
-
function Composer({
|
|
52
|
-
onSend,
|
|
53
|
-
onStop,
|
|
54
|
-
busy,
|
|
55
|
-
draft,
|
|
56
|
-
onDraftTaken,
|
|
57
|
-
disabled,
|
|
58
|
-
placeholder,
|
|
59
|
-
focusKey,
|
|
60
|
-
canFocus = true
|
|
61
|
-
}) {
|
|
62
|
-
const [text, setText] = (0, _react.useState)("");
|
|
63
|
-
const inputRef = (0, _react.useRef)(null);
|
|
64
|
-
(0, _react.useEffect)(() => {
|
|
65
|
-
if (!focusKey || !canFocus || disabled) return;
|
|
66
|
-
inputRef.current?.focus();
|
|
67
|
-
}, [focusKey, canFocus, disabled]);
|
|
68
|
-
(0, _react.useEffect)(() => {
|
|
69
|
-
if (!draft) return;
|
|
70
|
-
// Appended, not assigned: they may have started typing something else in
|
|
71
|
-
// the moment between pressing Stop and this landing.
|
|
72
|
-
setText(current => current ? `${current} ${draft}` : draft);
|
|
73
|
-
onDraftTaken?.();
|
|
74
|
-
}, [draft, onDraftTaken]);
|
|
75
|
-
const submit = (0, _react.useCallback)(() => {
|
|
76
|
-
const value = text.trim();
|
|
77
|
-
if (!value) return;
|
|
78
|
-
setText("");
|
|
79
|
-
onSend(value);
|
|
80
|
-
}, [text, onSend]);
|
|
81
|
-
const canSend = text.trim().length > 0 && !busy && !disabled;
|
|
82
|
-
/**
|
|
83
|
-
* Typed something while a turn is running.
|
|
84
|
-
*
|
|
85
|
-
* `send` parks it and flushes it when the turn ends — but the only button on
|
|
86
|
-
* screen while busy was Stop, so the sole way to reach that was the
|
|
87
|
-
* keyboard's return key, and the "Queued" placeholder that explains it only
|
|
88
|
-
* appears AFTER you have managed it. The button is the affordance.
|
|
89
|
-
*/
|
|
90
|
-
const canQueue = text.trim().length > 0 && busy && !disabled;
|
|
91
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
92
|
-
style: styles.wrap,
|
|
93
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
94
|
-
style: [styles.field, disabled && styles.fieldDisabled],
|
|
95
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
|
|
96
|
-
ref: inputRef,
|
|
97
|
-
testID: "buoy-ask-buoy-input"
|
|
98
|
-
/*
|
|
99
|
-
* Empty means one line, always.
|
|
100
|
-
*
|
|
101
|
-
* The box is otherwise auto-height, and an iOS multiline TextInput
|
|
102
|
-
* grows with the text but never shrinks back: sending a two-line
|
|
103
|
-
* message cleared the text and left a two-line box standing over
|
|
104
|
-
* the 40pt round button beside it. Nothing on the native side
|
|
105
|
-
* reports the shrink either — on Fabric `onContentSizeChange` is
|
|
106
|
-
* emitted from `updateLayoutMetrics` (a LAYOUT change), not from a
|
|
107
|
-
* text change — so the height it last grew to is the height it
|
|
108
|
-
* keeps. Pinning the empty case is the whole fix: it is the only
|
|
109
|
-
* state that has to line up with the button, and it is exactly the
|
|
110
|
-
* state a send or a new conversation lands in.
|
|
111
|
-
*/,
|
|
112
|
-
style: [styles.input, text.length === 0 && styles.inputEmpty],
|
|
113
|
-
value: text,
|
|
114
|
-
onChangeText: setText,
|
|
115
|
-
placeholder: placeholder ?? (disabled ? "Ask Buoy isn't set up yet" : "Ask, or tell it what to change…"),
|
|
116
|
-
placeholderTextColor: _sharedUi.night.color.placeholder,
|
|
117
|
-
multiline: true,
|
|
118
|
-
editable: !disabled
|
|
119
|
-
// Straight quotes only — see the header note.
|
|
120
|
-
,
|
|
121
|
-
keyboardType: "ascii-capable",
|
|
122
|
-
autoCorrect: true,
|
|
123
|
-
autoCapitalize: "sentences"
|
|
124
|
-
// Enter sends; Shift-Enter is not a thing on a phone keyboard, and a
|
|
125
|
-
// multiline box with no submit affordance strands people.
|
|
126
|
-
,
|
|
127
|
-
blurOnSubmit: false,
|
|
128
|
-
onSubmitEditing: submit,
|
|
129
|
-
returnKeyType: "send",
|
|
130
|
-
maxLength: 4000
|
|
131
|
-
})
|
|
132
|
-
}), canQueue && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
133
|
-
testID: "buoy-ask-buoy-queue",
|
|
134
|
-
accessibilityRole: "button",
|
|
135
|
-
accessibilityLabel: "Queue message",
|
|
136
|
-
onPress: submit,
|
|
137
|
-
style: ({
|
|
138
|
-
pressed
|
|
139
|
-
}) => [styles.button, styles.queue, pressed && styles.pressed],
|
|
140
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
141
|
-
style: [styles.sendGlyph, {
|
|
142
|
-
color: _sharedUi.night.color.accent
|
|
143
|
-
}],
|
|
144
|
-
children: "\u2191"
|
|
145
|
-
})
|
|
146
|
-
}), busy ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
147
|
-
testID: "buoy-ask-buoy-stop",
|
|
148
|
-
accessibilityRole: "button",
|
|
149
|
-
accessibilityLabel: "Stop",
|
|
150
|
-
onPress: onStop,
|
|
151
|
-
style: ({
|
|
152
|
-
pressed
|
|
153
|
-
}) => [styles.button, styles.stop, pressed && styles.pressed],
|
|
154
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
155
|
-
style: styles.stopGlyph
|
|
156
|
-
})
|
|
157
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
158
|
-
testID: "buoy-ask-buoy-send",
|
|
159
|
-
accessibilityRole: "button",
|
|
160
|
-
accessibilityLabel: "Send",
|
|
161
|
-
disabled: !canSend,
|
|
162
|
-
onPress: submit,
|
|
163
|
-
style: ({
|
|
164
|
-
pressed
|
|
165
|
-
}) => [styles.button, canSend ? styles.sendOn : styles.sendOff, pressed && canSend && styles.pressed],
|
|
166
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
167
|
-
style: [styles.sendGlyph, {
|
|
168
|
-
color: canSend ? _sharedUi.night.color.onAccent : _sharedUi.night.color.textTertiary
|
|
169
|
-
}],
|
|
170
|
-
children: "\u2191"
|
|
171
|
-
})
|
|
172
|
-
})]
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
const styles = _reactNative.StyleSheet.create({
|
|
176
|
-
wrap: {
|
|
177
|
-
flexDirection: "row",
|
|
178
|
-
alignItems: "flex-end",
|
|
179
|
-
gap: 8,
|
|
180
|
-
paddingHorizontal: _sharedUi.night.gutter,
|
|
181
|
-
paddingTop: 10,
|
|
182
|
-
paddingBottom: 6,
|
|
183
|
-
borderTopWidth: _reactNative.StyleSheet.hairlineWidth,
|
|
184
|
-
borderTopColor: _sharedUi.night.color.border,
|
|
185
|
-
// Opaque: messages scroll UNDER the composer, and a translucent bar over
|
|
186
|
-
// moving text is unreadable.
|
|
187
|
-
backgroundColor: _sharedUi.night.color.bg
|
|
188
|
-
},
|
|
189
|
-
field: {
|
|
190
|
-
flex: 1,
|
|
191
|
-
minHeight: MIN_INPUT_HEIGHT,
|
|
192
|
-
justifyContent: "center",
|
|
193
|
-
borderRadius: 20,
|
|
194
|
-
borderWidth: _reactNative.StyleSheet.hairlineWidth,
|
|
195
|
-
borderColor: _sharedUi.night.color.border,
|
|
196
|
-
backgroundColor: _sharedUi.night.color.surfaceElevated
|
|
197
|
-
},
|
|
198
|
-
fieldDisabled: {
|
|
199
|
-
opacity: 0.6
|
|
200
|
-
},
|
|
201
|
-
input: {
|
|
202
|
-
maxHeight: MAX_INPUT_HEIGHT,
|
|
203
|
-
paddingHorizontal: INPUT_PAD_H,
|
|
204
|
-
paddingTop: INPUT_PAD_V,
|
|
205
|
-
paddingBottom: INPUT_PAD_V,
|
|
206
|
-
color: _sharedUi.night.color.text,
|
|
207
|
-
fontSize: _sharedUi.night.font.row
|
|
208
|
-
// No `lineHeight` here on purpose. A multiline TextInput on iOS lays out
|
|
209
|
-
// with the paragraph line height AND the font's own leading, so setting
|
|
210
|
-
// it made a one-line box measure ~56pt instead of 40 — the pill towered
|
|
211
|
-
// over the 40pt send/stop button beside it and the row read as crooked.
|
|
212
|
-
},
|
|
213
|
-
// Exactly the button's height, so the two read as one level row.
|
|
214
|
-
inputEmpty: {
|
|
215
|
-
height: MIN_INPUT_HEIGHT
|
|
216
|
-
},
|
|
217
|
-
button: {
|
|
218
|
-
width: 40,
|
|
219
|
-
height: 40,
|
|
220
|
-
borderRadius: 20,
|
|
221
|
-
alignItems: "center",
|
|
222
|
-
justifyContent: "center"
|
|
223
|
-
},
|
|
224
|
-
sendGlyph: {
|
|
225
|
-
fontSize: 20,
|
|
226
|
-
fontWeight: "700",
|
|
227
|
-
lineHeight: 22
|
|
228
|
-
},
|
|
229
|
-
sendOn: {
|
|
230
|
-
backgroundColor: _sharedUi.night.color.accent
|
|
231
|
-
},
|
|
232
|
-
sendOff: {
|
|
233
|
-
backgroundColor: _sharedUi.night.color.fill
|
|
234
|
-
},
|
|
235
|
-
stop: {
|
|
236
|
-
backgroundColor: _sharedUi.night.color.fillTertiary
|
|
237
|
-
},
|
|
238
|
-
// Outlined rather than filled: it sits beside Stop, and two solid buttons
|
|
239
|
-
// read as one control with two halves.
|
|
240
|
-
queue: {
|
|
241
|
-
backgroundColor: "transparent",
|
|
242
|
-
borderWidth: _reactNative.StyleSheet.hairlineWidth,
|
|
243
|
-
borderColor: _sharedUi.night.color.accentBorderStrong
|
|
244
|
-
},
|
|
245
|
-
stopGlyph: {
|
|
246
|
-
width: 12,
|
|
247
|
-
height: 12,
|
|
248
|
-
borderRadius: 2,
|
|
249
|
-
backgroundColor: _sharedUi.night.color.text
|
|
250
|
-
},
|
|
251
|
-
pressed: {
|
|
252
|
-
opacity: 0.7
|
|
253
|
-
}
|
|
254
|
-
});
|
|
255
|
-
//# sourceMappingURL=Composer.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Composer=Composer;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _jsxRuntime=require("react/jsx-runtime");const MIN_INPUT_HEIGHT=40;const MAX_INPUT_HEIGHT=120;const INPUT_PAD_V=_reactNative.Platform.OS==="ios"?10:6;const INPUT_PAD_H=16;function Composer({onSend:c,onStop:p,busy:n,draft:r,onDraftTaken:a,disabled:t,placeholder:g,focusKey:u,canFocus:d=true}){const[o,s]=(0,_react.useState)("");const h=(0,_react.useRef)(null);(0,_react.useEffect)(()=>{if(!u||!d||t)return;h.current?.focus()},[u,d,t]);(0,_react.useEffect)(()=>{if(!r)return;s(e=>e?`${e} ${r}`:r);a?.()},[r,a]);const l=(0,_react.useCallback)(()=>{const e=o.trim();if(!e)return;s("");c(e)},[o,c]);const i=o.trim().length>0&&!n&&!t;const b=o.trim().length>0&&n&&!t;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.wrap,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.field,t&&styles.fieldDisabled],children:(0,_jsxRuntime.jsx)(_reactNative.TextInput,{ref:h,testID:"buoy-ask-buoy-input",style:[styles.input,o.length===0&&styles.inputEmpty],value:o,onChangeText:s,placeholder:g??(t?"Ask Buoy isn't set up yet":"Ask, or tell it what to change\u2026"),placeholderTextColor:_sharedUi.night.color.placeholder,multiline:true,editable:!t,keyboardType:"ascii-capable",autoCorrect:true,autoCapitalize:"sentences",blurOnSubmit:false,onSubmitEditing:l,returnKeyType:"send",maxLength:4e3})}),b&&(0,_jsxRuntime.jsx)(_reactNative.Pressable,{testID:"buoy-ask-buoy-queue",accessibilityRole:"button",accessibilityLabel:"Queue message",onPress:l,style:({pressed:e})=>[styles.button,styles.queue,e&&styles.pressed],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.sendGlyph,{color:_sharedUi.night.color.accent}],children:"\u2191"})}),n?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{testID:"buoy-ask-buoy-stop",accessibilityRole:"button",accessibilityLabel:"Stop",onPress:p,style:({pressed:e})=>[styles.button,styles.stop,e&&styles.pressed],children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.stopGlyph})}):(0,_jsxRuntime.jsx)(_reactNative.Pressable,{testID:"buoy-ask-buoy-send",accessibilityRole:"button",accessibilityLabel:"Send",disabled:!i,onPress:l,style:({pressed:e})=>[styles.button,i?styles.sendOn:styles.sendOff,e&&i&&styles.pressed],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.sendGlyph,{color:i?_sharedUi.night.color.onAccent:_sharedUi.night.color.textTertiary}],children:"\u2191"})})]})}const styles=_reactNative.StyleSheet.create({wrap:{flexDirection:"row",alignItems:"flex-end",gap:8,paddingHorizontal:_sharedUi.night.gutter,paddingTop:10,paddingBottom:6,borderTopWidth:_reactNative.StyleSheet.hairlineWidth,borderTopColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.bg},field:{flex:1,minHeight:MIN_INPUT_HEIGHT,justifyContent:"center",borderRadius:20,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surfaceElevated},fieldDisabled:{opacity:.6},input:{maxHeight:MAX_INPUT_HEIGHT,paddingHorizontal:INPUT_PAD_H,paddingTop:INPUT_PAD_V,paddingBottom:INPUT_PAD_V,color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.row},inputEmpty:{height:MIN_INPUT_HEIGHT},button:{width:40,height:40,borderRadius:20,alignItems:"center",justifyContent:"center"},sendGlyph:{fontSize:20,fontWeight:"700",lineHeight:22},sendOn:{backgroundColor:_sharedUi.night.color.accent},sendOff:{backgroundColor:_sharedUi.night.color.fill},stop:{backgroundColor:_sharedUi.night.color.fillTertiary},queue:{backgroundColor:"transparent",borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.accentBorderStrong},stopGlyph:{width:12,height:12,borderRadius:2,backgroundColor:_sharedUi.night.color.text},pressed:{opacity:.7}});
|