@buoy-gg/ask-buoy 7.0.33 → 7.0.34
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 +1 -1
- package/lib/commonjs/blocks/AskBlocks.js +1 -338
- package/lib/commonjs/blocks/BlockRenderer.js +1 -250
- package/lib/commonjs/blocks/ChromePrototypes.js +1 -514
- package/lib/commonjs/blocks/DataBlocks.js +1 -545
- package/lib/commonjs/blocks/ExtraBlocks.js +1 -1821
- package/lib/commonjs/blocks/MediaBlocks.js +1 -140
- package/lib/commonjs/blocks/ReceiptBlocks.js +1 -596
- 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/primitives.js +1 -312
- package/lib/commonjs/blocks/primitivesIndex.js +1 -56
- package/lib/commonjs/components/ApprovalCard.js +1 -140
- package/lib/commonjs/components/AskBuoyHeader.js +1 -127
- package/lib/commonjs/components/AskBuoyIcon.js +1 -19
- package/lib/commonjs/components/AskBuoyModal.js +1 -322
- package/lib/commonjs/components/ChangesBar.js +1 -211
- package/lib/commonjs/components/Composer.js +1 -175
- package/lib/commonjs/components/EmptyState.js +1 -154
- package/lib/commonjs/components/Markdown.js +1 -252
- package/lib/commonjs/components/MessageList.js +1 -648
- package/lib/commonjs/components/TypingDots.js +1 -63
- package/lib/commonjs/index.js +1 -205
- package/lib/commonjs/preset.js +1 -90
- package/lib/commonjs/store/askBuoyStore.js +1 -279
- package/lib/commonjs/store/useAskBuoy.js +1 -299
- package/lib/commonjs/sync/askBuoySyncAdapter.js +1 -119
- package/lib/commonjs/sync/askBuoySyncAdapter.test.js +1 -136
- 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 -245
- package/lib/module/blocks/ChromePrototypes.js +1 -503
- package/lib/module/blocks/DataBlocks.js +1 -532
- package/lib/module/blocks/ExtraBlocks.js +1 -1794
- package/lib/module/blocks/MediaBlocks.js +1 -135
- package/lib/module/blocks/ReceiptBlocks.js +1 -584
- 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/primitives.js +1 -301
- package/lib/module/blocks/primitivesIndex.js +1 -5
- package/lib/module/components/ApprovalCard.js +1 -135
- package/lib/module/components/AskBuoyHeader.js +1 -124
- package/lib/module/components/AskBuoyIcon.js +1 -8
- package/lib/module/components/AskBuoyModal.js +1 -317
- package/lib/module/components/ChangesBar.js +1 -206
- package/lib/module/components/Composer.js +1 -170
- package/lib/module/components/EmptyState.js +1 -149
- package/lib/module/components/Markdown.js +1 -246
- package/lib/module/components/MessageList.js +1 -642
- package/lib/module/components/TypingDots.js +1 -58
- package/lib/module/index.js +1 -29
- package/lib/module/preset.js +1 -73
- package/lib/module/store/askBuoyStore.js +1 -275
- package/lib/module/store/useAskBuoy.js +1 -293
- package/lib/module/sync/askBuoySyncAdapter.js +1 -114
- package/lib/module/sync/askBuoySyncAdapter.test.js +1 -135
- package/lib/module/sync/wire.js +1 -47
- package/lib/module/types.js +1 -4
- package/lib/typescript/preset.d.ts +1 -1
- 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/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/primitives.js.map +0 -1
- package/lib/commonjs/blocks/primitivesIndex.js.map +0 -1
- package/lib/commonjs/components/ApprovalCard.js.map +0 -1
- package/lib/commonjs/components/AskBuoyHeader.js.map +0 -1
- package/lib/commonjs/components/AskBuoyIcon.js.map +0 -1
- package/lib/commonjs/components/AskBuoyModal.js.map +0 -1
- package/lib/commonjs/components/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/Markdown.js.map +0 -1
- package/lib/commonjs/components/MessageList.js.map +0 -1
- package/lib/commonjs/components/TypingDots.js.map +0 -1
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/preset.js.map +0 -1
- package/lib/commonjs/store/askBuoyStore.js.map +0 -1
- package/lib/commonjs/store/useAskBuoy.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/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/primitives.js.map +0 -1
- package/lib/module/blocks/primitivesIndex.js.map +0 -1
- package/lib/module/components/ApprovalCard.js.map +0 -1
- package/lib/module/components/AskBuoyHeader.js.map +0 -1
- package/lib/module/components/AskBuoyIcon.js.map +0 -1
- package/lib/module/components/AskBuoyModal.js.map +0 -1
- package/lib/module/components/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/Markdown.js.map +0 -1
- package/lib/module/components/MessageList.js.map +0 -1
- package/lib/module/components/TypingDots.js.map +0 -1
- package/lib/module/index.js.map +0 -1
- package/lib/module/preset.js.map +0 -1
- package/lib/module/store/askBuoyStore.js.map +0 -1
- package/lib/module/store/useAskBuoy.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/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/primitives.d.ts.map +0 -1
- package/lib/typescript/blocks/primitivesIndex.d.ts.map +0 -1
- package/lib/typescript/components/ApprovalCard.d.ts.map +0 -1
- package/lib/typescript/components/AskBuoyHeader.d.ts.map +0 -1
- package/lib/typescript/components/AskBuoyIcon.d.ts.map +0 -1
- package/lib/typescript/components/AskBuoyModal.d.ts.map +0 -1
- package/lib/typescript/components/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/Markdown.d.ts.map +0 -1
- package/lib/typescript/components/MessageList.d.ts.map +0 -1
- package/lib/typescript/components/TypingDots.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/askBuoyStore.d.ts.map +0 -1
- package/lib/typescript/store/useAskBuoy.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,91 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/** The small named icons a block may ask for. One place, one size. */
|
|
4
|
-
import { View, StyleSheet } from "react-native";
|
|
5
|
-
import { AlertTriangle, Check, Clock, Database, Eye, Globe, Image as ImageIcon, Info, Layers, Navigation, night, User } from "@buoy-gg/shared-ui";
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
export function BlockIcon({
|
|
8
|
-
name,
|
|
9
|
-
size = 14
|
|
10
|
-
}) {
|
|
11
|
-
const c = night.color.textSecondary;
|
|
12
|
-
const icon = (() => {
|
|
13
|
-
switch (name) {
|
|
14
|
-
case "network":
|
|
15
|
-
return /*#__PURE__*/_jsx(Globe, {
|
|
16
|
-
size: size,
|
|
17
|
-
color: c
|
|
18
|
-
});
|
|
19
|
-
case "storage":
|
|
20
|
-
return /*#__PURE__*/_jsx(Database, {
|
|
21
|
-
size: size,
|
|
22
|
-
color: c
|
|
23
|
-
});
|
|
24
|
-
case "route":
|
|
25
|
-
return /*#__PURE__*/_jsx(Navigation, {
|
|
26
|
-
size: size,
|
|
27
|
-
color: c
|
|
28
|
-
});
|
|
29
|
-
case "screen":
|
|
30
|
-
return /*#__PURE__*/_jsx(Eye, {
|
|
31
|
-
size: size,
|
|
32
|
-
color: c
|
|
33
|
-
});
|
|
34
|
-
case "user":
|
|
35
|
-
return /*#__PURE__*/_jsx(User, {
|
|
36
|
-
size: size,
|
|
37
|
-
color: c
|
|
38
|
-
});
|
|
39
|
-
case "image":
|
|
40
|
-
return /*#__PURE__*/_jsx(ImageIcon, {
|
|
41
|
-
size: size,
|
|
42
|
-
color: c
|
|
43
|
-
});
|
|
44
|
-
case "check":
|
|
45
|
-
return /*#__PURE__*/_jsx(Check, {
|
|
46
|
-
size: size,
|
|
47
|
-
color: night.color.accent
|
|
48
|
-
});
|
|
49
|
-
case "warn":
|
|
50
|
-
return /*#__PURE__*/_jsx(AlertTriangle, {
|
|
51
|
-
size: size,
|
|
52
|
-
color: night.color.warning
|
|
53
|
-
});
|
|
54
|
-
case "info":
|
|
55
|
-
return /*#__PURE__*/_jsx(Info, {
|
|
56
|
-
size: size,
|
|
57
|
-
color: night.color.info
|
|
58
|
-
});
|
|
59
|
-
case "store":
|
|
60
|
-
return /*#__PURE__*/_jsx(Layers, {
|
|
61
|
-
size: size,
|
|
62
|
-
color: c
|
|
63
|
-
});
|
|
64
|
-
case "query":
|
|
65
|
-
return /*#__PURE__*/_jsx(Layers, {
|
|
66
|
-
size: size,
|
|
67
|
-
color: c
|
|
68
|
-
});
|
|
69
|
-
case "clock":
|
|
70
|
-
return /*#__PURE__*/_jsx(Clock, {
|
|
71
|
-
size: size,
|
|
72
|
-
color: c
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
})();
|
|
76
|
-
return /*#__PURE__*/_jsx(View, {
|
|
77
|
-
style: styles.wrap,
|
|
78
|
-
children: icon
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
const styles = StyleSheet.create({
|
|
82
|
-
wrap: {
|
|
83
|
-
width: 24,
|
|
84
|
-
height: 24,
|
|
85
|
-
borderRadius: 6,
|
|
86
|
-
backgroundColor: night.color.fill,
|
|
87
|
-
alignItems: "center",
|
|
88
|
-
justifyContent: "center"
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
//# sourceMappingURL=icons.js.map
|
|
1
|
+
"use strict";import{View,StyleSheet}from"react-native";import{AlertTriangle,Check,Clock,Database,Eye,Globe,Image as ImageIcon,Info,Layers,Navigation,night,User}from"@buoy-gg/shared-ui";import{jsx as _jsx}from"react/jsx-runtime";export function BlockIcon({name:e,size:r=14}){const o=night.color.textSecondary,s=(()=>{switch(e){case"network":return _jsx(Globe,{size:r,color:o});case"storage":return _jsx(Database,{size:r,color:o});case"route":return _jsx(Navigation,{size:r,color:o});case"screen":return _jsx(Eye,{size:r,color:o});case"user":return _jsx(User,{size:r,color:o});case"image":return _jsx(ImageIcon,{size:r,color:o});case"check":return _jsx(Check,{size:r,color:night.color.accent});case"warn":return _jsx(AlertTriangle,{size:r,color:night.color.warning});case"info":return _jsx(Info,{size:r,color:night.color.info});case"store":case"query":return _jsx(Layers,{size:r,color:o});case"clock":return _jsx(Clock,{size:r,color:o})}})();return _jsx(View,{style:styles.wrap,children:s})}const styles=StyleSheet.create({wrap:{width:24,height:24,borderRadius:6,backgroundColor:night.color.fill,alignItems:"center",justifyContent:"center"}});
|
|
@@ -1,8 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
export { BlockRenderer } from "./BlockRenderer";
|
|
4
|
-
export { BlockHandlersProvider, useBlockHandlers } from "./context";
|
|
5
|
-
export { Card, ActionRow, ProvenanceBadge } from "./primitives";
|
|
6
|
-
export { MessageActions, ReasoningStrip, ElapsedRow, QueuedComposer, ReloadDivider, Timestamp, EditableUserBubble } from "./ChromePrototypes";
|
|
7
|
-
export { LivePill } from "./ExtraBlocks";
|
|
8
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
"use strict";export{BlockRenderer}from"./BlockRenderer";export{BlockHandlersProvider,useBlockHandlers}from"./context";export{Card,ActionRow,ProvenanceBadge}from"./primitives";export{MessageActions,ReasoningStrip,ElapsedRow,QueuedComposer,ReloadDivider,Timestamp,EditableUserBubble}from"./ChromePrototypes";export{LivePill}from"./ExtraBlocks";
|
|
@@ -1,301 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* The few visual pieces every block shares: the card, its title row with the
|
|
5
|
-
* provenance badge, a "+N more" expander, and the two-button action row.
|
|
6
|
-
* Night tokens only — a block must look like every other Buoy surface.
|
|
7
|
-
*/
|
|
8
|
-
import { useState } from "react";
|
|
9
|
-
import { ActivityIndicator, Pressable, StyleSheet, Text, View } from "react-native";
|
|
10
|
-
import { Check, ChevronDown, night, X } from "@buoy-gg/shared-ui";
|
|
11
|
-
import { actionKey, useBlockHandlers } from "./context";
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
export function toneColor(tone) {
|
|
14
|
-
switch (tone) {
|
|
15
|
-
case "accent":
|
|
16
|
-
return night.color.accent;
|
|
17
|
-
case "warning":
|
|
18
|
-
return night.color.warning;
|
|
19
|
-
case "danger":
|
|
20
|
-
return night.color.danger;
|
|
21
|
-
case "info":
|
|
22
|
-
return night.color.info;
|
|
23
|
-
case "muted":
|
|
24
|
-
return night.color.textTertiary;
|
|
25
|
-
default:
|
|
26
|
-
return night.color.text;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/** Quiet when live; loud when the data was changed, mocked, or invented. */
|
|
31
|
-
export function ProvenanceBadge({
|
|
32
|
-
source
|
|
33
|
-
}) {
|
|
34
|
-
if (!source || source === "live") return null;
|
|
35
|
-
const label = source === "changed" ? "CHANGED BY ASK BUOY" : source === "mocked" ? "MOCKED" : "FROM THE MODEL";
|
|
36
|
-
const color = source === "changed" ? night.color.warning : source === "mocked" ? night.color.danger : night.color.textTertiary;
|
|
37
|
-
return /*#__PURE__*/_jsx(View, {
|
|
38
|
-
style: [styles.badge, {
|
|
39
|
-
borderColor: color
|
|
40
|
-
}],
|
|
41
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
42
|
-
style: [styles.badgeText, {
|
|
43
|
-
color
|
|
44
|
-
}],
|
|
45
|
-
children: label
|
|
46
|
-
})
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
export function Card({
|
|
50
|
-
title,
|
|
51
|
-
source,
|
|
52
|
-
children,
|
|
53
|
-
testID,
|
|
54
|
-
tone
|
|
55
|
-
}) {
|
|
56
|
-
return /*#__PURE__*/_jsxs(View, {
|
|
57
|
-
style: [styles.card, tone === "warning" && styles.cardWarning, tone === "danger" && styles.cardDanger, tone === "info" && styles.cardInfo],
|
|
58
|
-
testID: testID,
|
|
59
|
-
children: [(title || source && source !== "live") && /*#__PURE__*/_jsxs(View, {
|
|
60
|
-
style: styles.titleRow,
|
|
61
|
-
children: [title ? /*#__PURE__*/_jsx(Text, {
|
|
62
|
-
style: styles.title,
|
|
63
|
-
numberOfLines: 2,
|
|
64
|
-
children: title
|
|
65
|
-
}) : /*#__PURE__*/_jsx(View, {
|
|
66
|
-
style: styles.flex
|
|
67
|
-
}), /*#__PURE__*/_jsx(ProvenanceBadge, {
|
|
68
|
-
source: source
|
|
69
|
-
})]
|
|
70
|
-
}), children]
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/** "+N more" — renders the hidden rows when tapped. Never a nested scroller. */
|
|
75
|
-
export function More({
|
|
76
|
-
shown,
|
|
77
|
-
total,
|
|
78
|
-
onExpand,
|
|
79
|
-
expanded
|
|
80
|
-
}) {
|
|
81
|
-
if (!total || total <= shown) return null;
|
|
82
|
-
return /*#__PURE__*/_jsxs(Pressable, {
|
|
83
|
-
onPress: onExpand,
|
|
84
|
-
disabled: !onExpand,
|
|
85
|
-
style: styles.more,
|
|
86
|
-
accessibilityRole: "button",
|
|
87
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
88
|
-
style: styles.moreText,
|
|
89
|
-
children: expanded ? "Show fewer" : `+${total - shown} more`
|
|
90
|
-
}), onExpand ? /*#__PURE__*/_jsx(ChevronDown, {
|
|
91
|
-
size: 12,
|
|
92
|
-
color: night.color.textTertiary
|
|
93
|
-
}) : null]
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
export function useExpand(items, cap) {
|
|
97
|
-
const [expanded, setExpanded] = useState(false);
|
|
98
|
-
return {
|
|
99
|
-
visible: expanded ? items : items.slice(0, cap),
|
|
100
|
-
expanded,
|
|
101
|
-
toggle: () => setExpanded(v => !v)
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/** Up to two buttons. One primary (accent, dark ink), one plate. */
|
|
106
|
-
export function ActionRow({
|
|
107
|
-
actions,
|
|
108
|
-
blockId,
|
|
109
|
-
align = "left"
|
|
110
|
-
}) {
|
|
111
|
-
const h = useBlockHandlers();
|
|
112
|
-
if (!actions?.length) return null;
|
|
113
|
-
const supported = actions.filter(a => {
|
|
114
|
-
if (a.openTool) return h.supports?.openTool !== false;
|
|
115
|
-
if (a.minimize) return h.supports?.minimize !== false;
|
|
116
|
-
if (a.dispatch) return h.supports?.dispatch !== false;
|
|
117
|
-
return true;
|
|
118
|
-
});
|
|
119
|
-
if (supported.length === 0) return null;
|
|
120
|
-
return /*#__PURE__*/_jsx(View, {
|
|
121
|
-
style: [styles.actions, align === "right" && styles.actionsRight],
|
|
122
|
-
children: supported.slice(0, 2).map(a => {
|
|
123
|
-
const state = h.actionState?.[actionKey(blockId, a)];
|
|
124
|
-
const disabled = !!h.busy || state === "running" || state === "done";
|
|
125
|
-
return /*#__PURE__*/_jsxs(Pressable, {
|
|
126
|
-
accessibilityRole: "button",
|
|
127
|
-
accessibilityLabel: a.label,
|
|
128
|
-
testID: `buoy-block-action-${a.label.toLowerCase().replace(/\s+/g, "-")}`,
|
|
129
|
-
disabled: disabled,
|
|
130
|
-
onPress: () => void h.runAction(a, blockId),
|
|
131
|
-
style: ({
|
|
132
|
-
pressed
|
|
133
|
-
}) => [styles.button, a.primary ? styles.buttonPrimary : styles.buttonPlate, disabled && styles.buttonDisabled, pressed && !disabled && styles.pressed],
|
|
134
|
-
children: [state === "running" ? /*#__PURE__*/_jsx(ActivityIndicator, {
|
|
135
|
-
size: "small",
|
|
136
|
-
color: a.primary ? night.color.onAccent : night.color.text
|
|
137
|
-
}) : state === "done" ? /*#__PURE__*/_jsx(Check, {
|
|
138
|
-
size: 12,
|
|
139
|
-
color: a.primary ? night.color.onAccent : night.color.accent
|
|
140
|
-
}) : state === "failed" ? /*#__PURE__*/_jsx(X, {
|
|
141
|
-
size: 12,
|
|
142
|
-
color: night.color.danger
|
|
143
|
-
}) : null, /*#__PURE__*/_jsx(Text, {
|
|
144
|
-
style: [styles.buttonText, a.primary ? styles.buttonTextPrimary : styles.buttonTextPlate],
|
|
145
|
-
children: a.label
|
|
146
|
-
})]
|
|
147
|
-
}, a.label);
|
|
148
|
-
})
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
export const blockStyles = StyleSheet.create({
|
|
152
|
-
row: {
|
|
153
|
-
flexDirection: "row",
|
|
154
|
-
alignItems: "center",
|
|
155
|
-
gap: 10,
|
|
156
|
-
paddingHorizontal: 12,
|
|
157
|
-
paddingVertical: 9
|
|
158
|
-
},
|
|
159
|
-
rowDivider: {
|
|
160
|
-
borderTopWidth: StyleSheet.hairlineWidth,
|
|
161
|
-
borderTopColor: night.color.separator
|
|
162
|
-
},
|
|
163
|
-
rowTitle: {
|
|
164
|
-
flex: 1,
|
|
165
|
-
color: night.color.text,
|
|
166
|
-
fontSize: night.font.body,
|
|
167
|
-
lineHeight: 19
|
|
168
|
-
},
|
|
169
|
-
rowSub: {
|
|
170
|
-
color: night.color.textSecondary,
|
|
171
|
-
fontSize: night.font.caption,
|
|
172
|
-
lineHeight: 17
|
|
173
|
-
},
|
|
174
|
-
rowTrailing: {
|
|
175
|
-
color: night.color.textTertiary,
|
|
176
|
-
fontSize: night.font.caption,
|
|
177
|
-
maxWidth: 120,
|
|
178
|
-
textAlign: "right"
|
|
179
|
-
},
|
|
180
|
-
mono: {
|
|
181
|
-
fontFamily: "Menlo",
|
|
182
|
-
fontSize: 12,
|
|
183
|
-
color: night.color.text
|
|
184
|
-
},
|
|
185
|
-
pill: {
|
|
186
|
-
paddingHorizontal: 7,
|
|
187
|
-
paddingVertical: 2,
|
|
188
|
-
borderRadius: night.radius.badge,
|
|
189
|
-
backgroundColor: night.color.fill
|
|
190
|
-
},
|
|
191
|
-
pillText: {
|
|
192
|
-
fontSize: night.font.micro,
|
|
193
|
-
fontWeight: "700",
|
|
194
|
-
letterSpacing: 0.4,
|
|
195
|
-
color: night.color.textSecondary
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
const styles = StyleSheet.create({
|
|
199
|
-
card: {
|
|
200
|
-
borderRadius: night.radius.card,
|
|
201
|
-
borderWidth: StyleSheet.hairlineWidth,
|
|
202
|
-
borderColor: night.color.border,
|
|
203
|
-
backgroundColor: night.color.surface,
|
|
204
|
-
overflow: "hidden"
|
|
205
|
-
},
|
|
206
|
-
cardWarning: {
|
|
207
|
-
borderColor: night.color.warning,
|
|
208
|
-
backgroundColor: night.color.warningSoft
|
|
209
|
-
},
|
|
210
|
-
cardDanger: {
|
|
211
|
-
borderColor: night.color.danger,
|
|
212
|
-
backgroundColor: night.color.dangerSoft
|
|
213
|
-
},
|
|
214
|
-
cardInfo: {
|
|
215
|
-
borderColor: night.color.accentBorderStrong,
|
|
216
|
-
backgroundColor: night.color.accentSoft
|
|
217
|
-
},
|
|
218
|
-
titleRow: {
|
|
219
|
-
flexDirection: "row",
|
|
220
|
-
alignItems: "center",
|
|
221
|
-
gap: 8,
|
|
222
|
-
paddingHorizontal: 12,
|
|
223
|
-
paddingTop: 10,
|
|
224
|
-
paddingBottom: 6
|
|
225
|
-
},
|
|
226
|
-
flex: {
|
|
227
|
-
flex: 1
|
|
228
|
-
},
|
|
229
|
-
title: {
|
|
230
|
-
flex: 1,
|
|
231
|
-
color: night.color.text,
|
|
232
|
-
fontSize: night.font.caption,
|
|
233
|
-
fontWeight: "600"
|
|
234
|
-
},
|
|
235
|
-
badge: {
|
|
236
|
-
borderWidth: StyleSheet.hairlineWidth,
|
|
237
|
-
borderRadius: night.radius.badge,
|
|
238
|
-
paddingHorizontal: 6,
|
|
239
|
-
paddingVertical: 2
|
|
240
|
-
},
|
|
241
|
-
badgeText: {
|
|
242
|
-
fontSize: 9,
|
|
243
|
-
fontWeight: "700",
|
|
244
|
-
letterSpacing: 0.6
|
|
245
|
-
},
|
|
246
|
-
more: {
|
|
247
|
-
flexDirection: "row",
|
|
248
|
-
alignItems: "center",
|
|
249
|
-
justifyContent: "center",
|
|
250
|
-
gap: 4,
|
|
251
|
-
paddingVertical: 9,
|
|
252
|
-
borderTopWidth: StyleSheet.hairlineWidth,
|
|
253
|
-
borderTopColor: night.color.separator
|
|
254
|
-
},
|
|
255
|
-
moreText: {
|
|
256
|
-
color: night.color.textSecondary,
|
|
257
|
-
fontSize: night.font.caption,
|
|
258
|
-
fontWeight: "600"
|
|
259
|
-
},
|
|
260
|
-
actions: {
|
|
261
|
-
flexDirection: "row",
|
|
262
|
-
gap: 8,
|
|
263
|
-
paddingHorizontal: 12,
|
|
264
|
-
paddingVertical: 10,
|
|
265
|
-
flexWrap: "wrap"
|
|
266
|
-
},
|
|
267
|
-
actionsRight: {
|
|
268
|
-
justifyContent: "flex-end"
|
|
269
|
-
},
|
|
270
|
-
button: {
|
|
271
|
-
flexDirection: "row",
|
|
272
|
-
alignItems: "center",
|
|
273
|
-
gap: 6,
|
|
274
|
-
paddingHorizontal: 14,
|
|
275
|
-
paddingVertical: 9,
|
|
276
|
-
borderRadius: night.radius.row
|
|
277
|
-
},
|
|
278
|
-
buttonPrimary: {
|
|
279
|
-
backgroundColor: night.color.accent
|
|
280
|
-
},
|
|
281
|
-
buttonPlate: {
|
|
282
|
-
backgroundColor: night.color.button
|
|
283
|
-
},
|
|
284
|
-
buttonDisabled: {
|
|
285
|
-
opacity: 0.55
|
|
286
|
-
},
|
|
287
|
-
buttonText: {
|
|
288
|
-
fontSize: night.font.caption,
|
|
289
|
-
fontWeight: "600"
|
|
290
|
-
},
|
|
291
|
-
buttonTextPrimary: {
|
|
292
|
-
color: night.color.onAccent
|
|
293
|
-
},
|
|
294
|
-
buttonTextPlate: {
|
|
295
|
-
color: night.color.text
|
|
296
|
-
},
|
|
297
|
-
pressed: {
|
|
298
|
-
opacity: 0.7
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
//# sourceMappingURL=primitives.js.map
|
|
1
|
+
"use strict";import{useState}from"react";import{ActivityIndicator,Pressable,StyleSheet,Text,View}from"react-native";import{Check,ChevronDown,night,X}from"@buoy-gg/shared-ui";import{actionKey,useBlockHandlers}from"./context";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export function toneColor(t){switch(t){case"accent":return night.color.accent;case"warning":return night.color.warning;case"danger":return night.color.danger;case"info":return night.color.info;case"muted":return night.color.textTertiary;default:return night.color.text}}export function ProvenanceBadge({source:t}){if(!t||"live"===t)return null;const e="changed"===t?"CHANGED BY ASK BUOY":"mocked"===t?"MOCKED":"FROM THE MODEL",o="changed"===t?night.color.warning:"mocked"===t?night.color.danger:night.color.textTertiary;return _jsx(View,{style:[styles.badge,{borderColor:o}],children:_jsx(Text,{style:[styles.badgeText,{color:o}],children:e})})}export function Card({title:t,source:e,children:o,testID:r,tone:n}){return _jsxs(View,{style:[styles.card,"warning"===n&&styles.cardWarning,"danger"===n&&styles.cardDanger,"info"===n&&styles.cardInfo],testID:r,children:[(t||e&&"live"!==e)&&_jsxs(View,{style:styles.titleRow,children:[t?_jsx(Text,{style:styles.title,numberOfLines:2,children:t}):_jsx(View,{style:styles.flex}),_jsx(ProvenanceBadge,{source:e})]}),o]})}export function More({shown:t,total:e,onExpand:o,expanded:r}){return!e||e<=t?null:_jsxs(Pressable,{onPress:o,disabled:!o,style:styles.more,accessibilityRole:"button",children:[_jsx(Text,{style:styles.moreText,children:r?"Show fewer":`+${e-t} more`}),o?_jsx(ChevronDown,{size:12,color:night.color.textTertiary}):null]})}export function useExpand(t,e){const[o,r]=useState(!1);return{visible:o?t:t.slice(0,e),expanded:o,toggle:()=>r(t=>!t)}}export function ActionRow({actions:t,blockId:e,align:o="left"}){const r=useBlockHandlers();if(!t?.length)return null;const n=t.filter(t=>t.openTool?!1!==r.supports?.openTool:t.minimize?!1!==r.supports?.minimize:!t.dispatch||!1!==r.supports?.dispatch);return 0===n.length?null:_jsx(View,{style:[styles.actions,"right"===o&&styles.actionsRight],children:n.slice(0,2).map(t=>{const o=r.actionState?.[actionKey(e,t)],n=!!r.busy||"running"===o||"done"===o;return _jsxs(Pressable,{accessibilityRole:"button",accessibilityLabel:t.label,testID:`buoy-block-action-${t.label.toLowerCase().replace(/\s+/g,"-")}`,disabled:n,onPress:()=>{r.runAction(t,e)},style:({pressed:e})=>[styles.button,t.primary?styles.buttonPrimary:styles.buttonPlate,n&&styles.buttonDisabled,e&&!n&&styles.pressed],children:["running"===o?_jsx(ActivityIndicator,{size:"small",color:t.primary?night.color.onAccent:night.color.text}):"done"===o?_jsx(Check,{size:12,color:t.primary?night.color.onAccent:night.color.accent}):"failed"===o?_jsx(X,{size:12,color:night.color.danger}):null,_jsx(Text,{style:[styles.buttonText,t.primary?styles.buttonTextPrimary:styles.buttonTextPlate],children:t.label})]},t.label)})})}export const blockStyles=StyleSheet.create({row:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:12,paddingVertical:9},rowDivider:{borderTopWidth:StyleSheet.hairlineWidth,borderTopColor:night.color.separator},rowTitle:{flex:1,color:night.color.text,fontSize:night.font.body,lineHeight:19},rowSub:{color:night.color.textSecondary,fontSize:night.font.caption,lineHeight:17},rowTrailing:{color:night.color.textTertiary,fontSize:night.font.caption,maxWidth:120,textAlign:"right"},mono:{fontFamily:"Menlo",fontSize:12,color:night.color.text},pill:{paddingHorizontal:7,paddingVertical:2,borderRadius:night.radius.badge,backgroundColor:night.color.fill},pillText:{fontSize:night.font.micro,fontWeight:"700",letterSpacing:.4,color:night.color.textSecondary}});const styles=StyleSheet.create({card:{borderRadius:night.radius.card,borderWidth:StyleSheet.hairlineWidth,borderColor:night.color.border,backgroundColor:night.color.surface,overflow:"hidden"},cardWarning:{borderColor:night.color.warning,backgroundColor:night.color.warningSoft},cardDanger:{borderColor:night.color.danger,backgroundColor:night.color.dangerSoft},cardInfo:{borderColor:night.color.accentBorderStrong,backgroundColor:night.color.accentSoft},titleRow:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:12,paddingTop:10,paddingBottom:6},flex:{flex:1},title:{flex:1,color:night.color.text,fontSize:night.font.caption,fontWeight:"600"},badge:{borderWidth:StyleSheet.hairlineWidth,borderRadius:night.radius.badge,paddingHorizontal:6,paddingVertical:2},badgeText:{fontSize:9,fontWeight:"700",letterSpacing:.6},more:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:4,paddingVertical:9,borderTopWidth:StyleSheet.hairlineWidth,borderTopColor:night.color.separator},moreText:{color:night.color.textSecondary,fontSize:night.font.caption,fontWeight:"600"},actions:{flexDirection:"row",gap:8,paddingHorizontal:12,paddingVertical:10,flexWrap:"wrap"},actionsRight:{justifyContent:"flex-end"},button:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:14,paddingVertical:9,borderRadius:night.radius.row},buttonPrimary:{backgroundColor:night.color.accent},buttonPlate:{backgroundColor:night.color.button},buttonDisabled:{opacity:.55},buttonText:{fontSize:night.font.caption,fontWeight:"600"},buttonTextPrimary:{color:night.color.onAccent},buttonTextPlate:{color:night.color.text},pressed:{opacity:.7}});
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
export { ActionRow, blockStyles, Card, More, ProvenanceBadge, toneColor, useExpand } from "./primitives";
|
|
4
|
-
export { useBlockHandlers } from "./context";
|
|
5
|
-
//# sourceMappingURL=primitivesIndex.js.map
|
|
1
|
+
"use strict";export{ActionRow,blockStyles,Card,More,ProvenanceBadge,toneColor,useExpand}from"./primitives";export{useBlockHandlers}from"./context";
|
|
@@ -1,135 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* The approval prompt, shown only when the app opted into `requireApproval`.
|
|
5
|
-
*
|
|
6
|
-
* It renders the EFFECT, not the payload. That is the whole design constraint:
|
|
7
|
-
* every other agent product assumes a developer is reading the proposed
|
|
8
|
-
* command before approving it, and the people this tool is for cannot evaluate
|
|
9
|
-
* `redux_dispatch({type:'SET_ENTITLEMENTS', payload:{…}})`. An approval prompt
|
|
10
|
-
* nobody can read is not oversight — it is a rubber stamp that looks like
|
|
11
|
-
* oversight, which is worse than having no prompt at all.
|
|
12
|
-
*/
|
|
13
|
-
import { Pressable, StyleSheet, Text, View } from "react-native";
|
|
14
|
-
import { AlertTriangle, night } from "@buoy-gg/shared-ui";
|
|
15
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
-
export function ApprovalCard({
|
|
17
|
-
pending,
|
|
18
|
-
onAnswer
|
|
19
|
-
}) {
|
|
20
|
-
return /*#__PURE__*/_jsxs(View, {
|
|
21
|
-
style: styles.card,
|
|
22
|
-
testID: "buoy-ask-buoy-approval",
|
|
23
|
-
children: [/*#__PURE__*/_jsxs(View, {
|
|
24
|
-
style: styles.titleRow,
|
|
25
|
-
children: [/*#__PURE__*/_jsx(AlertTriangle, {
|
|
26
|
-
size: 14,
|
|
27
|
-
color: night.color.warning
|
|
28
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
29
|
-
style: styles.title,
|
|
30
|
-
children: "Allow this change?"
|
|
31
|
-
})]
|
|
32
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
33
|
-
style: styles.label,
|
|
34
|
-
children: pending.label
|
|
35
|
-
}), pending.description ? /*#__PURE__*/_jsx(Text, {
|
|
36
|
-
style: styles.description,
|
|
37
|
-
children: pending.description
|
|
38
|
-
}) : null, /*#__PURE__*/_jsx(Text, {
|
|
39
|
-
style: styles.reason,
|
|
40
|
-
children: pending.reason
|
|
41
|
-
}), /*#__PURE__*/_jsxs(View, {
|
|
42
|
-
style: styles.actions,
|
|
43
|
-
children: [/*#__PURE__*/_jsx(Pressable, {
|
|
44
|
-
testID: "buoy-ask-buoy-approve",
|
|
45
|
-
accessibilityRole: "button",
|
|
46
|
-
onPress: () => onAnswer(true),
|
|
47
|
-
style: ({
|
|
48
|
-
pressed
|
|
49
|
-
}) => [styles.button, styles.approve, pressed && styles.pressed],
|
|
50
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
51
|
-
style: styles.approveText,
|
|
52
|
-
children: "Allow"
|
|
53
|
-
})
|
|
54
|
-
}), /*#__PURE__*/_jsx(Pressable, {
|
|
55
|
-
testID: "buoy-ask-buoy-reject",
|
|
56
|
-
accessibilityRole: "button",
|
|
57
|
-
onPress: () => onAnswer(false),
|
|
58
|
-
style: ({
|
|
59
|
-
pressed
|
|
60
|
-
}) => [styles.button, styles.reject, pressed && styles.pressed],
|
|
61
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
62
|
-
style: styles.rejectText,
|
|
63
|
-
children: "Not now"
|
|
64
|
-
})
|
|
65
|
-
})]
|
|
66
|
-
})]
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
const styles = StyleSheet.create({
|
|
70
|
-
card: {
|
|
71
|
-
marginHorizontal: night.gutter,
|
|
72
|
-
marginBottom: 10,
|
|
73
|
-
padding: night.cardPad,
|
|
74
|
-
borderRadius: night.radius.card,
|
|
75
|
-
borderWidth: StyleSheet.hairlineWidth,
|
|
76
|
-
borderColor: night.color.accentBorderStrong,
|
|
77
|
-
backgroundColor: night.color.surface,
|
|
78
|
-
gap: 6
|
|
79
|
-
},
|
|
80
|
-
titleRow: {
|
|
81
|
-
flexDirection: "row",
|
|
82
|
-
alignItems: "center",
|
|
83
|
-
gap: 6
|
|
84
|
-
},
|
|
85
|
-
title: {
|
|
86
|
-
color: night.color.text,
|
|
87
|
-
fontSize: night.font.caption,
|
|
88
|
-
fontWeight: "600"
|
|
89
|
-
},
|
|
90
|
-
label: {
|
|
91
|
-
color: night.color.text,
|
|
92
|
-
fontSize: night.font.row,
|
|
93
|
-
fontWeight: "600",
|
|
94
|
-
lineHeight: 20
|
|
95
|
-
},
|
|
96
|
-
description: {
|
|
97
|
-
color: night.color.textSecondary,
|
|
98
|
-
fontSize: night.font.caption,
|
|
99
|
-
lineHeight: 18
|
|
100
|
-
},
|
|
101
|
-
reason: {
|
|
102
|
-
color: night.color.warning,
|
|
103
|
-
fontSize: night.font.caption,
|
|
104
|
-
lineHeight: 18
|
|
105
|
-
},
|
|
106
|
-
actions: {
|
|
107
|
-
flexDirection: "row",
|
|
108
|
-
gap: 8,
|
|
109
|
-
marginTop: 6
|
|
110
|
-
},
|
|
111
|
-
button: {
|
|
112
|
-
paddingHorizontal: 16,
|
|
113
|
-
paddingVertical: 9,
|
|
114
|
-
borderRadius: night.radius.row
|
|
115
|
-
},
|
|
116
|
-
approve: {
|
|
117
|
-
backgroundColor: night.color.accent
|
|
118
|
-
},
|
|
119
|
-
approveText: {
|
|
120
|
-
color: night.color.onAccent,
|
|
121
|
-
fontWeight: "600",
|
|
122
|
-
fontSize: night.font.caption
|
|
123
|
-
},
|
|
124
|
-
reject: {
|
|
125
|
-
backgroundColor: night.color.button
|
|
126
|
-
},
|
|
127
|
-
rejectText: {
|
|
128
|
-
color: night.color.text,
|
|
129
|
-
fontSize: night.font.caption
|
|
130
|
-
},
|
|
131
|
-
pressed: {
|
|
132
|
-
opacity: 0.7
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
//# sourceMappingURL=ApprovalCard.js.map
|
|
1
|
+
"use strict";import{Pressable,StyleSheet,Text,View}from"react-native";import{AlertTriangle,night}from"@buoy-gg/shared-ui";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export function ApprovalCard({pending:t,onAnswer:e}){return _jsxs(View,{style:styles.card,testID:"buoy-ask-buoy-approval",children:[_jsxs(View,{style:styles.titleRow,children:[_jsx(AlertTriangle,{size:14,color:night.color.warning}),_jsx(Text,{style:styles.title,children:"Allow this change?"})]}),_jsx(Text,{style:styles.label,children:t.label}),t.description?_jsx(Text,{style:styles.description,children:t.description}):null,_jsx(Text,{style:styles.reason,children:t.reason}),_jsxs(View,{style:styles.actions,children:[_jsx(Pressable,{testID:"buoy-ask-buoy-approve",accessibilityRole:"button",onPress:()=>e(!0),style:({pressed:t})=>[styles.button,styles.approve,t&&styles.pressed],children:_jsx(Text,{style:styles.approveText,children:"Allow"})}),_jsx(Pressable,{testID:"buoy-ask-buoy-reject",accessibilityRole:"button",onPress:()=>e(!1),style:({pressed:t})=>[styles.button,styles.reject,t&&styles.pressed],children:_jsx(Text,{style:styles.rejectText,children:"Not now"})})]})]})}const styles=StyleSheet.create({card:{marginHorizontal:night.gutter,marginBottom:10,padding:night.cardPad,borderRadius:night.radius.card,borderWidth:StyleSheet.hairlineWidth,borderColor:night.color.accentBorderStrong,backgroundColor:night.color.surface,gap:6},titleRow:{flexDirection:"row",alignItems:"center",gap:6},title:{color:night.color.text,fontSize:night.font.caption,fontWeight:"600"},label:{color:night.color.text,fontSize:night.font.row,fontWeight:"600",lineHeight:20},description:{color:night.color.textSecondary,fontSize:night.font.caption,lineHeight:18},reason:{color:night.color.warning,fontSize:night.font.caption,lineHeight:18},actions:{flexDirection:"row",gap:8,marginTop:6},button:{paddingHorizontal:16,paddingVertical:9,borderRadius:night.radius.row},approve:{backgroundColor:night.color.accent},approveText:{color:night.color.onAccent,fontWeight:"600",fontSize:night.font.caption},reject:{backgroundColor:night.color.button},rejectText:{color:night.color.text,fontSize:night.font.caption},pressed:{opacity:.7}});
|
|
@@ -1,124 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* The sheet header.
|
|
5
|
-
*
|
|
6
|
-
* Built on the shared `ModalHeader` so it matches Console, Network and Events
|
|
7
|
-
* 1:1 — the stock JsModal header was designed for a single centred title and
|
|
8
|
-
* paints its "Double tap: Toggle • Triple tap: Close" hint through the middle
|
|
9
|
-
* of it, which is how "Ask Buoy" ended up overprinted by grey italics.
|
|
10
|
-
*
|
|
11
|
-
* The subtitle is the one piece of live status the sheet has: what the agent
|
|
12
|
-
* is doing right now, in words a tester can act on. "Thinking…" while a
|
|
13
|
-
* response is streaming with no tool in flight, the current tool's title
|
|
14
|
-
* while one runs, and the reachable tool count at rest so a "why can't it
|
|
15
|
-
* see my network calls" question has an answer in the header.
|
|
16
|
-
*
|
|
17
|
-
* "New conversation" moved up here from a 11pt text link under the composer.
|
|
18
|
-
* A reset that lives under the keyboard is a reset nobody finds.
|
|
19
|
-
*/
|
|
20
|
-
import { useEffect, useState } from "react";
|
|
21
|
-
import { StyleSheet, TouchableOpacity, View } from "react-native";
|
|
22
|
-
import { ModalHeader, night, Otto, Plus } from "@buoy-gg/shared-ui";
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Slower than the sprite's default 140ms.
|
|
26
|
-
*
|
|
27
|
-
* This mascot is ambient status a user stares at for the length of a turn,
|
|
28
|
-
* not a moment of delight they glance at once — at the stock tick it read as
|
|
29
|
-
* fidgeting in the corner of the eye while you were trying to read the
|
|
30
|
-
* answer next to it. Every other placement keeps the default.
|
|
31
|
-
*/
|
|
32
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
33
|
-
const HEADER_TICK_MS = 200;
|
|
34
|
-
export function AskBuoyHeader({
|
|
35
|
-
configured,
|
|
36
|
-
busy,
|
|
37
|
-
failed = false,
|
|
38
|
-
activeLabel,
|
|
39
|
-
toolCount,
|
|
40
|
-
hasMessages,
|
|
41
|
-
onBack,
|
|
42
|
-
onReset
|
|
43
|
-
}) {
|
|
44
|
-
/**
|
|
45
|
-
* ONE mascot state per turn, held to the end of it.
|
|
46
|
-
*
|
|
47
|
-
* `activeLabel` drops to null in the gap between two tool calls, so deriving
|
|
48
|
-
* the state from it directly flipped robot → thinking → robot on every
|
|
49
|
-
* boundary. A turn that runs four tools swapped the sprite eight times in
|
|
50
|
-
* about three seconds — a strobe that reads as a glitch, not as progress.
|
|
51
|
-
* So the robot latches: once this turn has driven a tool it stays `robot`
|
|
52
|
-
* until the turn ends, which is also the honest summary of that turn.
|
|
53
|
-
*
|
|
54
|
-
* The SUBTITLE still tracks each call, because updating a line of text is
|
|
55
|
-
* informative where restarting an animation is just noise.
|
|
56
|
-
*/
|
|
57
|
-
const [droveTool, setDroveTool] = useState(false);
|
|
58
|
-
useEffect(() => {
|
|
59
|
-
if (!busy) setDroveTool(false);else if (activeLabel) setDroveTool(true);
|
|
60
|
-
}, [busy, activeLabel]);
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Otto mirrors the subtitle, never contradicts it. This is the one place in
|
|
64
|
-
* the product where a mascot earns continuous presence: the user is waiting
|
|
65
|
-
* on a machine and the header is the only thing reporting on it.
|
|
66
|
-
*
|
|
67
|
-
* `robot` while a tool runs is literal — the agent IS driving the tools.
|
|
68
|
-
*/
|
|
69
|
-
const otto = !configured ? "confused" : failed ? "error" : busy ? activeLabel || droveTool ? "robot" : "thinking" : "idle";
|
|
70
|
-
const subtitle = !configured ? "Not set up in this app" : busy ? activeLabel ? `${activeLabel}…` : "Thinking…" : toolCount > 0 ? `Ready · ${toolCount} tool${toolCount === 1 ? "" : "s"} available` : "Ready";
|
|
71
|
-
return /*#__PURE__*/_jsxs(ModalHeader, {
|
|
72
|
-
children: [onBack ? /*#__PURE__*/_jsx(ModalHeader.Navigation, {
|
|
73
|
-
onBack: onBack
|
|
74
|
-
}) : null, /*#__PURE__*/_jsx(View, {
|
|
75
|
-
style: styles.otto,
|
|
76
|
-
testID: "buoy-ask-buoy-otto",
|
|
77
|
-
children: /*#__PURE__*/_jsx(Otto, {
|
|
78
|
-
state: otto,
|
|
79
|
-
pixelSize: 2,
|
|
80
|
-
tickMs: HEADER_TICK_MS,
|
|
81
|
-
water: false
|
|
82
|
-
})
|
|
83
|
-
}), /*#__PURE__*/_jsx(ModalHeader.Content, {
|
|
84
|
-
title: "Ask Buoy",
|
|
85
|
-
subtitle: subtitle,
|
|
86
|
-
testID: "buoy-ask-buoy-title"
|
|
87
|
-
}), /*#__PURE__*/_jsx(ModalHeader.Actions, {
|
|
88
|
-
children: /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
89
|
-
testID: "buoy-ask-buoy-reset",
|
|
90
|
-
accessibilityRole: "button",
|
|
91
|
-
accessibilityLabel: "New conversation",
|
|
92
|
-
disabled: !hasMessages,
|
|
93
|
-
onPress: onReset,
|
|
94
|
-
style: [styles.actionBtn, !hasMessages && styles.actionBtnDisabled],
|
|
95
|
-
children: /*#__PURE__*/_jsx(Plus, {
|
|
96
|
-
size: 14,
|
|
97
|
-
color: hasMessages ? night.color.textSecondary : night.color.textTertiary
|
|
98
|
-
})
|
|
99
|
-
})
|
|
100
|
-
})]
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
const styles = StyleSheet.create({
|
|
104
|
-
// 32pt of Otto (16 grid × 2pt) reading as the header's status glyph.
|
|
105
|
-
otto: {
|
|
106
|
-
marginRight: 8,
|
|
107
|
-
justifyContent: "center"
|
|
108
|
-
},
|
|
109
|
-
// Same plate as the Console header's action buttons.
|
|
110
|
-
actionBtn: {
|
|
111
|
-
width: 32,
|
|
112
|
-
height: 32,
|
|
113
|
-
borderRadius: 8,
|
|
114
|
-
backgroundColor: night.color.buttonSurface,
|
|
115
|
-
borderWidth: 1,
|
|
116
|
-
borderColor: night.color.border,
|
|
117
|
-
alignItems: "center",
|
|
118
|
-
justifyContent: "center"
|
|
119
|
-
},
|
|
120
|
-
actionBtnDisabled: {
|
|
121
|
-
opacity: 0.55
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
//# sourceMappingURL=AskBuoyHeader.js.map
|
|
1
|
+
"use strict";import{useEffect,useState}from"react";import{StyleSheet,TouchableOpacity,View}from"react-native";import{ModalHeader,night,Otto,Plus}from"@buoy-gg/shared-ui";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const HEADER_TICK_MS=200;export function AskBuoyHeader({configured:t,busy:e,failed:o=!1,activeLabel:s,toolCount:i,hasMessages:a,onBack:r,onReset:n}){const[l,c]=useState(!1);useEffect(()=>{e?s&&c(!0):c(!1)},[e,s]);const u=t?o?"error":e?s||l?"robot":"thinking":"idle":"confused",d=t?e?s?`${s}…`:"Thinking…":i>0?`Ready · ${i} tool${1===i?"":"s"} available`:"Ready":"Not set up in this app";return _jsxs(ModalHeader,{children:[r?_jsx(ModalHeader.Navigation,{onBack:r}):null,_jsx(View,{style:styles.otto,testID:"buoy-ask-buoy-otto",children:_jsx(Otto,{state:u,pixelSize:2,tickMs:200,water:!1})}),_jsx(ModalHeader.Content,{title:"Ask Buoy",subtitle:d,testID:"buoy-ask-buoy-title"}),_jsx(ModalHeader.Actions,{children:_jsx(TouchableOpacity,{testID:"buoy-ask-buoy-reset",accessibilityRole:"button",accessibilityLabel:"New conversation",disabled:!a,onPress:n,style:[styles.actionBtn,!a&&styles.actionBtnDisabled],children:_jsx(Plus,{size:14,color:a?night.color.textSecondary:night.color.textTertiary})})})]})}const styles=StyleSheet.create({otto:{marginRight:8,justifyContent:"center"},actionBtn:{width:32,height:32,borderRadius:8,backgroundColor:night.color.buttonSurface,borderWidth:1,borderColor:night.color.border,alignItems:"center",justifyContent:"center"},actionBtnDisabled:{opacity:.55}});
|